Quellcode-Bibliothek opus_multistream.h
Sprache: C
/* Copyright (c) 2011 Xiph.Org Foundation
Written by Jean-Marc Valin */ /* Redistributionanduseinsourceandbinaryforms,withorwithout modification,arepermittedprovidedthatthefollowingconditions aremet:
/** Macros to trigger compilation errors when the wrong types are provided to a
* CTL. */ /**@{*/ #define opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr))) #define opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr))) /**@}*/
/** These are the actual encoder and decoder CTL ID numbers. *Theyshouldnotbeuseddirectlybyapplications.
* In general, SETs should be even and GETs should be odd.*/ /**@{*/ #define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120 #define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122 /**@}*/
/** Gets the encoder state for an individual stream of a multistream encoder. *@param[in]x<tt>opus_int32</tt>:Theindexofthestreamwhoseencoderyou *wishtoretrieve. *Thismustbenon-negativeandlessthan *the<code>streams</code>parameterused *toinitializetheencoder. *@param[out]y<tt>OpusEncoder**</tt>:Returnsapointertothegiven *encoderstate. *@retvalOPUS_BAD_ARGTheindexoftherequestedstreamwasoutofrange. *@hideinitializer
*/ #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, opus_check_int(x), opus_check_encstate_ptr(y)
/** Gets the decoder state for an individual stream of a multistream decoder. *@param[in]x<tt>opus_int32</tt>:Theindexofthestreamwhosedecoderyou *wishtoretrieve. *Thismustbenon-negativeandlessthan *the<code>streams</code>parameterused *toinitializethedecoder. *@param[out]y<tt>OpusDecoder**</tt>:Returnsapointertothegiven *decoderstate. *@retvalOPUS_BAD_ARGTheindexoftherequestedstreamwasoutofrange. *@hideinitializer
*/ #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, opus_check_int(x), opus_check_decstate_ptr(y)
/** Gets the size of an OpusMSEncoder structure. *@paramstreams<tt>int</tt>:Thetotalnumberofstreamstoencodefromthe *input. *Thismustbenomorethan255. *@paramcoupled_streams<tt>int</tt>:Numberofcoupled(2channel)streams *toencode. *Thismustbenolargerthanthetotal *numberofstreams. *Additionally,Thetotalnumberof *encodedchannels(<code>streams+ *coupled_streams</code>)mustbeno *morethan255. *@returnsThesizeinbytesonsuccess,oranegativeerrorcode *(see@refopus_errorcodes)onerror.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size( int streams, int coupled_streams
);
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_surround_encoder_get_size( int channels, int mapping_family
);
/** Allocates and initializes a multistream encoder state. *Callopus_multistream_encoder_destroy()torelease *thisobjectwhenfinished. *@paramFs<tt>opus_int32</tt>:Samplingrateoftheinputsignal(inHz). *Thismustbeoneof8000,12000,16000, *24000,or48000. *@paramchannels<tt>int</tt>:Numberofchannelsintheinputsignal. *Thismustbeatmost255. *Itmaybegreaterthanthenumberof *codedchannels(<code>streams+ *coupled_streams</code>). *@paramstreams<tt>int</tt>:Thetotalnumberofstreamstoencodefromthe *input. *Thismustbenomorethanthenumberofchannels. *@paramcoupled_streams<tt>int</tt>:Numberofcoupled(2channel)streams *toencode. *Thismustbenolargerthanthetotal *numberofstreams. *Additionally,Thetotalnumberof *encodedchannels(<code>streams+ *coupled_streams</code>)mustbeno *morethanthenumberofinputchannels. *@param[in]mapping<code>constunsignedchar[channels]</code>:Mappingfrom *encodedchannelstoinputchannels,asdescribedin *@refopus_multistream.Asanextraconstraint,the *multistreamencoderdoesnotallowencodingcoupled *streamsforwhichonechannelisunusedsincethis *isneveragoodidea. *@paramapplication<tt>int</tt>:Thetargetencoderapplication. *Thismustbeoneofthefollowing: *<dl> *<dt>#OPUS_APPLICATION_VOIP</dt> *<dd>Processsignalforimprovedspeechintelligibility.</dd> *<dt>#OPUS_APPLICATION_AUDIO</dt> *<dd>Favorfaithfulnesstotheoriginalinput.</dd> *<dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt> *<dd>Configuretheminimumpossiblecodingdelaybydisablingcertainmodes *ofoperation.</dd> *</dl> *@param[out]error<tt>int*</tt>:Returns#OPUS_OKonsuccess,oranerror *code(see@refopus_errorcodes)on *failure.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
opus_int32 Fs, int channels, int streams, int coupled_streams, constunsignedchar *mapping, int application, int *error
) OPUS_ARG_NONNULL(5);
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_surround_encoder_create(
opus_int32 Fs, int channels, int mapping_family, int *streams, int *coupled_streams, unsignedchar *mapping, int application, int *error
) OPUS_ARG_NONNULL(4) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6);
OPUS_EXPORT int opus_multistream_surround_encoder_init(
OpusMSEncoder *st,
opus_int32 Fs, int channels, int mapping_family, int *streams, int *coupled_streams, unsignedchar *mapping, int application
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6) OPUS_ARG_NONNULL(7);
/** Frees an <code>OpusMSEncoder</code> allocated by *opus_multistream_encoder_create(). *@paramst<tt>OpusMSEncoder*</tt>:Multistreamencoderstatetobefreed.
*/
OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
/** Perform a CTL function on a multistream Opus encoder. * *Generallytherequestandsubsequentargumentsaregeneratedbya *conveniencemacro. *@paramst<tt>OpusMSEncoder*</tt>:Multistreamencoderstate. *@paramrequestThisandallremainingparametersshouldbereplacedbyone *oftheconveniencemacrosin@refopus_genericctls, *@refopus_encoderctls,or@refopus_multistream_ctls. *@seeopus_genericctls *@seeopus_encoderctls *@seeopus_multistream_ctls
*/
OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
/**@}*/
/**\name Multistream decoder functions */ /**@{*/
/** Gets the size of an <code>OpusMSDecoder</code> structure. *@paramstreams<tt>int</tt>:Thetotalnumberofstreamscodedinthe *input. *Thismustbenomorethan255. *@paramcoupled_streams<tt>int</tt>:Numberstreamstodecodeascoupled *(2channel)streams. *Thismustbenolargerthanthetotal *numberofstreams. *Additionally,Thetotalnumberof *codedchannels(<code>streams+ *coupled_streams</code>)mustbeno *morethan255. *@returnsThesizeinbytesonsuccess,oranegativeerrorcode *(see@refopus_errorcodes)onerror.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size( int streams, int coupled_streams
);
/** Allocates and initializes a multistream decoder state. *Callopus_multistream_decoder_destroy()torelease *thisobjectwhenfinished. *@paramFs<tt>opus_int32</tt>:Samplingratetodecodeat(inHz). *Thismustbeoneof8000,12000,16000, *24000,or48000. *@paramchannels<tt>int</tt>:Numberofchannelstooutput. *Thismustbeatmost255. *Itmaybedifferentfromthenumberofcoded *channels(<code>streams+ *coupled_streams</code>). *@paramstreams<tt>int</tt>:Thetotalnumberofstreamscodedinthe *input. *Thismustbenomorethan255. *@paramcoupled_streams<tt>int</tt>:Numberofstreamstodecodeascoupled *(2channel)streams. *Thismustbenolargerthanthetotal *numberofstreams. *Additionally,Thetotalnumberof *codedchannels(<code>streams+ *coupled_streams</code>)mustbeno *morethan255. *@param[in]mapping<code>constunsignedchar[channels]</code>:Mappingfrom *codedchannelstooutputchannels,asdescribedin *@refopus_multistream. *@param[out]error<tt>int*</tt>:Returns#OPUS_OKonsuccess,oranerror *code(see@refopus_errorcodes)on *failure.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
opus_int32 Fs, int channels, int streams, int coupled_streams, constunsignedchar *mapping, int *error
) OPUS_ARG_NONNULL(5);
/** Initialize a previously allocated decoder state object. *Thememorypointedtoby\astmustbeatleastthesizereturnedby *opus_multistream_encoder_get_size(). *Thisisintendedforapplicationswhichusetheirownallocatorinsteadof *malloc. *Toresetapreviouslyinitializedstate,usethe#OPUS_RESET_STATECTL. *@seeopus_multistream_decoder_create *@seeopus_multistream_deocder_get_size *@paramst<tt>OpusMSEncoder*</tt>:Multistreamencoderstatetoinitialize. *@paramFs<tt>opus_int32</tt>:Samplingratetodecodeat(inHz). *Thismustbeoneof8000,12000,16000, *24000,or48000. *@paramchannels<tt>int</tt>:Numberofchannelstooutput. *Thismustbeatmost255. *Itmaybedifferentfromthenumberofcoded *channels(<code>streams+ *coupled_streams</code>). *@paramstreams<tt>int</tt>:Thetotalnumberofstreamscodedinthe *input. *Thismustbenomorethan255. *@paramcoupled_streams<tt>int</tt>:Numberofstreamstodecodeascoupled *(2channel)streams. *Thismustbenolargerthanthetotal *numberofstreams. *Additionally,Thetotalnumberof *codedchannels(<code>streams+ *coupled_streams</code>)mustbeno *morethan255. *@param[in]mapping<code>constunsignedchar[channels]</code>:Mappingfrom *codedchannelstooutputchannels,asdescribedin *@refopus_multistream. *@returns#OPUS_OKonsuccess,oranerrorcode(see@refopus_errorcodes) *onfailure.
*/
OPUS_EXPORT int opus_multistream_decoder_init(
OpusMSDecoder *st,
opus_int32 Fs, int channels, int streams, int coupled_streams, constunsignedchar *mapping
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
/** Decode a multistream Opus packet with floating point output. *@paramst<tt>OpusMSDecoder*</tt>:Multistreamdecoderstate. *@param[in]data<tt>constunsignedchar*</tt>:Inputpayload. *Usea<code>NULL</code> *pointertoindicatepacket *loss. *@paramlen<tt>opus_int32</tt>:Numberofbytesinpayload. *@param[out]pcm<tt>opus_int16*</tt>:Outputsignal,withinterleaved *samples. *Thismustcontainroomfor *<code>frame_size*channels</code> *samples. *@paramframe_size<tt>int</tt>:Thenumberofsamplesperchannelof *availablespacein\apcm. *Ifthisislessthanthemaximumpacketduration *(120ms;5760for48kHz),thisfunctionwillnotbecapable *ofdecodingsomepackets.InthecaseofPLC(data==NULL) *orFEC(decode_fec=1),thenframe_sizeneedstobeexactly *thedurationofaudiothatismissing,otherwisethe *decoderwillnotbeintheoptimalstatetodecodethe *nextincomingpacket.ForthePLCandFECcases,frame_size *<b>must</b>beamultipleof2.5ms. *@paramdecode_fec<tt>int</tt>:Flag(0or1)torequestthatanyin-band *forwarderrorcorrectiondatabedecoded. *Ifnosuchdataisavailable,theframeis *decodedasifitwerelost. *@returnsNumberofsamplesdecodedonsuccessoranegativeerrorcode *(see@refopus_errorcodes)onfailure.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
OpusMSDecoder *st, constunsignedchar *data,
opus_int32 len, float *pcm, int frame_size, int decode_fec
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
/** Perform a CTL function on a multistream Opus decoder. * *Generallytherequestandsubsequentargumentsaregeneratedbya *conveniencemacro. *@paramst<tt>OpusMSDecoder*</tt>:Multistreamdecoderstate. *@paramrequestThisandallremainingparametersshouldbereplacedbyone *oftheconveniencemacrosin@refopus_genericctls, *@refopus_decoderctls,or@refopus_multistream_ctls. *@seeopus_genericctls *@seeopus_decoderctls *@seeopus_multistream_ctls
*/
OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
/** Frees an <code>OpusMSDecoder</code> allocated by *opus_multistream_decoder_create(). *@paramst<tt>OpusMSDecoder</tt>:Multistreamdecoderstatetobefreed.
*/
OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
/**@}*/
/**@}*/
#ifdef __cplusplus
} #endif
#endif/* OPUS_MULTISTREAM_H */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.39 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.