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

📄 maipcmdec.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 3 页
字号:
        }        if ((uiBufFlags&MAICOMPBUF_FLAG_EOS)!=0 && insize>=len) /* last buffer to output, check for EOS */        {          APIPRINTF((M_TEXT("PCMDEC: _processbuffer() pass EOS\n")));          BufferInfo.dwFlags|=MAICOMPBUF_FLAG_EOS;          uiBufFlags&=~MAICOMPBUF_FLAG_EOS; /* clear EOS flag, report only once for this buffer */        }        BufferInfo.dwFlags = 0;        BufferInfo.pBuffer = (unsigned char *)pPInfo->m_pAudioOutBuf;        BufferInfo.uiDataSize = out_size;        APIPRINTF((M_TEXT("PCMDEC: _processbuffer() MAICompBase_OutputPutBuf(%d)\n"), out_size));        MAICompBase_OutputPutBuf(hComp, 0, &BufferInfo);        output_sample_count += out_size;      }    }    if (len > insize)      len = insize; /* safety, should never happen */    insize -= len;    inbuf_ptr += len;    pPInfo->m_uiProcessLoops++;  }  if ((uiBufFlags&MAICOMPBUF_FLAG_EOS)!=0) /* EOS not yet sent downstream */  {    BufferInfo.dwFlags = MAICOMPBUF_FLAG_EOS;    APIPRINTF((M_TEXT("PCMDEC: _processbuffer() pass EOS\n")));    BufferInfo.pBuffer = NULL;    BufferInfo.uiDataSize = 0;    eStatus=MAICompBase_OutputPutBuf(hComp, 0, &BufferInfo);    uiBufFlags&=~MAICOMPBUF_FLAG_EOS; /* clear EOS flag, report only once for this buffer */  }  if (last_frame)  {    /*  HWG051030 - Don't close since we may still receive Seek's into same stream.         Processbuffer will send NEWFORMAT if starting new stream.      APIPRINTF((M_TEXT("PCMDEC: _processbuffer() close_pcm()\n")));      close_pcm(pPInfo);      APIPRINTF((M_TEXT("PCMDEC: _processbuffer() close_pcm() done\n")));      */  }  else  {    pPInfo->m_LeftOverInput = (insize>0)?insize:0;    if (pPInfo->m_LeftOverInput)    {      if (pPInfo->m_LeftOverInput <= PCM_BUF_PAD)        memcpy(pPInfo->m_pucLeftOver, inbuf_ptr, pPInfo->m_LeftOverInput);      else        ERRORPRINTF((M_TEXT("PCMDEC: _processbuffer %x > %x\n"), pPInfo->m_LeftOverInput, PCM_BUF_PAD));    }  }  APIPRINTF((M_TEXT("PCMDEC: _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("PCMDEC: MAICompStart() enter\n")));  _startprocessing(hComp);  eStatus=MAICompBase_StartStreaming(hComp, MAICompBase_ProcessorThread, 0);  APIPRINTF((M_TEXT("PCMDEC: 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("PCMDEC: 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("PCMDEC: 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("PCMDEC: MAICompSendCommand(CMD_EMPTY)\n")));       /* need to flush out data in codec */       pPInfo->m_LeftOverInput = 0;     }     break;  }  APIPRINTF((M_TEXT("PCMDEC: 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_PCM;      pAudioInfo->MediaTypeInfo.uiFlags=0; /* init to no flags set */      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->uiSamplesPerSec = wavheader.iSamplesPerSec;        pAudioInfo->uiBitsPerSample = wavheader.iBitsPerSample;        pAudioInfo->uiChannels = wavheader.iChannels;        pAudioInfo->uiBitrate = wavheader.iBitrate;        pAudioInfo->uiFramesize = wavheader.iFramesize;        pAudioInfo->uiDuration = wavheader.iDuration;        pAudioInfo->uiEmphasis = wavheader.iEmphasis;        pAudioInfo->uiLayer = wavheader.iLayer;      }      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->ci.sampling_rate;        pAudioInfo->uiBitsPerSample = 16;        pAudioInfo->uiChannels = pPInfo->ci.channels;        pAudioInfo->uiMaxBufSize = MAX_PCM_OUTBUF_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 - WAV 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, 0x19),      /* _pszName */ "PCMDEC", /* _pszDesc */ "WAV/AIFF 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 + -