0
votes

I am writing a directshow source filter to read a specific raw file, the raw file contains timestamp(utc time) in each frame

My filter is modified from Microsoft SDK's "Push Source Filters Sample", so the most important thing is to overwrite GetMediaType(), DecideBufferSize() and FillBuffer().

My question is in the FillBuffer(IMediaSample *pSample). I don't know how to correctly call pSample->SetTime() in this function, because timestamp start from a large number, the frame will wait until StreamTime reach the timestamp.

The problem can be solved by substract an offset on each frame, but I need the original timestamp in downstream filter(SampleGrabber)

Is there a better solution?

1

1 Answers

0
votes

There are no absolute time stamps on media samples. You need to subtract leading media sample time from all the samples within segment being streamed so that first media samples is zero and the following are correctly set off.

If you can make the base time stamp (you are subtracting) available to your sample grabber callback, there you can add it back and restore correct absolute time.

MSDN: Time Stamps in DirectShow