本文整理汇总了C++中IPin::Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ IPin::Disconnect方法的具体用法?C++ IPin::Disconnect怎么用?C++ IPin::Disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPin
的用法示例。
在下文中一共展示了IPin::Disconnect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetConnectedPin
HRESULT
recChannel_t::remap(void)
{
__CONTEXT("recChannel_t::remap");
IBaseFilter * pFilter = NULL;
int hr = 0;
pControl->StopWhenReady();
IPin * pin = NULL;
hr = pGraph->FindFilterByName(L"AVI Decompressor",&pFilter);
if (!hr)
{
hr = pGraph->RemoveFilter(pFilter);
errorCheck(hr);
pFilter->Release();
}
hr = pGraph->FindFilterByName(L"Video Renderer",&pFilter);
if (!hr)
{
while ((hr = GetConnectedPin(pFilter,PINDIR_INPUT,&pin))==0)
{
pin->Disconnect();
}
}
if (pOutput) pOutput->Disconnect();
remaped = true;
return 0;
}
示例2: errorCheck
HRESULT
recChannel_t::set_rate(float FR)
{
__CONTEXT("recChannel_t::set_rate");
if (FR<1)
{
return S_OK;
}
float factorRate = FR/30;
int hr = 0;
if (factorRate<0.1) factorRate = 0.1;
frameRate = factorRate;
IAMStreamConfig *pConfig = NULL;
if ((camInfo->getKind() == SHARED ||
camInfo->getKind() == CAM) &&
actualFormat.pbFormat != NULL)
{
VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*) actualFormat.pbFormat;
double newFR = 10000000.0/FR;
pVih->AvgTimePerFrame = newFR;
camInfo->setRate(pVih->AvgTimePerFrame);
if (camInfo->getKind() == CAM)
{
IPin * pInput = NULL;
get_camInfo()->output->ConnectedTo(&pInput);
if (mapping)
{
pControl->Stop();
}
if (pInput)
{
get_camInfo()->output->Disconnect();
pInput->Disconnect();
}
hr = get_camInfo()->output->QueryInterface(IID_IAMStreamConfig, (void**)&pConfig);
if (pConfig)
{
int hr = pConfig->SetFormat(&actualFormat);
errorCheck(hr);
pConfig->Release();
}
if (pInput)
{
hr = pGraph->Connect(get_camInfo()->output,pInput);
errorCheck(hr);
}
errorCheck(hr);
if (mapping)
{
pControl->Run();
}
}
}
return hr;
}
示例3: ConnectPins
bool ConnectPins(IGraphBuilder *filterGraph, IBaseFilter* outputFilter, unsigned int outputNum, IBaseFilter* inputFilter, unsigned int inputNum)
{
IPin *inputPin = 0;
IPin *outputPin = 0;
if (!outputFilter || !inputFilter) {
return false;
}
FindPin(outputFilter, PINDIR_OUTPUT, outputNum, &outputPin);
FindPin(inputFilter, PINDIR_INPUT, inputNum, &inputPin);
bool ret = false;
if (inputPin && outputPin)
{
IPin *tmp = 0;
outputPin->ConnectedTo (&tmp);
if (tmp)
{
outputPin->Disconnect ();
tmp->Release();
}
inputPin->ConnectedTo (&tmp);
if (tmp)
{
inputPin->Disconnect ();
tmp->Release();
}
HRESULT hr = filterGraph->Connect (outputPin, inputPin);
ret = SUCCEEDED(hr);
}
if (inputPin)
{
inputPin->Release();
}
if (outputPin)
{
outputPin->Release();
}
return ret;
}
示例4: DeleteOutputPins
void COggSplitter::DeleteOutputPins()
{
CAutoLock lock(&m_csFilter);
for (int i=0; i<m_iOutputs; i++)
{
if (m_paOutput[i]->IsConnected())
{
IPin *pcPin;
m_paOutput[i]->ConnectedTo(&pcPin);
pcPin->Disconnect();
m_paOutput[i]->Disconnect();
}
}
delete m_paOutput;
m_paOutput = NULL;
m_iOutputs = 0;
}
示例5: DisconnectPins
// Disconnect any connections to the filter.
HRESULT VideoTexture::DisconnectPins(IBaseFilter *pFilter)
{
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr))
{
return hr;
}
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
pPin->Disconnect();
pPin->Release();
}
pEnum->Release();
// Did not find a matching pin.
return S_OK;
}
示例6: disableAudio
void DirectShowVideoWrapper::disableAudio(void)
{
if(isInitialized() && hasAudio())
{
HRESULT hr;
TCHAR szErr[MAX_ERROR_TEXT_LEN];
IBaseFilter* pAudioRenderer = NULL;
hr = FindAudioRenderer(_pGraphBuilder,&pAudioRenderer);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "Failed to find audio renderer, error: " << szErr << std::endl;
return;
}
if(pAudioRenderer != NULL)
{
stop();
//Remove the Renderer
IPin* ipin;
hr = GetPin(pAudioRenderer, PINDIR_INPUT, 0, &ipin);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "Get Audio Renderer in pin, error: " << szErr << std::endl;
return;
}
IPin* opin = NULL;
//find out who the renderer is connected to and disconnect from them
hr = ipin->ConnectedTo(&opin);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return;
}
hr = ipin->Disconnect();
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return;
}
hr = opin->Disconnect();
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return;
}
//Remove the Renderer
hr = _pGraphBuilder->RemoveFilter(pAudioRenderer);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return;
}
//Connect an NULL Audio renderer
hr = _pGraphBuilder->AddFilter(_pNullAudioFilter, L"NULL Audio Renderer");
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return;
}
//get the input pin of the Color Space Converter
hr = GetPin(_pNullAudioFilter, PINDIR_INPUT, 0, &ipin);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "Get Null Audio in pin, error: " << szErr << std::endl;
return;
}
//Connect an Audio renderer
hr = _pGraphBuilder->Connect(opin, ipin);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return;
}
}
}
}
示例7: ConnectSampleGrabber
//.........这里部分代码省略.........
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "Get Vidio Renderer in pin, error: " << szErr << std::endl;
return hr;
}
IPin* opin = NULL;
//find out who the renderer is connected to and disconnect from them
hr = ipin->ConnectedTo(&opin);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return hr;
}
//Get the filter of the opin
PIN_INFO OpinInfo;
opin->QueryPinInfo(&OpinInfo);
IBaseFilter* LastFilter(OpinInfo.pFilter);
FILTER_INFO LastFilterInfo;
LastFilter->QueryFilterInfo(&LastFilterInfo);
CLSID LastFilterClassID;
LastFilter->GetClassID(&LastFilterClassID);
SLOG << "Last filter name: " << LastFilterInfo.achName
<< ", ClassID " << LastFilterClassID.Data1 << "-" << LastFilterClassID.Data2 << "-" << LastFilterClassID.Data3 << "-" << LastFilterClassID.Data4
<< std::endl;
LPWSTR *VendorInfo;
LastFilter->QueryVendorInfo(VendorInfo);
if(VendorInfo)
{
SLOG << "Last filter vendor: " << *VendorInfo << std::endl;
}
hr = ipin->Disconnect();
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return hr;
}
hr = opin->Disconnect();
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return hr;
}
//SAFE_RELEASE(ipin);
//remove the default renderer from the graph
hr = _pGraphBuilder->RemoveFilter(pVidRenderer);
if (FAILED(hr))
{
AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
SWARNING << "error: " << szErr << std::endl;
return hr;
}
//SAFE_RELEASE(pVidRenderer);
//see if the video renderer was originally connected to
//a color space converter
_pGraphBuilder->FindFilterByName(L"Color Space Converter", &_pCSCFilter);
if(_pCSCFilter == NULL)
{
// Create the Color Space filter
示例8: loadMovie
bool DShowMoviePlayer::loadMovie (void)
{
if (!_oleInitialized)
{
::CoInitialize (0);
}
char physicFileName[512];
wchar_t physicFileNameW[512];
ATOM_GetNativePathName (_fileName.c_str(), physicFileName);
if (!convertCStringToWString (physicFileName, physicFileNameW, 512))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "Error converting C string filename to UNICODE");
return false;
}
#if 1
HRESULT hr = ::CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&_graphBuilder);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error creating graph");
return false;
}
hr = ::CoCreateInstance (CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&_grabberFilter);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error creating sample grabber");
return false;
}
hr = _grabberFilter->QueryInterface (IID_ISampleGrabber, (void**)&_grabber);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error querying sample grabber");
return false;
}
AM_MEDIA_TYPE mt;
memset (&mt, 0, sizeof(AM_MEDIA_TYPE));
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_RGB32;
mt.formattype = FORMAT_VideoInfo;
hr = _grabber->SetMediaType (&mt);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error setting smaple grabber media type");
return false;
}
hr = _graphBuilder->AddFilter (_grabberFilter, L"Sample Grabber");
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error adding filter");
return false;
}
hr = _graphBuilder->QueryInterface (IID_IMediaControl, (void**)&_control);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error querying media control");
return false;
}
IBaseFilter *render = 0;
hr = ::CoCreateInstance (CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&render);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error creating render filter");
return false;
}
hr = _graphBuilder->AddFilter (render, L"Null renderer");
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error adding null-renderer filter");
return false;
}
hr = _control->RenderFile (physicFileNameW);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error rendering file");
return false;
}
#if 0
IPin *grabberOut = 0;
FindPin (_grabberFilter, PINDIR_OUTPUT, 0, &grabberOut);
if (grabberOut)
{
grabberOut->Disconnect ();
grabberOut->Release ();
}
#endif
SaveGraphFile (_graphBuilder, L"C:\\test.grf");
hr = _graphBuilder->QueryInterface (IID_IVideoWindow, (void**)&_window);
if (FAILED(hr))
{
ATOM_LOGGER::error ("%s() %s\n", __FUNCTION__, "[DSHOW] Error querying video window");
//.........这里部分代码省略.........
示例9: setWindowGeometry
HRESULT
recChannel_t::map(void)
{
__CONTEXT("recChannel_t::map");
int hr = 0;
IBaseFilter * pFilter = NULL;
IBaseFilter * pFilter2 = NULL;
IPin * pVideoInputPin = NULL;
pControl->StopWhenReady();
mapping = true;
pOutput = camInfo->output;
if (remaped){
//refresh Codec BW before creation
pSender->sampleGrabber->BWController->refreshBW();
pSender->rebind();
hr = pGraph->Render(pOutput);
{
// Enumerate the filters in the graph.
IEnumFilters *pEnum = NULL;
int hr = pGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *pFilter = NULL;
pEnum->Reset();
while (S_OK == pEnum->Next(1, &pFilter, NULL))
{
CLSID filterId;
pFilter->GetClassID(&filterId);
if(filterId == CLSID_AviSplitter)
{
IEnumPins * pEnumpin = NULL;
hr = pFilter->EnumPins(&pEnumpin);
if (!hr)
{
IPin * pPin = NULL;
pEnumpin->Reset();
while (pEnumpin->Next(1, &pPin, 0) == S_OK)
{
bool break_loop = false;
AM_MEDIA_TYPE * mediaType;
IEnumMediaTypes * enumMedia = NULL;
hr = pPin->EnumMediaTypes(&enumMedia);
if(!hr)
{
enumMedia->Reset();
while(enumMedia->Next(1,&mediaType , NULL) == S_OK)
{
if (mediaType->majortype == MEDIATYPE_Audio)
{
pPin->Disconnect();
pGraph->Render(pPin);
pPin->Release();
break_loop = true;
break;
}
}
enumMedia->Release();
if (break_loop)
break;
}
}
pEnumpin->Release();
}
}
pFilter->Release();
}
pEnum->Release();
}
}
pipeCreated = true;
if (hr)
{
errorCheck(hr);
NOTIFY("[recChannel_t::map]WARNING :: Can't render actual format, restoring default settings...\r\n");
capInfo.heigth = DEFAULT_CAPTURE_HEIGTH;
capInfo.width = DEFAULT_CAPTURE_WIDTH;
ql_t<AM_MEDIA_TYPE *> auxFormats = camInfo->getFormatList();
pSender->SetActualCodec(DEFAULT_CODEC_STR);
}
}
if (fullScreen){
set_full_screen(true);
}else{
hr = setWindowGeometry(windowInfo);
errorCheck(hr);
//.........这里部分代码省略.........