------------------------------------------------------------------- Name: CreateSourceStreamNode Description: Creates a source-stream node for a stream. pSource: Pointer to the media source that contains the stream. pSourcePD: Presentation descriptor for the media source. pSourceSD: Stream descriptor for the stream. ppNode: Receives a pointer to the new node. ------------------------------------
| 61 | // ppNode: Receives a pointer to the new node. |
| 62 | //------------------------------------------------------------------- |
| 63 | static HRESULT CreateSourceStreamNode(IMFMediaSource* pSource, |
| 64 | IMFPresentationDescriptor* pSourcePD, |
| 65 | IMFStreamDescriptor* pSourceSD, |
| 66 | IMFTopologyNode** ppNode) |
| 67 | { |
| 68 | if (!pSource || !pSourcePD || !pSourceSD || !ppNode) |
| 69 | { |
| 70 | return E_POINTER; |
| 71 | } |
| 72 | |
| 73 | TComPtr<IMFTopologyNode> SourceNode; |
| 74 | HRESULT hr = S_OK; |
| 75 | |
| 76 | // Create the source-stream node. |
| 77 | CHECK_HR(hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &SourceNode)); |
| 78 | |
| 79 | // Set attribute: Pointer to the media source. |
| 80 | CHECK_HR(hr = SourceNode->SetUnknown(MF_TOPONODE_SOURCE, pSource)); |
| 81 | |
| 82 | // Set attribute: Pointer to the presentation descriptor. |
| 83 | CHECK_HR(hr = SourceNode->SetUnknown(MF_TOPONODE_PRESENTATION_DESCRIPTOR, pSourcePD)); |
| 84 | |
| 85 | // Set attribute: Pointer to the stream descriptor. |
| 86 | CHECK_HR(hr = SourceNode->SetUnknown(MF_TOPONODE_STREAM_DESCRIPTOR, pSourceSD)); |
| 87 | |
| 88 | // Return the IMFTopologyNode pointer to the caller. |
| 89 | *ppNode = SourceNode.Get(); |
| 90 | (*ppNode)->AddRef(); |
| 91 | |
| 92 | done: |
| 93 | return hr; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Implements a callback object for the MF video sample grabber sink. |
no test coverage detected