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

📄 maiaacdec.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 3 页
字号:
    MAICompBase_OutputPutBuf(hComp, 0, &BufferInfo);  }  if (last_frame)  {    pPInfo->m_uiProcessLoops = 0;    pPInfo->m_uiStreamPosition = 0;    pPInfo->m_uiBufPadSize = uiPrevBufPadSize;    /* flush out input data in codec */    pPInfo->m_LeftOverInput = 0;    /* End of stream, so go to IDLE state.  Next piece of data received should switch back to PLAYING state */    if (MAICompBase_IsState(hComp, MAI_RUNSTATE_PAUSING|MAI_RUNSTATE_PAUSED|MAI_RUNSTATE_STARTING|MAI_RUNSTATE_PLAYING))      MAICompBase_ChangeState(hComp, MAI_RUNSTATE_IDLE);  }  else if (pPInfo->m_uiAACtype != AAC_TYPE_RAW_FROM_DEMUX)  {    pPInfo->m_LeftOverInput = (insize > 0) ? insize : 0;    if (pPInfo->m_LeftOverInput)    {      if (pPInfo->m_LeftOverInput <= MP4_BUF_PAD)        memcpy(pPInfo->m_pucLeftOver, inbuf_ptr, pPInfo->m_LeftOverInput);      else        ERRORPRINTF((M_TEXT("AACDEC: _processbuffer %x > %x\n"), pPInfo->m_LeftOverInput, MP4_BUF_PAD));    }  }  DPRINTF((M_TEXT("AACDEC: processbuffer() exit\n")));  return eStatus;}static MAIStatus_e MAICompInitInput(MAICompHandle_t hComp, unsigned int uiPinID,                                   pfMAICompGetBufferCB_t *ppfInputGetBuffer,                                   pfMAICompPutBufferCB_t *ppfInputPutBuffer){  MAIStatus_e  eStatus;  eStatus=MAICompBase_InitInput(hComp, uiPinID, ppfInputGetBuffer, ppfInputPutBuffer, DEFAULT_INBUFSIZE, DEFAULT_INBUFCOUNT);  return eStatus;}static MAIStatus_e MAICompInitOutput(MAICompHandle_t hComp, unsigned int uiPinID,                                   pfMAICompGetBufferCB_t pfOutputGetBuf, pfMAICompPutBufferCB_t pfOutputPutBuf,                                   MAICompHandle_t hBufferOwnerComp){  return MAICompBase_InitOutput(hComp, uiPinID, pfOutputGetBuf, pfOutputPutBuf, hBufferOwnerComp);}static MAIStatus_e MAICompStart(MAICompHandle_t hComp){  ProcessorInfo_t *pPInfo=(ProcessorInfo_t *)HCOMP_TO_USERINFO(hComp);  MAIStatus_e eStatus = MAI_STATUS_OK;  APIPRINTF((M_TEXT("AACDEC: MAICompStart() enter\n")));  _startprocessing(hComp);  eStatus=MAICompBase_StartStreaming(hComp, MAICompBase_ProcessorThread, 0);  APIPRINTF((M_TEXT("AACDEC: MAICompStart() done: status=0x%X\n"), eStatus) );  return eStatus;}static MAIStatus_e MAICompEnd(MAICompHandle_t hComp){  MAIStatus_e eStatus = MAI_STATUS_OK;  APIPRINTF((M_TEXT("AACDEC: MAICompEnd() enter\n")));  /* call base EndStreaming to close down any running threads */  eStatus=MAICompBase_EndStreaming(hComp, MAI_TIMEOUT_INFINITE);  /* now call our local endprocessing logic */  if (!MAICompBase_IsState(hComp, MAI_RUNSTATE_NONE))    eStatus=_endprocessing(hComp);  APIPRINTF((M_TEXT("AACDEC: MAICompEnd() done: status=0x%X\n"), eStatus));  return eStatus;}static MAIStatus_e MAICompSendCommand(MAICompHandle_t hComp, m_u32 uiCommand,                               m_u32 uiParam1, m_u32 uiParam2, m_u32 uiParam3,                               void *pUserInstance, MAITimeOut_t uiTimeOut){  ProcessorInfo_t *pPInfo=(ProcessorInfo_t *)HCOMP_TO_USERINFO(hComp);  MAIStatus_e eStatus = MAI_STATUS_OK;    switch (uiCommand)  {    case MAI_CMD_EMPTY:      APIPRINTF((M_TEXT("AACDEC: MAICompSendCommand(CMD_EMPTY)\n")));      /* flush out input data in codec */      pPInfo->m_LeftOverInput = 0;      if (pPInfo->m_uiAACtype != AAC_TYPE_RAW_FROM_DEMUX) /* chirp protection is done in the decoder for DEMUX types */        pPInfo->m_iDoNotOutputCounter = 8;      break;  }  APIPRINTF((M_TEXT("AACDEC: MAICompSendCommand(Cmd=%d,%d,%d,%d) Passing command to compbase\n"), uiCommand, uiParam1, uiParam2, uiParam3) );  eStatus=MAICompBase_SendCommand(hComp, uiCommand, uiParam1, uiParam2, uiParam3, pUserInstance, uiTimeOut);  return eStatus;}static MAIStatus_e MAICompGetParam(MAICompHandle_t hComp, unsigned int uiParam, void *pvParamData, unsigned int uiDataSize){  return MAICompBase_GetParam(hComp,uiParam,pvParamData,uiDataSize);}static MAIStatus_e MAICompSetParam(MAICompHandle_t hComp, unsigned int uiParam, void *pvParamData, unsigned int uiDataSize){  return MAICompBase_SetParam(hComp,uiParam,pvParamData,uiDataSize);}static MAIStatus_e MAICompGetMediaType(MAICompHandle_t hComp, MAICompDirection_e eDirection, unsigned int uiPinID, MAIMediaType_t *pMediaType){  ProcessorInfo_t *pPInfo=(ProcessorInfo_t *)HCOMP_TO_USERINFO(hComp);  MAIStatus_e eStatus = MAI_STATUS_UNSUPPORTED;  if (eDirection==MAICOMP_DIR_INPUT && uiPinID==0)  {    if (!pMediaType)      eStatus=MAI_STATUS_BADARG;    else    {      MAIMediaTypeAudio_t *pAudioInfo=(MAIMediaTypeAudio_t *)pMediaType;      /* clear the info structure */      memset(pAudioInfo, 0, sizeof(MAIMediaTypeAudio_t));      /* fill in Common MediaType fields */      pAudioInfo->MediaTypeInfo.uiSize=sizeof(MAIMediaTypeAudio_t);      pAudioInfo->MediaTypeInfo.eMType=MAI_MTYPE_AUDIO;      pAudioInfo->MediaTypeInfo.eMSubtype=MAI_MSUBTYPE_AAC;      pAudioInfo->MediaTypeInfo.uiFlags=0;      pAudioInfo->uiFlags = 0; /* init to no flags set */      if (pPInfo->m_uiProcessLoops) /* fill in audio format details if decoder is running */      {        MAICompHandleInfo_t *pCompInfo=HCOMP_TO_HANDLEINFO(hComp);        pAudioInfo->uiFlags = MAI_AUDIOMTFLAG_FORMATKNOWN; /* init to no flags set */        pAudioInfo->uiModeFlags = 0; /* init to no mode flags set */        pAudioInfo->uiSamplesPerSec = pPInfo->ci.sampling_rate;        pAudioInfo->uiBitsPerSample = pPInfo->ci.bits_per_sample;        pAudioInfo->uiChannels = pPInfo->ci.channels;        pAudioInfo->uiBitrate = xheader.iBitrate;        if (!xheader.iBitrate)          pAudioInfo->uiFlags |= MAI_AUDIOMTFLAG_VBR;        pAudioInfo->uiFramesize = xheader.iFramesize;        pAudioInfo->uiDuration = xheader.iDuration;        if (xheader.iDRM)          pAudioInfo->uiFlags |= MAI_AUDIOMTFLAG_DRM;        if (frameInfo.sbr | xheader.iSBR)          pAudioInfo->uiModeFlags |= MAI_AUDIOMODEFLAG_SBR;        pAudioInfo->uiEmphasis = xheader.iEmphasis;        pAudioInfo->uiLayer = frameInfo.header_type;        /* update codec name in Component info */        switch (frameInfo.header_type)        {          case 0:            strcpy(pCompInfo->Info.pszDesc, "FAAD2 AAC RAW");            break;          case ADTS:            sprintf(pCompInfo->Info.pszDesc, "FAAD2 AAC ADTS");            break;          case ADIF:            sprintf(pCompInfo->Info.pszDesc, "FAAD2 AAC ADIF\n");            break;        }        if (mp4file)          strcpy(pCompInfo->Info.pszDesc, "FAAD2 AAC Nero\n");      }      eStatus=MAI_STATUS_OK;    }  }  else if (eDirection==MAICOMP_DIR_OUTPUT && uiPinID==0)  {    if (!pMediaType)      eStatus=MAI_STATUS_BADARG;    else    {      MAIMediaTypeAudio_t *pAudioInfo=(MAIMediaTypeAudio_t *)pMediaType;      /* clear the info structure */      memset(pAudioInfo, 0, sizeof(MAIMediaTypeAudio_t));      /* fill in Common MediaType fields */      pAudioInfo->MediaTypeInfo.uiSize=sizeof(MAIMediaTypeAudio_t);      pAudioInfo->MediaTypeInfo.eMType=MAI_MTYPE_AUDIO;      pAudioInfo->MediaTypeInfo.eMSubtype=MAI_MSUBTYPE_PCM;      pAudioInfo->MediaTypeInfo.uiFlags=0;      pAudioInfo->uiFlags = 0; /* init to no flags set */      if (pPInfo->m_uiProcessLoops) /* fill in audio format details if decoder is running */      {        pAudioInfo->uiFlags = MAI_AUDIOMTFLAG_FORMATKNOWN; /* init to no flags set */        pAudioInfo->uiFlags = 0; /* init to no flags set */        pAudioInfo->uiModeFlags = 0; /* init to no mode flags set */        pAudioInfo->uiSamplesPerSec = pPInfo->ci.sampling_rate;        pAudioInfo->uiBitsPerSample = pPInfo->ci.bits_per_sample;        pAudioInfo->uiChannels = pPInfo->ci.channels;        pAudioInfo->uiMaxBufSize = pPInfo->ci.max_output_buffer_size;      }      eStatus=MAI_STATUS_OK;    }  }  return eStatus;}/********** Public Component interfaces - REQUIRED **********/#define _COMPCOUNT    1  /* just one component implemented here */static MAICompHandleInfo_t _CompTemplate[_COMPCOUNT] ={  { /* CompInfo #1 - AAC Audio Decoder */      DECLARE_MAICOMPINFO(      /* _eType */ MAICOMP_TYPE_DECODE|MAICOMP_TYPE_AUDIO,      /* _uiCompVer */ 0x0001,      /* _uiBuildVer */ BUILD_VERSION,      /* _GUID */ MAICOMP_GUID(0x00, 0x10, 0xef, 0x00, 0x00, 0x00, 0x00, 0x17),      /* _pszName */ "AACDEC", /* _pszDesc */ "AAC Audio Decoder",      /* _uiMaxInputs */ 1, /* _MaxOutputs */ 1,      /* _MaxInstances */ 1,      /* _uiFlags */ 0    ),    /* CompHandle fields */    (pfMAICompErrorCB_t)0,    /* pfMAICompErrorCB_t     pfErrorCB */    (pfMAICompProgressCB_t)0, /* pfMAICompProgressCB_t  pfProgressCB; */    MAICompInitInput,   /* pfMAICompInitInput_t   pfInitInput */    MAICompInitOutput,  /* pfMAICompInitOutput_t  pfInitOutput */    MAICompGetMediaType, /* pfMAICompGetMediaType_t pfGetMediaType */    MAICompGetParam,    /* pfMAICompGetParam_t    pfGetParam */    MAICompSetParam,    /* pfMAICompSetParam_t    pfSetParam */    MAICompStart,       /* pfMAICompStart_t       pfStart */    MAICompSendCommand, /* pfMAICompSendCommand_t pfSendCommand */    MAICompEnd,         /* pfMAICompEnd_t         pfEnd */    MAICompBase_SetErrorCB,   /* pfMAICompSetErrorCB_t  pfSetErrorCB */    MAICompBase_SetProgressCB,  /* pfMAICompSetProgressCB_t pfSetProgressCB */    MAICompBase_GetState,     /* pfMAICompGetState_t    pfGetState */    (pfMAICompSetStream_t)0, /* pfMAICompSetStream_t   pfSetStream */    (pfMAICompReserved_t)0,  /* pfMAICompRead_t        pfRead */    MAICompBase_ReadBuffer,  /* pfMAICompReadBuffer_t   pfReadBuffer */    MAICompBase_WriteBuffer,    (pfMAICompReserved_t)0,    (pfMAICompReserved_t)0,    (pfMAICompReserved_t)0,    (pfMAICompReserved_t)0,    (pfMAICompReserved_t)0  }};    /* MAICompLibInit - initialize the MAI component library */PUBLIC_EXTERN MAIStatus_e MAICompLibInit(){  return MAICompBase_LibInit(_CompTemplate, _COMPCOUNT);}/* MAICompLibRelease - release the MAI component library */PUBLIC_EXTERN MAIStatus_e MAICompLibRelease(){  return MAICompBase_LibRelease();}/* MAICompLibGetCount - return number of components implemented in this library */PUBLIC_EXTERN unsigned int MAICompLibGetCount(){  MAICompLibInit(); /* make sure lib has been initialized */  return MAICompBase_LibGetCount();}/* MAICompGetInfo - return info on a specific component */PUBLIC_EXTERN MAIStatus_e MAICompGetInfo(unsigned int uiCompIndex, MAICompInfo_t *pInfoOut){  MAICompLibInit(); /* make sure lib has been initialized */  return MAICompBase_CompGetInfo(uiCompIndex, pInfoOut);}/* MAICompCreate - create an instance of a specific component */PUBLIC_EXTERN MAIStatus_e MAICompCreate(unsigned char *pucGUID, MAICompHandle_t *phCompOut){  MAIStatus_e eStatus;  MAICompHandle_t hComp=M_HANDLE_INVALID;  MAICompLibInit(); /* make sure lib has been initialized */  eStatus=MAICompBase_CompCreate(pucGUID, sizeof(ProcessorInfo_t), &hComp);  if (eStatus==MAI_STATUS_OK)  {    /* init private component info */    ProcessorInfo_t *pPInfo=(ProcessorInfo_t *)HCOMP_TO_USERINFO(hComp);    /* return handle */    *phCompOut=(MAICompHandle_t)hComp;  }  return eStatus;}/* MAICompRelease - release an instance of a specific component */PUBLIC_EXTERN MAIStatus_e MAICompRelease(MAICompHandle_t hComp){  MAIStatus_e eStatus;  if (hComp!=M_HANDLE_INVALID)  {    ProcessorInfo_t *pPInfo=(ProcessorInfo_t *)HCOMP_TO_USERINFO(hComp);    /* release private component info */    /* call base release */    eStatus=MAICompBase_CompRelease(hComp);  }  else    eStatus=MAI_STATUS_BADHANDLE;  return eStatus;}

⌨️ 快捷键说明

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