⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omxacaac_unpackadifheader.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** *  * File Name:  omxACAAC_UnpackADIFHeader.c * OpenMAX DL: v1.0.2 * Revision:   10586 * Date:       Wednesday, March 5, 2008 *  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. *  *  * * Description: * This file contains module for parsing ADIF header information from AAC bitstream * */#include "omxtypes.h"#include "armOMX.h"#include "omxAC.h"#include "armCOMM.h"#include "armCOMM_Bitstream.h"/** * Function:  omxACAAC_UnpackADIFHeader   (3.2.3.1.1) * * Description: * Unpacks the AAC ADIF format header and all program configuration elements  * from the input bit stream and copies the contents into the ADIF header and  * program configuration element data structures.  * * Reference: [ISO14496-3], Table 1.A.2  * * Input Arguments: *    *   ppBitStream - double pointer to the current byte before the ADIF header  *   prgCfgEltMax - the maximum allowed number of program configuration  *            elements; an error is returned by the function if the value of  *            the parameter numPrgCfgElt encountered in the input stream is  *            larger than prgCfgEltMax  *   pADIFHeader - pointer to an uninitialized OMXACCADIFHeader structure  *   pPrgCfgElt - pointer to an array of uninitialized OMXAACPrgCfgElt  *            structures.  There should be sufficient space in the buffer to  *            contain prgCfgEltMax elements.  * * Output Arguments: *    *   ppBitStream - double pointer to the current byte after the ADIF header  *   pADIFHeader - pointer to the updated OMXACCADIFHeader structure.  *            UnpackADIFHeader updates all OMXAACADIFHeader members to reflect  *            the contents of the ADIF header in the input stream, with the  *            following limitations:  i) the member pCopyId is updated only if  *            copyIdPres==1; ii) Elements 0, 1,  , numPrgCfgElt-1 of the  *            pADIFFullness array are updated only if bistreamType==0. The  *            other elements of ADIF fullness array are not modified.  *   pPrgCfgElt - pointer to the updated array of OMXAACPrgCfgElt structures.  *            All program configuration element structures (i.e., elements 0,  *            1,  , (pADIFHeader->numPrgCfgElt)-1 of the array pPrgCfgElt) are  *            updated by the function to reflect the contents of the ADIF  *            header in the input stream, with the following limitations for  *            each PCE structure:  i) the member monoMixdownEltNum is updated  *            only if monoMixdownPres==1;  ii) the member stereoMixdownEltNum  *            is updated only if stereoMixdownPres==1; iii) the members  *            matrixMixdownIdx and pseudoSourroundEnable are updated only if  *            matrixMixdownIdxPres==1; iv) Only elements 0, 1,  ,  *            numFrontElt-1 of the pFrontIsCpe and pFrontTagSel arrays are  *            updated; v) Only elements 0, 1,  , numSideElt-1 of the  *            pSideIsCpe and pSideTagSel arrays are updated; vi) Only elements  *            0, 1,  , numBackElt-1 of the pBackIsCpe and pBackTagSel arrays  *            are updated; vii) Only elements 0, 1,  , numLfeElt-1 of the  *            pLfeTagSel array are updated; viii) Only elements 0, 1,  ,  *            numDataElt-1 of the pDataTagSel array are updated; ix) Only  *            elements 0, 1,  , numValidCcElt-1 of the pCceIsIndSw and  *            pCceTagSel arrays are updated; x) Only elements 0, 1,  ,  *            numComBytes-1 of the pComFieldData array are updated.  * * Return Value: *     *    OMX_Sts_NoErr - no error  *    OMX_Sts_BadArgErr - bad arguments  *    -    At least one of the following pointers is NULL:  *           - ppBitStream,  *           - pADIFHeader,  *           - pPrgCfgElt  *           - *ppBitStream *    -    prgCfgEltMax exceeds [1, 16]  *    OMX_StsACAAC_PrgNumErr - the decoded pADIFHeader->numPrgCfgElt >  *              prgCfgEltMax.   * * Note: pADIFHeader->numPrgCfgElt is the number directly unpacked  * from bit stream plus 1. prgCfgEltMax is the number of the program  * configuration elements that the user wants to support. The valid  * range is [1, 16]  * */OMXResult omxACAAC_UnpackADIFHeader (     const OMX_U8 **ppBitStream,     OMXAACADIFHeader *pADIFHeader,     OMXAACPrgCfgElt *pPrgCfgElt,     OMX_INT prgCfgEltMax ){    OMX_INT   i,Offset = 0;    OMXResult errorCode;    /* Argument Check */            armRetArgErrIf(ppBitStream  == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf(pADIFHeader  == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf(pPrgCfgElt   == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf( (prgCfgEltMax > OMX_AAC_ELT_NUM) || (prgCfgEltMax < 1), OMX_Sts_BadArgErr);            /* Processing */    pADIFHeader->ADIFId     = (OMX_INT)armGetBits(ppBitStream,&Offset,32);    pADIFHeader->copyIdPres = (OMX_INT)armGetBits(ppBitStream,&Offset,1);        if(pADIFHeader->copyIdPres == 1)    {        for(i = 0; i < 9 ; i++)        {            pADIFHeader->pCopyId[i] = (OMX_INT)armGetBits(ppBitStream,&Offset,8);        }    }    pADIFHeader->originalCopy   = (OMX_INT)armGetBits(ppBitStream,&Offset,1);    pADIFHeader->home           = (OMX_INT)armGetBits(ppBitStream,&Offset,1);    pADIFHeader->bitstreamType  = (OMX_INT)armGetBits(ppBitStream,&Offset,1);    pADIFHeader->bitRate        = (OMX_INT)armGetBits(ppBitStream,&Offset,23);    pADIFHeader->numPrgCfgElt   = (OMX_INT)armGetBits(ppBitStream,&Offset,4) + 1;        armRetDataErrIf( pADIFHeader->numPrgCfgElt > prgCfgEltMax, OMX_StsACAAC_PrgNumErr );    for(i = 0 ;i < pADIFHeader->numPrgCfgElt ; i++ )        {        if(pADIFHeader->bitstreamType == 0)            {            pADIFHeader->pADIFBufFullness[i] = (OMX_INT)armGetBits(ppBitStream,&Offset,20);        }                errorCode = omxACAAC_DecodePrgCfgElt(ppBitStream,&Offset,&pPrgCfgElt[i]);                armRetDataErrIf( errorCode != OMX_Sts_NoErr, errorCode );    }        return OMX_Sts_NoErr;}/* End of File */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -