Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi! Can't deal with attributes. I request assistance.

Next task: create an application that having some sort of list of files (play list) reproduced in the specified time, the desired file. In some cases, must run multiple files simultaneously (overlap).



Application used as the basis for its Media Foundation SDK Samples \ Playlist Sample.

Creating Media Session with attribute MF_SESSION_GLOBAL_TIME, as indicated in the msdn \ Sequence Presentation Times.

C++
//  Create a new instance of the media session.
HRESULT CPlayer::CreateSession()
{
        /* .... */
	// Create the media session.
	IMFAttributes *attrib;
	MFCreateAttributes(&attrib, 1);
	attrib->SetGUID( MF_SESSION_GLOBAL_TIME, GUID_NULL);
	hr = MFCreateMediaSession(attrib, &m_pSession);
        /* .... */

done:
	return hr;
}


Next, File(URL) -> MediaSourse ->PresentationDescriptor -> Create and connect input/output nods.
I can not understand at what point and how do I apply attributes MF_TOPOLOGY_PROJECTSTART and MF_TOPOLOGY_PROJECTSTOP.

What I have tried:

C++
// Adds a segment to the sequencer.

HRESULT CPlaylist::AddSegment(PCWSTR pszURL)
{
	IMFMediaSource *pMediaSource = NULL;
	IMFPresentationDescriptor *pPD = NULL;
	IMFTopology *pTopology = NULL;

	MFSequencerElementId SegmentId;
	TOPOID TopologyID = 0;

	
	

	HRESULT hr = CreateMediaSource(pszURL, &pMediaSource);
	if (FAILED(hr))
	{
		goto done;
	}

	hr = pMediaSource->CreatePresentationDescriptor(&pPD);
	if (FAILED(hr))
	{
		goto done;
	}

	hr = CreatePlaybackTopology(pMediaSource, pPD, m_hwndVideo, &pTopology);
	if (FAILED(hr))
	{
		goto done;
	}
	/******************* ! **************/
	pTopology->SetUINT64(MF_TOPOLOGY_PROJECTSTART, 0);
	pTopology->SetUINT64(MF_TOPOLOGY_PROJECTSTOP, 20000000); // 2 sec
        /******************* ! **************/

	
	hr = m_pSequencerSource->AppendTopology(
		pTopology,
		SequencerTopologyFlags_Last,
		&SegmentId
		);

	if (FAILED(hr))
	{
		goto done;
	}

	hr = pTopology->GetTopologyID(&TopologyID);
	if (FAILED(hr))
	{
		goto done;
	}
	

	if (m_count == 0)
	{
		// Get the segment duration
		m_hnsSegmentDuration = MFGetAttributeUINT64(pPD, MF_PD_DURATION, 0);
	}

	m_segments[m_count].SegmentID = SegmentId;
	m_segments[m_count].TopoID = TopologyID;

	m_count++;

done:
	SafeRelease(&pMediaSource);
	SafeRelease(&pTopology);
	SafeRelease(&pPD);
	return hr;
}


But get the error 0xC00D36B2, although like all elements of the sequence must start and end at the same time, zero and two seconds respectively. Most likely something I did not do it correctly, for example, apply the attribute. And so the question is: where and how do I use these attributes?

P.S.
Sorry for my English.
This is machine translated Bing Translator.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900