📄 wmadec.h
字号:
WMARESULT CBGetMoreData(void* dwUser, audecInputBufferInfo* pRet); //O.K.//// Each of the WMA decoder methods - audecInit(), audecInput(), audecDecode(),// and audecGetPCM() - has an [out] parameter of the type audecState. This// parameter tells the caller which method should be called next. The following// caller loop structure is therefore suggested (callbackless/normal mode)://// audecState state;// WMA_U32 cSamplesReady;// audecInit(..., &state, ...)// while (audecStateDone != state) {// switch (state) {// case audecStateInput: {// WMA_U8 *pbIn; WMA_U32 cbIn; ...// read_some_input_data(&pbIn, &cbIn, ...); // caller-supplied logic// audecInput(pbIn, cbIn, ... &state, ...);// }; break;// case audecStateDecode: {// audecDecode(..., &cSamplesReady, &state, ...);// }; break;// case audecStateGetPCM: {// WMA_U8* pbOut; WMA_U32 cbOut;// get_next_output_buffer(&pbOut, &cbOut); // caller-supplied logic// audecGetPCM(cSamplesReady, ... pbOut, cbOut, ..., &state, ...);// }; break;// default: assert(0); // not other states are currently defined// }//// I.e., each audecXxxx() method sets 'state' according to what the decoder thinks// the next step should be, and the caller calls the appropriate audecXxxx() method// based on the returned value of 'state'.//// In practice, the above structure may be too loose to fit well within existing// architectures. Certain assumptions can be made safely:// - in callbackless (normal) mode, audecInit() always set 'state' to audecStateInput// (except on error it sets 'state' to audecStateDone). It is conceivable that// a future version of the decoder or bitstream might require the first call to// be audecDecode() instead of audecInput(), in which case audecInit() would set// 'state' to audecStateDecode. However, no such plans currently exist. It is// difficult to imagine a situation where audecInit() would set 'state' to// audecStatePCM, but the flexibility exists in the interface for completeness.// - in callback mode, audecInit() always sets 'state' to audecStateDecode (except// on error)// - audecStateInput() never sets 'state' to audecStateGetPCM.// - the only time audecStateInput() sets 'state' to audecStateInput is in certain// erratic situations where the input buffer passed to audecInput() is for some// reason deemed useless (e.g., a buffer with fNewPacket set to FALSE in SPDIF// mode when a new frame is expected because the previous frame has completed).// - the only time audecGetPCM() sets 'state' to audecStateGetPCM is when the// output buffer passed to audecGetPCM() is too small to receive the number of// available output samples returned by audecDecode() (cSamplesReady above).// An assumption that is markedly NOT valid is that audecGetPCM() always sets// 'state' to audecStateInput. In fact, audecGetPCM() routinely sets 'state' to// audecStateDecode. While cycling between Decode and GetPCM might seem redundant// (i.e., "why not decode all of the available input so that the next thing after// GetPCM is audecInput"), the find granularity of audecDecode() operations allows// output to be available sooner than it would otherwise be, and the fine processing // granularity makes scheduling easier on systems/devices that do not have threads.//// Any of the audecXxxx() methods set 'state' to audecStateDone when an unrecoverable// error occurs. audecInit() or audecReset() must be called to clear audecStateDone.//// audecGetPCM() sets 'state' to audecStateInput (callbackless/normal mode) or// audecStateDecode (callback mode) if fNoMoreInput was set to TRUE on// the most recent input buffer, and that input buffer has been fully decoded and// its output fetched.//// audecReset() does not take an audecState argument. The state is implicitly// audecStateInput (callbackless/normal mode) or audecStateDecode (callback mode)// after audecReset() returns (assuming that the most recent audecInit() call succeeded).//// The decoder remembers what it set the state to during the most recent call,// and each of { audecInput(), audecDecode(), audecGetPCM() } checks the stored// state. These functions assert and return an error if called unexpectedly.//// audecDecode() / audecGetPCM() will never set 'state' to audecStateInput (and// audecState() should never be called) if a non-NULL value was passed for// pfnGetMoreData to audecInit().//typedef enum _audecState { audecStateDone = 0, audecStateInput, audecStateDecode, audecStateGetPCM} t_audecState;// If you use any of the structures below, please memset() the entire struct to 0 before setting its fields.// This will ensure reasonable default behavior if a new member is added but the calling code is not updated.typedef struct _audecInitParams { WMA_I32 iMemBufUsed; // [out] PFNGETMOREDATA pfnGetMoreData; // [in] set to NULL for normal (callbackless) mode void* dwUser; // [in] context for pfnGetMoreData (ignored if pfnGetMoreData==NULL) WMA_Bool fSPDIF; // [in] TRUE for SPDIF mode, FALSE for packetized (normal) mode} audecInitParams;typedef struct _audecInputParams { WMA_I32 cSkipBits; // SPDIF only - see above} audecInputParams;typedef struct _audecDecodeParams { WMA_I32 cbFrameBytesInLastBuffer; // [out] SPDIF only, obsolete - superseded by an SPDIF payload header field} audecDecodeParams;typedef struct _audecGetPCMParams { WMA_U32 dwReserved;} audecGetPCMParams;#ifdef __cplusplusextern "C" {#endif // __cplusplusvoid* audecNew (void *pMemBuf, // [in] (normally NULL) user-supplied memory for heapless environments const WMA_I32 iMemBufSize);void audecDelete (void* paudec);WMARESULT audecCheckInitParams(WMAFormat*, PCMFormat*, audecInitParams* pParams);WMARESULT audecInit (void* paudec, WMAFormat* pWMAFormat, PCMFormat* pPCMFormat, t_audecState *paudecState, audecInitParams* pParams);WMARESULT audecInitCompressionTool (void* pDecHandle, WMA_Bool fCompressionTool, char * pMetaFileDir);WMARESULT audecReset (void* paudec);WMARESULT audecInput (void* paudec, WMA_U8* pbIn, // [in] WMA_U32 cbIn, WMA_Bool fNewPacket, WMA_Bool fNoMoreInput, WMA_Bool fTime, WMA_I64 rtTime, t_audecState* paudecState, // [out] audecInputParams* pParams // [in] );WMARESULT audecDecode (void* paudec, WMA_U32* pcSamplesReady, // [out] - how much is availble from GetPCM() t_audecState* paudecState, // [out] audecDecodeParams* pParams // [out] );WMARESULT audecGetPCM (void* paudec, WMA_U32 cSamplesRequested, // up to *pcSamplesReady (from audecDecode()) WMA_U32 *pcSamplesReturned, // [out] redundant with *pcbDstUsed below WMA_U8* pbDst, WMA_U32 cbDstLength, // ~ redundant with cSamplesRequested WMA_U32* pcbDstUsed, // [out] redundant with *pcSamplesReturned above WMA_I64* prtTime, // [out] time stamp (in 100ns) of 1st sample returned t_audecState *paudecState, // [out] audecGetPCMParams* pParams);/*WMARESULT audecSetPlayerInfo(void* pDecHandle, t_audecState *paudecState, WMAPlayerInfo *pPI, WMA_Bool fSetChDnMixMtx, WMA_Bool fSetDRCRefAndTarget);WMARESULT WMAPktParseDownmixCoeffToMatrix(WMA_I32 *rgiDownMix, // [out] - downmix matrix of size cDstChannel * cSrcChannel, can't be NULL WMA_I32 *rgiCoeff, // [in] - matrix parameters sent, can't be NULL WMA_I32 iNumCoeff, // [in] - number of parameters, can't be NULL WMA_I32 cNumInCh, // [in] - number of input channels WMA_I32 cNumOutCh, // [in] - number of output channels WMA_U32 dwInChMask, // [in] - input channel mask WMA_U32 dwOutChMask); // [in] - output channel mask*/#ifdef __cplusplus}#endif // __cplusplus#define WAVEFORMATEX2audecInitParams(a,b) { \}#endif//__WMADEC_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -