#ifndef _DEC_OP_CIRC_BUF_H_ #define _DEC_OP_CIRC_BUF_H_ #include #include "paftyp.h" #define PAF_DECOP_CB_SOK ( 0 ) // ok #define PAF_DECOP_CB_INIT_INV_SOURCE_SEL ( -1 ) // error: invalid source selection on init #define PAF_DECOP_CB_WRITE_OVERFLOW ( -2 ) // error: write overflow #define PAF_DECOP_CB_READ_UNDERFLOW ( -3 ) // error: read underflow #define PAF_DECOP_CB_READ_INVSTATE ( -4 ) // error: circular buffer invalid state on read #define PAF_DECOP_CB_MAX_NUM_AF ( 4 ) // decoder output circular buffer maximum number audio frames #define PAF_DECOP_CB_MAX_NUM_PCM_CH ( 16 ) // decoder output circular buffer maximum number audio PCM channels #define PAF_DECOP_CB_MAX_NUM_PCM_FRAMES ( 2 ) // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp. #define PAF_DECOP_CB_MAX_PCM_FRAME_LEN ( 6*256 ) // decoder output circular buffer maximum PCM frame length #define PAF_DECOP_CB_PCM_BUF_SZ ( PAF_DECOP_CB_MAX_NUM_PCM_CH * PAF_DECOP_CB_MAX_NUM_PCM_FRAMES * PAF_DECOP_CB_MAX_PCM_FRAME_LEN ) // Decoder output circular buffer typedef struct PAF_DecodeOpCircBuf { PAF_AudioFrame *afCb; // audio frame CB PAF_AudioData *pcmBuf; // PCM buffer, contains PCM data associated with audio frames Int8 *metaBuf; // metafdata buffer, contains metadata associated with audio frames //QIN Int8 afRdIdx; // audio frame CB read index Int8 afWrtIdx; // audio frame CB write index Int16 pcmRdIdx; // pcm buffer read index Int8 numAfCb; // current number frames in CB Int8 maxNumAfCb; // maximum number of audio frames in CB Int16 decOpFrameLen; // selected decoder output frame length (input transaction size) Int16 strFrameLen; // stream frame length (output transaction size) Int8 writerActiveFlag; // flag indicates whether CB writer is active Int8 readerActiveFlag; // flag indicates whether CB reader is active Int8 emptyFlag; // flag indicates whether reader should empty (drain) remaining frames in CB //Int cbWriteAfInit; // indicates whether CB has been initialized for AF writes } PAF_DecodeOpCircBuf; // Start writes to circular buffer Int cbWriteStart( PAF_DecodeOpCircBuf *pCb // decoder output circular buffer ); // Stop writes to circular buffer Int cbWriteStop( PAF_DecodeOpCircBuf *pCb // decoder output circular buffer ); // Start reads from circular buffer Int cbReadStart( PAF_DecodeOpCircBuf *pCb // decoder output circular buffer ); // Stop reads from circular buffer Int cbReadStop( PAF_DecodeOpCircBuf *pCb // decoder output circular buffer ); // Read audio frame from circular buffer Int cbReadAf( PAF_DecodeOpCircBuf *pCb, // decoder output circular buffer PAF_AudioFrame *pAfRd // audio frame into which to read ); // Write audio frame to circular buffer Int cbWriteAf( PAF_DecodeOpCircBuf *pCb, // decoder output circular buffer PAF_AudioFrame *pAfWrt // audio frame from which to write ); // Get next audio frame to write in circular buffer Int cbGetNextWriteAf( PAF_DecodeOpCircBuf *pCb, // decoder output circular buffer PAF_AudioFrame **ppAfWrt // audio frame next to be written ); // Output log of circular buffer control variables (debug) Int cbLog( PAF_DecodeOpCircBuf *pCb, Int8 fullLog ); // restore read/write flags of the circular buffer. - QIN Int cbReadWriteRestore( PAF_DecodeOpCircBuf *pCb // decoder output circular buffer ); #endif /* _DEC_OP_CIRC_BUF_H_ */