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

📄 maioggdec.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 3 页
字号:
  if (((uiBufFlags&MAICOMPBUF_FLAG_EOS)!=0) && pPInfo->m_iLastFrame) /* EOS not yet sent downstream */  {    /* Try to get last buffers */    while ((out_size = ov_read(&pPInfo->vf, pPInfo->m_pAudioOutBuf, OPTIMAL_OGG_OUTBUFFER_SIZE, &current_section)) > 0)    {      BufferInfo.uiDataSize = out_size;      BufferInfo.pBuffer = pPInfo->m_pAudioOutBuf;      DPRINTF((M_TEXT("LastFrame OGGDEC: audoggdecode() OutputPutBuf(%d:%d %p)\n"), out_size, pPInfo->m_uiOutcount, BufferInfo.pBuffer));      pPInfo->m_uiOutcount++;      if (MAICompBase_OutputPutBuf(hComp, 0, &BufferInfo) != MAI_STATUS_OK)      {        APIPRINTF((M_TEXT("OGGDEC: _processbuffer() MAICompBase_OutputPutBuf failed at last buffers, pPInfo->m_uiOutcount %d\n"), pPInfo->m_uiOutcount));        break;      }    }    memset(pPInfo->m_pAudioOutBuf, 0, OPTIMAL_OGG_OUTBUFFER_SIZE);    BufferInfo.uiDataSize = OPTIMAL_OGG_OUTBUFFER_SIZE;    APIPRINTF((M_TEXT("OGGDEC: _processbuffer() pass EOS, out_size %d, %d\n"), out_size, pPInfo->m_uiOutcount));    BufferInfo.dwFlags |= MAICOMPBUF_FLAG_EOS;    BufferInfo.pBuffer = pPInfo->m_pAudioOutBuf;    if (MAICompBase_OutputPutBuf(hComp, 0, &BufferInfo) != MAI_STATUS_OK)    {      ERRORPRINTF((M_TEXT("OGGDEC: _processbuffer() MAICompBase_OutputPutBuf failed trying to write EOS, pPInfo->m_uiOutcount %d\n"), pPInfo->m_uiOutcount));    }    BufferInfo.dwFlags &= ~MAICOMPBUF_FLAG_EOS; /* clear EOS flag */  }  if (pPInfo->m_iLastFrame)  {    close_ogg(pPInfo);    APIPRINTF((M_TEXT("OGGDEC: _processbuffer() LastFrame, close_ogg\n")));  }    APIPRINTF((M_TEXT("OGGDEC: _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("OGGDEC: MAICompStart() enter\n")));  _startprocessing(hComp);  eStatus=MAICompBase_StartStreaming(hComp, MAICompBase_ProcessorThread, 0);  APIPRINTF((M_TEXT("OGGDEC: 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("OGGDEC: 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("OGGDEC: 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)  {    /* handle component specific Commands here */    case MAI_CMD_EMPTY:      APIPRINTF((M_TEXT("OGGDEC: MAICompSendCommand(CMD_EMPTY)\n")));      /* Clear out the left-over buffers. */      close_dump_audio();      close_dump_compressed_audio();      if (pPInfo->m_uiAudioInbufSize > 0)        ov_set_discon(pPInfo->vi);      pPInfo->m_uiAudioInbufSize = 0;      break;  }  APIPRINTF((M_TEXT("OGGDEC: 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){  MAICompHandleInfo_t *pCompInfo=HCOMP_TO_HANDLEINFO(hComp);  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_OGG;      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 */      {        /* fill in Audio MediaType specific fields */        pAudioInfo->uiFlags = MAI_AUDIOMTFLAG_FORMATKNOWN;         pAudioInfo->uiBitrate = ov_bitrate(&pPInfo->vf, pPInfo->vf.links-1);        pAudioInfo->uiModeFlags = 0; /* init to no mode flags set */        pAudioInfo->uiSamplesPerSec = pPInfo->vi->rate;        pAudioInfo->uiBitsPerSample = 16;        // Does not work because not seekable: pAudioInfo->uiDuration = (unsigned int)ov_time_total(&pPInfo->vf, pPInfo->vf.links-1);        pAudioInfo->uiChannels = pPInfo->vi->channels;        pAudioInfo->uiFramesize = 4096;      }      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;         pAudioInfo->uiModeFlags = 0; /* init to no mode flags set */        pAudioInfo->uiSamplesPerSec = pPInfo->vi->rate;        pAudioInfo->uiBitsPerSample = 16;        pAudioInfo->uiChannels = pPInfo->vi->channels;        sprintf(pCompInfo->Info.pszDesc, "OggVorbis %s", ov_comment(&pPInfo->vf, - 1)->vendor);        pAudioInfo->uiMaxBufSize = 4096;      }    }  }  return eStatus;}/********** Public Component interfaces - REQUIRED **********/#define _COMPCOUNT    1  /* just one component implemented here */static MAICompHandleInfo_t _CompTemplate[_COMPCOUNT] ={  { /* CompInfo #1 - MPEG 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, 0x1b),      /* _pszName */ "OGGDEC", /* _pszDesc */ "OggVorbis 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 + -