本文整理汇总了C++中IBaseFilter::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseFilter::AddRef方法的具体用法?C++ IBaseFilter::AddRef怎么用?C++ IBaseFilter::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseFilter
的用法示例。
在下文中一共展示了IBaseFilter::AddRef方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doReleaseAudioOutput
void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
IBaseFilter *decoder = getConnected(m_audioOutput, PINDIR_INPUT);
if (!decoder) {
decoder = m_audioOutput;
decoder->AddRef();
}
// {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
static const GUID iid_IFilterChain = {
0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
chain->RemoveChain(decoder, m_audioOutput);
chain->Release();
} else {
m_graph->RemoveFilter(m_audioOutput);
}
decoder->Release();
m_executedTasks &= ~SetAudioOutput;
m_loop->wake();
}
示例2: FindSourceFilter
HRESULT FindSourceFilter(IFilterGraph* filterGraph,IBaseFilter*& result)
{
HRESULT hr;
IEnumFilters *enumFilters;
hr = filterGraph->EnumFilters(&enumFilters);
if (FAILED(hr))
{
ErrorPrint("Get enum filters error",hr);
return hr;
}
ComReleaser enumFilterReleaser(enumFilters);
IBaseFilter* filter;
while (S_OK == enumFilters->Next(1, &filter, NULL))
{
ComReleaser filterReleaser(filter);
IEnumPins *enumPins;
hr = filter->EnumPins(&enumPins);
if (FAILED(hr))
{
ErrorPrint("Get enum pins error",hr);
return hr;
}
ComReleaser enumPinsReleaser(enumPins);
IPin* pin;
bool isSourceFilter = true;
while (S_OK == enumPins->Next(1, &pin, NULL))
{
ComReleaser pinReleaser(pin);
PIN_INFO pinInfo;
hr = pin->QueryPinInfo(&pinInfo);
if (FAILED(hr))
{
ErrorPrint("Get pin info error",hr);
continue;
}
if (pinInfo.dir == PINDIR_INPUT) //认为没有输入pin的就是source filter,这其实是有些问题的,特别是当捕获(如声卡的音频)的filter有时候有很多输入PIN
{
isSourceFilter = false;
break;
}
}
if (isSourceFilter)
{
filter->AddRef(); //存在一个资源管理的释放类,必须增加一个引用,否则会被释放掉
result = filter;
return S_OK;
}
}
return E_FAIL;
}
示例3: doReleaseVideoOutput
void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
IBaseFilter *intermediate = 0;
if (!SUCCEEDED(m_graph->FindFilterByName(L"Color Space Converter", &intermediate))) {
intermediate = m_videoOutput;
intermediate->AddRef();
}
IBaseFilter *decoder = getConnected(intermediate, PINDIR_INPUT);
if (!decoder) {
decoder = intermediate;
decoder->AddRef();
}
// {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
static const GUID iid_IFilterChain = {
0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
chain->RemoveChain(decoder, m_videoOutput);
chain->Release();
} else {
m_graph->RemoveFilter(m_videoOutput);
}
intermediate->Release();
decoder->Release();
m_executedTasks &= ~SetVideoOutput;
m_loop->wake();
}
示例4: CreateWaveOutRenderer
HRESULT WINAPI CreateWaveOutRenderer(LPUNKNOWN unk, IBaseFilter** out)
{
if (!out)
return E_POINTER;
HRESULT hr = S_OK;
IBaseFilter* punk = new CWaveOutRenderer(unk, &hr);
if(punk == NULL)
return E_OUTOFMEMORY;
punk->AddRef();
*out = punk;
return hr;
}
示例5: OpenConfiguration
STDAPI OpenConfiguration()
{
HRESULT hr = S_OK;
CUnknown *pInstance = CreateInstance<CLAVSplitter>(NULL, &hr);
IBaseFilter *pFilter = NULL;
pInstance->NonDelegatingQueryInterface(IID_IBaseFilter, (void **)&pFilter);
if (pFilter) {
pFilter->AddRef();
CBaseDSPropPage::ShowPropPageDialog(pFilter);
}
delete pInstance;
return 0;
}
示例6: QueryPinInfo
STDMETHODIMP CapturePin::QueryPinInfo(PIN_INFO *pInfo)
{
PrintFunc(L"CapturePin::QueryPinInfo");
pInfo->pFilter = filter;
if (filter) {
IBaseFilter *ptr = filter;
ptr->AddRef();
}
if (captureInfo.expectedMajorType == MEDIATYPE_Video)
memcpy(pInfo->achName, VIDEO_PIN_NAME, sizeof(VIDEO_PIN_NAME));
else
memcpy(pInfo->achName, AUDIO_PIN_NAME, sizeof(AUDIO_PIN_NAME));
pInfo->dir = PINDIR_INPUT;
return NOERROR;
}
示例7: RenderSubPicture
HRESULT RenderSubPicture()
{
if (!m_pDeMux) return E_POINTER;
// Render from the output of the DVD Nav & then from the output of the decoder filter
IPin* subpicSource = FindPinByName(m_pDeMux, "SubPicture", PINDIR_OUTPUT);
if (!subpicSource) return E_FAIL;
HRESULT hr;
// Check if the video rendering filter has an extra input pin. If it doesn't then
// this'll end up adding another renderer to the graph which causes an ActiveMovieWindow
// to display. We abort rendering of the subpicture in this case.
/* if (!m_pVideoRenderer)
{
IBaseFilter* pCurrVRend = FindVideoRendererFilter(m_pGraph);
if (!pCurrVRend) return E_FAIL;
IPin* testPin = FindUnconnectedPin(m_pVideoRenderer, PINDIR_INPUT);
if (!testPin)
{
slog(("Aborting subpicture rendering because there's no more input pins on video renderer.\r\n"));
return E_FAIL;
}
testPin->Release();
}
else
{
IPin* testPin = FindUnconnectedPin(m_pVideoRenderer, PINDIR_INPUT);
if (!testPin)
{
slog(("Aborting subpicture rendering because there's no more input pins on video renderer.\r\n"));
return E_FAIL;
}
testPin->Release();
}
*/
// Get the decoder filter, since it may not be specified
IBaseFilter* pVideoDecoder = NULL;
IBaseFilter* pVideoRenderer = NULL;
if (m_pVideoDecoder)
{
pVideoDecoder = m_pVideoDecoder;
pVideoDecoder->AddRef();
}
else
{
IPin* vSrc = GetSourceVideoPin();
IPin* vNext = NULL;
vSrc->ConnectedTo(&vNext);
vSrc->Release();
PIN_INFO pInfo;
hr = vNext->QueryPinInfo(&pInfo);
pVideoDecoder = pInfo.pFilter;
vNext->Release();
}
// We added this back for Vista to get DVD subpictures to show up. But this won't end up doing anything
// if we can't find another input pin on the renderer.
BOOL renderDVDSubpic = TRUE;
if (renderDVDSubpic)
{
if (m_pVideoRenderer)
{
pVideoRenderer = m_pVideoRenderer;
pVideoRenderer->AddRef();
}
else
{
IPin* vSrc = FindUnconnectedPin(pVideoDecoder, PINDIR_OUTPUT, TRUE);
IPin* vNext = NULL;
vSrc->ConnectedTo(&vNext);
vSrc->Release();
PIN_INFO pInfo;
hr = vNext->QueryPinInfo(&pInfo);
pVideoRenderer = pInfo.pFilter;
vNext->Release();
}
}
IPin* subpicDestPin = FindUnconnectedPin(pVideoDecoder, PINDIR_INPUT);
if (!subpicDestPin)
{
pVideoDecoder->Release();
return E_FAIL;
}
hr = m_pGraph->Connect(subpicSource, subpicDestPin);
SAFE_RELEASE(subpicDestPin);
SAFE_RELEASE(subpicSource);
/*
* NOTE: 7/27/04 - On my system, the video wouldn't play at all on DVDs if I connected
* up the subpicture stream. But the subpicture worked fine when I didn't connect it.
* For now I'm going to leave it that way and then just connect up the CC instead.
*/
if (renderDVDSubpic && SUCCEEDED(hr))
{
IPin* decoderSubpicOut = FindDecoderSubpictureOutputPin(pVideoDecoder);
if (decoderSubpicOut)
{
IPin* renderSubpicIn = FindUnconnectedPin(pVideoRenderer, PINDIR_INPUT);
//.........这里部分代码省略.........