TCC89播放代码与 LOG 对应

阅读与测试 Telechips 平台下音频播放 Filter,同时对比 WinCE 下标准的 Overlay 音频播放过程。了解音频播放过程,记录如下:

(1) CheckCoCreateInstance(hr, CLSID_FilterGraph, IID_IGraphBuilder, (void **)&mpGraph, TEXT("CLSID_FilterGraph fail")); 
  原型: BOOL CFilterControl::CheckCoCreateInstance(HRESULT &hr, REFCLSID rclsid, REFIID riid, LPVOID* ppv, LPCTSTR pszErrorMessage)
  调用 CoCreateInstance 的代码 : hr = ::CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, riid, ppv);
加载模块: quartz.dll
加载模块: mmtimer.dll
加载模块: waveapic.dll

(2) hr = CoCreateInstance((REFCLSID)CLSID_AudioRender, NULL, CLSCTX_INPROC, (REFIID)IID_IBaseFilter, (void **)&m_pAudioRenderFilter);
    hr = mpGraph->AddFilter(m_pAudioRenderFilter,L"Audio Renderer");
    
    hr = mpGraph->AddFilter(m_pAudioOutputControlFilter,L"TCC Audio Output Control Filter");
加载模块: TCCAudioOutputControlFilter.dll
对应实现: TWS893x_200\Filters\TCCAudioOutputControlFilter\TCCAudioOutputControlFilter.cpp
  CFactoryTemplate g_Templates[] = 
  {
    {
      L"TCC Audio Output Control Filter",
      &CLSID_TCCAudioOutputControlFilter,
      CAudioOutputControlFilter::CreateInstance,      // Create a new instance of this class
      NULL,
      &sudTCCAudioOutputControlFilter
    },
  };

(3) hr = CoCreateInstance((REFCLSID)CLSID_TCCDEQ, NULL, CLSCTX_INPROC, (REFIID)IID_IBaseFilter, (void **)&m_pDEQFilter);
    // DEQ Filter Add
    if(SUCCEEDED(hr))
      hr = mpGraph->AddFilter(m_pDEQFilter,L"TCC DEQ Filter");
加载模块: TCCDEQFilter.dll

(4) hr = mpGraph->RenderFile(FileName,NULL);
加载模块: TCCCDKAudioDecFilter.dll
加载模块: TCCCDKDemuxFilter.dll
[ CDK  DEMUX ] Audio Demuxer is MP3
========================================================
[ CDK  DEMUX ]Start Time        : 1999-10-29 07:21:08

[ CDK  DEMUX ]Demux Type        : AUDIO(8)
[ CDK  DEMUX ]Video Width       : 0
[ CDK  DEMUX ]Video Height      : 0
[ CDK  DEMUX ]Video Frame Rate  : 0.00
[ CDK  DEMUX ]Video BitRate     : Unknown
[ CDK  DEMUX ]Extra Data Length : 0
[ CDK  DEMUX ]Seekable          : Seekable
[ CDK  DEMUX ]AspectRatio       : 4 x 3
--------------------------------------------------------
[ CDK  DEMUX ]Audio Track Num    : 1
 [0]Audio nFormatId   : MP3(0x55)
 [0]Avg Bytes Per Sec : 16000
 [0]Bits Per Sample   : 16
 [0]Block Align       : 0
 [0]nChannels         : 2
 [0]SamplePerSec      : 44100
 [0]nExtraDataLength  : 0
--------------------------------------------------------
[ CDK  DEMUX ]Total Subtitle Num   : 0
[ CDK  DEMUX ]Current Subtitle Num : 0
========================================================
[ CDK  AUDIO ][CCDKAudioDecFilter::CheckInputType,1180] AUDIO_ID_MP3 
--------------------------------------------------------
[ CDK  DEMUX ]Audio Stream ID                : Audio0
[ CDK  DEMUX ]Audio Ouptut Buffer Num        : 128
[ CDK  DEMUX ]Audio Ouptut 1 Buffer Size     : 32[Kbytes]
[ CDK  DEMUX ]Audio Ouptut Buffer total Size : 4[Mbytes]
--------------------------------------------------------
--------------------------------------------------------
[ CDK  AUDIO ]Audio Ouptut Buffer Num        : 16
[ CDK  AUDIO ]Audio Ouptut 1 Buffer Size     : 512[Kbytes]
[ CDK  AUDIO ]Audio Ouptut Buffer total Size : 8[Mbytes]
--------------------------------------------------------
--------------------------------------------------------
[ CDK  AUDIO ]Audio Ouptut Buffer Num        : 16
[ CDK  AUDIO ]Audio Ouptut 1 Buffer Size     : 512[Kbytes]
[ CDK  AUDIO ]Audio Ouptut Buffer total Size : 8[Mbytes]
--------------------------------------------------------

(5) HRESULT hr = mpGraph->QueryInterface(IID_IMediaControl, (void **)&p_mc);
   if (hr == S_OK)
   {
    hr = p_mc->Run();
    mIsRunning = TRUE;
    if (FAILED(hr))
      printf("Fail : RunGraph(ret=0x%x)\r\n", hr);    // Leo 失败后 mIsRunning 的值?
    SAFE_RELEASE(p_mc);
   }
[ CDK  DEMUX ]CDK Audio DMX Seek Time : 0
========================================================
[ CDK  DEMUX ]Seek Position : 0(00:00:00)
[ CDK  DEMUX ]Real Position : 0(00:00:00)
[ CDK  DEMUX ]Seek duration : 3[ms]
========================================================



+  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  
+  +  微软标准 DirectShow 播放音频
IGraphBuilder *m_pGB;
IMediaControl *m_pMC;
IMediaEventEx *m_pME;
IBasicAudio   *m_pBA;
IMediaSeeking *m_pMS;

// Initialize COM 
if(CoInitializeEx(NULL,COINIT_MULTITHREADED) != S_OK)
{
  goto END;
}

// Get the interface for DirectShow's GraphBuilder
if(CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(void **)&m_pGB) != S_OK)
{
  goto END;
}

// Have the graph construct its the appropriate graph automatically
if(m_pGB->RenderFile(m_szFileName, NULL) != NOERROR)
{
  goto END;
}

// QueryInterface for DirectShow interfaces
if(m_pGB->QueryInterface(IID_IMediaControl, (void **)&m_pMC) != NOERROR)
{
  goto END;
}
if(m_pGB->QueryInterface(IID_IMediaEventEx, (void **)&m_pME) != NOERROR)
{
  goto END;
}
if(m_pGB->QueryInterface(IID_IMediaSeeking, (void **)&m_pMS) != NOERROR)
{
  goto END;
}

// Query for audio interfaces, which may not be relevant for video-only files
if(m_pGB->QueryInterface(IID_IBasicAudio, (void **)&m_pBA) != NOERROR)
{
 goto END;
}

你可能感兴趣的:(TCC89播放代码与 LOG 对应)