本文整理汇总了C++中CStreamSwitcherOutputPin::GetDeliveryBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CStreamSwitcherOutputPin::GetDeliveryBuffer方法的具体用法?C++ CStreamSwitcherOutputPin::GetDeliveryBuffer怎么用?C++ CStreamSwitcherOutputPin::GetDeliveryBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStreamSwitcherOutputPin
的用法示例。
在下文中一共展示了CStreamSwitcherOutputPin::GetDeliveryBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeOutputSample
HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample)
{
if (!pInSample || !ppOutSample) {
return E_POINTER;
}
CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
ASSERT(pOut->GetConnected());
CComPtr<IMediaSample> pOutSample;
DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0;
if (!(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT)) {
dwFlags |= AM_GBF_NOTASYNCPOINT;
}
HRESULT hr = pOut->GetDeliveryBuffer(&pOutSample
, m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID ? &m_SampleProps.tStart : nullptr
, m_SampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID ? &m_SampleProps.tStop : nullptr
, dwFlags);
if (FAILED(hr)) {
return hr;
}
if (!pOutSample) {
return E_FAIL;
}
if (CComQIPtr<IMediaSample2> pOutSample2 = pOutSample) {
AM_SAMPLE2_PROPERTIES OutProps;
EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)));
OutProps.dwTypeSpecificFlags = m_SampleProps.dwTypeSpecificFlags;
OutProps.dwSampleFlags =
(OutProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED) |
(m_SampleProps.dwSampleFlags & ~AM_SAMPLE_TYPECHANGED);
OutProps.tStart = m_SampleProps.tStart;
OutProps.tStop = m_SampleProps.tStop;
OutProps.cbData = FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId);
hr = pOutSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId), (PBYTE)&OutProps);
if (m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
m_bSampleSkipped = FALSE;
}
} else {
if (m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) {
pOutSample->SetTime(&m_SampleProps.tStart, &m_SampleProps.tStop);
}
if (m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT) {
pOutSample->SetSyncPoint(TRUE);
}
if (m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
pOutSample->SetDiscontinuity(TRUE);
m_bSampleSkipped = FALSE;
}
LONGLONG MediaStart, MediaEnd;
if (pInSample->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR) {
pOutSample->SetMediaTime(&MediaStart, &MediaEnd);
}
}
*ppOutSample = pOutSample.Detach();
return S_OK;
}