Microsoft Media Foundation - Replacing Time Source / Clock
-
I want to playback videos with Microsoft Media foundation with a custom clock. I am starting with the example found at http://archive.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=mediafoundation&DownloadId=8413[^] The idea is to replace the clock with one that is driven by UDP packets. The videos will be silent (the audio turned off, preferably not even decoded). I have stubbed out what I think is a clock replacement, but what I can't figure out is why my calls to GetCorrellatedTime seem to only occur at the start of playback. I expected GetCorrellatedTime to be called by the playback engine repeatedly.... but that's just not happening. Here's the cpp code for my timesource. Note that it doesn't do much of anything yet... it is just a stub. Any Ideas? Thanks in advance
#include "MFPlayer.h"
#include "TimeSource.h"HRESULT STDMETHODCALLTYPE UDPClock::GetClockCharacteristics( /* [out] */ __RPC__out DWORD *pdwCharacteristics)
{
*pdwCharacteristics = MFCLOCK_CHARACTERISTICS_FLAG_FREQUENCY_10MHZ;
return S_OK;
}HRESULT STDMETHODCALLTYPE UDPClock::GetCorrelatedTime( /* [in] */ DWORD dwReserved,/* [out] */ __RPC__out LONGLONG *pllClockTime,/* [out] */ __RPC__out MFTIME *phnsSystemTime)
{
m_Time = GetTickCount64();
m_System_Time = GetTickCount64();\*pllClockTime = m\_Time; \*phnsSystemTime = m\_System\_Time; return S\_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::GetContinuityKey( /* [out] */ __RPC__out DWORD *pdwContinuityKey)
{
*pdwContinuityKey = 0;
return S_OK;
}HRESULT STDMETHODCALLTYPE UDPClock::GetState( /* [in] */ DWORD dwReserved,/* [out] */ __RPC__out MFCLOCK_STATE *peClockState)
{
*peClockState = MFCLOCK_STATE_RUNNING;
return S_OK;
}HRESULT STDMETHODCALLTYPE UDPClock::GetProperties( /* [out] */ __RPC__out MFCLOCK_PROPERTIES *pClockProperties)
{
pClockProperties->qwCorrelationRate = 1000000;
pClockProperties->guidClockId = GUID_NULL;
pClockProperties->qwClockFrequency = MFCLOCK_CHARACTERISTICS_FLAG_FREQUENCY_10MHZ;
pClockProperties->dwClockTolerance = MFCLOCK_TOLERANCE_UNKNOWN;
pClockProperties->dwClockJitter = 1;//10000;
pClockProperties->dwClockFlags = MFCLOCK_RELATIONAL_FL