本文整理汇总了C++中IBaseFilter::FindPin方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseFilter::FindPin方法的具体用法?C++ IBaseFilter::FindPin怎么用?C++ IBaseFilter::FindPin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseFilter
的用法示例。
在下文中一共展示了IBaseFilter::FindPin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
// Very basic setup of capture filter, we should do error checking
bool DsCaptureFilter::initialize()
{
IBaseFilter* sourceFilter = NULL;
IPin* sourcePin = NULL;
HRESULT hr = CoInitialize(0);
hr = CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC,IID_IGraphBuilder, (void **)&graph);
hr = graph->QueryInterface(IID_IMediaControl, (void **)&mediaControl);
//sampler = new Sampler(0, &hr);
IPin* renderPin = NULL;
hr = this->FindPin(L"In", &renderPin);
hr = graph->AddFilter((IBaseFilter*)this, L"Sampler");
if(strcmp(source, "cam") == 0) // Capture from camera
{
ICreateDevEnum* devs = NULL;
hr = CoCreateInstance (CLSID_SystemDeviceEnum, 0, CLSCTX_INPROC, IID_ICreateDevEnum, (void **) &devs);
IEnumMoniker* cams = NULL;
hr = devs?devs->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &cams, 0):0;
IMoniker* mon = NULL;
hr = cams?cams->Next (1, &mon, 0):0;
hr = mon?mon->BindToObject(0,0,IID_IBaseFilter, (void**)&sourceFilter):0;
hr = graph->AddFilter(sourceFilter, L"Capture Source");
}
else // Capture from AVI
{
WCHAR filename[256];
MultiByteToWideChar(0, 0, source, -1, filename, sizeof(filename));
hr = graph->AddSourceFilter(filename, L"File Source", &sourceFilter);
hr = sourceFilter?sourceFilter->FindPin(L"Output", &sourcePin):0;
hr = graph?graph->QueryInterface(IID_IMediaEvent, (void **)&mediaEvent):0;
hr = graph?graph->QueryInterface(IID_IMediaSeeking, (void **)&mediaSeek):0;
}
IEnumPins* pins = NULL;
hr = sourceFilter?sourceFilter->EnumPins(&pins):0;
hr = pins?pins->Next(1,&sourcePin, 0):0;
hr = graph->Connect(sourcePin, renderPin);
newFrameEvent = CreateEvent(0, FALSE, FALSE, "NewFrameEvent");
return true;
}
示例2: setVideoHWND
/*
* Class: sage_DShowMediaPlayer
* Method: setVideoHWND0
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_sage_DShowMediaPlayer_setVideoHWND0
(JNIEnv *env, jobject jo, jlong dataPtr, jlong vhwnd)
{
CPlayerData* playData = (CPlayerData*) dataPtr;
IGraphBuilder* pGraph = playData->GetGraph();
IVideoWindow* pVW = NULL;
HRESULT hr = pGraph->QueryInterface(IID_IVideoWindow, (void**)&pVW);
if (SUCCEEDED(hr))
{
slog((env, "DShowPlayer setVideoHWND(%d)\r\n", (int) vhwnd));
pVW->put_AutoShow(OAFALSE);
pVW->put_Owner((OAHWND)vhwnd);
pVW->put_MessageDrain((OAHWND)vhwnd);
pVW->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
pVW->put_Visible(OATRUE);
// We do all of our own aspect ratio control, so don't let DShow do any for us
// by setting the aspect ratio mode on the video rendering filter's pin
IEnumFilters *pEnum = NULL;
hr = pGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *currFilt = NULL;
while (pEnum->Next(1, &currFilt, NULL) == S_OK)
{
IPin *overlayPin = NULL;
hr = currFilt->FindPin(L"Input0", &overlayPin);
if (SUCCEEDED(hr))
{
// Right pin name, let's see if it's overlay
IMixerPinConfig *pOverlayMix = NULL;
hr = overlayPin->QueryInterface(IID_IMixerPinConfig, (void**)&pOverlayMix);
if (SUCCEEDED(hr))
{
pOverlayMix->SetAspectRatioMode(AM_ARMODE_STRETCHED);
SAFE_RELEASE(pOverlayMix);
}
SAFE_RELEASE(overlayPin);
}
SAFE_RELEASE(currFilt);
}
SAFE_RELEASE(pEnum);
hr = S_OK;
}
SAFE_RELEASE(pVW);
}
HTESTPRINT(hr);
}
示例3: InitDShowTextureRenderer
//-----------------------------------------------------------------------------
// InitDShowTextureRenderer : Create DirectShow filter graph and run the graph
//-----------------------------------------------------------------------------
HRESULT CDShowManager::InitDShowTextureRenderer()
{
HRESULT hr = S_OK;
IBaseFilter* pFSrc; // Source Filter
IPin* pFSrcPinOut; // Source Filter Output Pin
CTextureRenderer *pCTR=0; // DirectShow Texture renderer
// Create the filter graph
//if (FAILED(g_pGB->CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC)))
// return E_FAIL;
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&m_pGB);
if (FAILED(hr))
{
return E_FAIL;
}
#ifdef REGISTER_FILTERGRAPH
// Register the graph in the Running Object Table (for debug purposes)
AddToROT(m_pGB);
#endif
// Create the Texture Renderer object
pCTR = new CTextureRenderer(NULL, &hr);
if (FAILED(hr) || !pCTR)
{
delete pCTR;
Msg(TEXT("Could not create texture renderer object! hr=0x%x"), hr);
return E_FAIL;
}
// Get a pointer to the IBaseFilter on the TextureRenderer, add it to graph
m_pRenderer = pCTR;
pCTR->AddRef();
if (FAILED(hr = m_pGB->AddFilter(m_pRenderer, L"TEXTURERENDERER")))
{
Msg(TEXT("Could not add renderer filter to graph! hr=0x%x"), hr);
return hr;
}
// Determine the file to load based on windows directory
// Use the standard win32 API to do this.
TCHAR strFileName[MAX_PATH] = {0};
WCHAR wFileName[MAX_PATH];
if (! GetClipFileName(strFileName))
{
DWORD dwDlgErr = CommDlgExtendedError();
// Don't show output if user cancelled the selection (no dlg error)
if (dwDlgErr)
{
Msg(TEXT("GetClipFileName Failed! Error=0x%x\r\n"), GetLastError());
}
return E_FAIL;
}
strFileName[MAX_PATH-1] = 0; // NULL-terminate
wFileName[MAX_PATH-1] = 0; // NULL-terminate
//USES_CONVERSION;
(void)StringCchCopyW(wFileName, NUMELMS(wFileName), T2W(strFileName));
// Add the source filter to the graph.
hr = m_pGB->AddSourceFilter (wFileName, L"SOURCE", &pFSrc);
// If the media file was not found, inform the user.
if (hr == VFW_E_NOT_FOUND)
{
Msg(TEXT("Could not add source filter to graph! (hr==VFW_E_NOT_FOUND)\r\n\r\n")
TEXT("This sample reads a media file from your windows directory.\r\n")
TEXT("This file is missing from this machine."));
return hr;
}
else if(FAILED(hr))
{
Msg(TEXT("Could not add source filter to graph! hr=0x%x"), hr);
return hr;
}
if (FAILED(hr = pFSrc->FindPin(L"Output", &pFSrcPinOut)))
{
Msg(TEXT("Could not find output pin! hr=0x%x"), hr);
return hr;
}
#ifdef NO_AUDIO_RENDERER
// If no audio component is desired, directly connect the two video pins
// instead of allowing the Filter Graph Manager to render all pins.
CComPtr<IPin> pFTRPinIn; // Texture Renderer Input Pin
// Find the source's output pin and the renderer's input pin
if (FAILED(hr = pFTR->FindPin(L"In", &pFTRPinIn)))
{
Msg(TEXT("Could not find input pin! hr=0x%x"), hr);
//.........这里部分代码省略.........