Quantcast
Viewing all articles
Browse latest Browse all 1079

Adding a SampleGrabber to the MF_BasicPlayback example, No errors but SampleGrabber does not callback?

Hi,

I have modified the MF_BasicPlayback example from the SDK to include the code from the Using the Sample Grabber Sink example.

I have inserted a tee into the video stream so the source node feeds a tee which is connected to the renderer output node and the samplegrabber node.  The code runs and plays a video but the samplegrabber callback never gets called.

I am struggling to find where the error is without the joys of Graphedit to see if it has correctly connected up.

Any ideas?

I have modifed AddBranchToPartialTopology with the below code, I use the provided SampleGrabberCB class from the Microsoft example.

Thanks for any help.

Mike

if (majorType == MFMediaType_Video && fSelected) {// Configure the media type that the Sample Grabber will receive. // Setting the major and subtype is usually enough for the topology loader // to resolve the topology. CHECK_HR(hr = MFCreateMediaType(&pType)); CHECK_HR(hr = pType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video)); CHECK_HR(hr = pType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_ARGB32));

// Create the sample grabber sink. CHECK_HR(hr = SampleGrabberCB::CreateInstance(&m_pSampleGrabber)); CHECK_HR(hr = MFCreateSampleGrabberSinkActivate(pType, m_pSampleGrabber, &pSinkActivate)); // To run as fast as possible, set this attribute (requires Windows 7): //CHECK_HR(hr = pSinkActivate->SetUINT32(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, TRUE)); DWORD streamID; pSourceSD->GetStreamIdentifier(&streamID); CHECK_HR(hr = AddOutputNode(pTopology, pSinkActivate, 0, &pSampleGrabberNode)); // if I put in StreamID it throws an error.

CHECK_HR(hr = MFCreateTopologyNode(MF_TOPOLOGY_TEE_NODE, &pTeeNode)); CHECK_HR(hr = pTopology->AddNode(pTeeNode)); CHECK_HR(hr = pSourceNode->ConnectOutput(0, pTeeNode, 0)); CHECK_HR(hr = pTeeNode->ConnectOutput(0, pSampleGrabberNode, 0)); CHECK_HR(hr = pTeeNode->ConnectOutput(0, pOutputNode, 0)); } else { // Connect the source node to the output node. hr = pSourceNode->ConnectOutput(0, pOutputNode, 0); }



Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>