Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Mpeg2-decoder: Timestamp based on GOP?

dewildt
Beginner
377 Views
Hello,
I seems that the PTS of a MPEG2-frame is only based on the framerate and is always started at PTS=0.
In my case I have a smal clip of a video and it's necessary to show the played time in relation to the original video. My idea is to define the PTS based on the time-information in the GOP.
Is that already (or will it) implemented?
And if not, do only need to reimplement MPEG2VideoDecoderBase::CalculateFrameTime?

regards,
0 Kudos
3 Replies
Leonid_K_Intel
Employee
377 Views

Decoder use timestamps from input MediaData. If they are not set by demuxer they are started from 0. We have no plans to change it.

It looks possible to modify CalculateFrameTime so that it used GOP's timestampand frame's temporal reference. The problem can be that some streams can have these fields not set or incorrect.

As well you need to care about possible 3:2 pulldown, when frames can have duration different than 1/framerate.

Regards,

Leonid

0 Kudos
dewildt
Beginner
377 Views
MADlakulako:
Decoder use timestamps from input MediaData. If they are not set by demuxer they are started from 0. We have no plans to change it.

It looks possible to modify CalculateFrameTime so that it used GOP's timestampand frame's temporal reference. The problem can be that some streams can have these fields not set or incorrect.

OK, in that case I will reimplement CalculateFrameTime. I think a fallback in cases that the GOP-time is not set will be not a big problem.

All member functions of MPEG2VideoDecoderBase and MPEG2VideoDecoder are declared with the (macro)keyword MPEG2_VIRTUAL, but MPEG2_VIRTUAL is defined to nothing (blank), so the member functions are not virtual and a reimplementation is not called by the base class.
I think I only need to set those lines to
#define MPEG2_VIRTUAL virtual
Is there a special reason why MPEG2_VIRTUAL is not set to virtual?

Edit:
Is it correct, that MPEG2VideoDecoderBase::FindSliceStartCode is not implemented?
0 Kudos
Leonid_K_Intel
Employee
377 Views

Daniel,

It is not defined to virtual because we had no derived classes, API functions of MPEG2VideoDecoderBaseare called directly using MPEG2VideoDecoder wrapper and non-virtual functions call isa bit faster.

You can either define MPEG2_VIRTUAL to virtual or just declare a single function you need to virtual.

Declaration of FindSliceStartCode reamained in class by error. Thanks for pointing it out.

Regards,

Leonid

0 Kudos
Reply