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.
HRESULT CPlayer::CreateSession()
{
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:
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);
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)
{
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.