请教DirectShow高手:IID_IMPEG2PIDMap IID_IMpeg2Demultiplexer的问题

时间:2021-01-27 18:26:20
我使用DirectShow制作一个播放器(播放TS),链接出错,请高手看看。。
谢谢!!
////////////////////////create mpeg2 demultiplexer & set output pins///////////////////////////////
HRESULT CDXGraph::SetVideoAndAudioPIDs(LONG lNewVideoPID,LONG lNewAudioPID)
{
HRESULT hr=true;
AM_MEDIA_TYPE mt;
IBaseFilter *pSplit=NULL;
    GUID CLSID_MPEG2Demultiplexer = { 0xAFB6C280, 0x2C41, 0x11D3, { 0x8A, 0x60, 0x00, 0x00, 0xF8, 0x1E, 0x0E, 0x4A}};

hr = CoCreateInstance(CLSID_MPEG2Demultiplexer, NULL,CLSCTX_INPROC,IID_IBaseFilter,(void**)&pSplit);
hr = mGraph->AddFilter(pSplit, L"MPEG-2 Demux Filter");
// Query the demux filter for IMpeg2Demultiplexer.
IMpeg2Demultiplexer *pDemux = NULL;
hr = pSplit->QueryInterface(IID_IMpeg2Demultiplexer, (void**)&pDemux);
if (SUCCEEDED(hr))
{
//DWORD sequenceHeader[3];
//DWORD temp;
// Define the video media type.
ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
mt.formattype = FORMAT_MPEG2Video;

// Create a new output pin.
IPin *pPin;
hr = pDemux->CreateOutputPin(&mt, L"Video Pin", &pPin);
if (SUCCEEDED(hr))
{
// Map the PID.
IMPEG2PIDMap *pPidMap = NULL; //#include <Bdaiface.h>
hr = pPin->QueryInterface(IID_IMPEG2PIDMap, (void**)&pPidMap);
if (SUCCEEDED(hr))
{
ULONG Pid = lNewVideoPID; // Map any desired PIDs.
ULONG cPid = 1;
hr = pPidMap->MapPID(cPid, &Pid, MEDIA_ELEMENTARY_STREAM);
pPidMap->Release();
}
pPin->Release();
}

// Define the Audio media type.
ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
mt.majortype = MEDIATYPE_Audio;
mt.subtype = MEDIASUBTYPE_MPEG2_AUDIO;//MEDIASUBTYPE_MPEG1Payload
mt.formattype = FORMAT_WaveFormatEx;
if (SUCCEEDED(hr))
{
// Map the PID.
IMPEG2PIDMap *pPidMap = NULL;
hr = pPin->QueryInterface(IID_IMPEG2PIDMap, (void**)&pPidMap);
if (SUCCEEDED(hr))
{
ULONG Pid = lNewAudioPID; // Map any desired PIDs. ULONG Pid[] = 0x1022;
ULONG cPid = 1;
hr = pPidMap->MapPID(cPid, &Pid, MEDIA_ELEMENTARY_STREAM);
pPidMap->Release();
}
pPin->Release();
}
pDemux->Release();
}
return hr;
}


出错:
Compiling...
DXGraph.cpp
Linking...
DXGraph.obj : error LNK2001: unresolved external symbol _IID_IMPEG2PIDMap
DXGraph.obj : error LNK2001: unresolved external symbol _IID_IMpeg2Demultiplexer
Release/MyPlayer.exe : fatal error LNK1120: 2 unresolved externals
执行 link.exe 时出错.

MyPlayer.exe - 1 error(s), 0 warning(s)

1 个解决方案

#1


兄台有没有做过DirectShow下捕捉视频采集卡的视频进行去隔行呢?请教下,发个算法学习下。zqn155@163.com急需啊。。。

#1


兄台有没有做过DirectShow下捕捉视频采集卡的视频进行去隔行呢?请教下,发个算法学习下。zqn155@163.com急需啊。。。