0

I am looking for to start a thread at a specified time with Media Foundation.

I know that in DirectShow there is a function called by IMediaFilter where tStart is the time value of the reference clock.:

Interface::HRESULT Run(REFERENCE_TIME tStart);

But in Media Foundation there is no such function that will run or start a thread with a time as a parameter.

Is there a solution to do this in Media Foundation?

Roman R.
  • 68,205
  • 6
  • 94
  • 158
maz
  • 11
  • 1
  • Why don't you block until the given time then call whatever needs to be called? – Passer By Sep 19 '17 at 14:52
  • Because this do not ensure a perfect image synchronisation dislaying for the same video lauched in 2 players. – maz Sep 28 '17 at 15:25
  • How bout this, you wait on a condition variable on all threads, then notify them all at the correct time. – Passer By Sep 28 '17 at 15:32

1 Answers1

0

Neither DirectShow or Media Foundation have functionality that matches the question description.

Both APIs have methods to start activity immediately following the request.

DirectShow's IMediaFilter.Run does not start thread in first place. Then the method is a trick rather than intended use:

... When an application calls the IMediaControl::Run method, the Filter Graph Manager calls IMediaFilter::Run on each filter. It sets the value of tStart slightly in the future, to account for graph latency.

Note that there is no word on you calling IMediaFilter::Run, the method is supposed to be called internally.

Media Foundation's internal design is different. You cannot schedule startup and you have no effect on internal working threads either. It is suppose that you start media session activity and it gets started as soon as possible.

Roman R.
  • 68,205
  • 6
  • 94
  • 158