[mythtv] framesPlayed

Mark Kendall mark.kendall at gmail.com
Wed Jul 3 07:34:51 UTC 2019


On Mon, 1 Jul 2019 at 22:13, David Engel <david at istwok.net> wrote:
> Does ffmpeg allow us to attach private data to each frame to be
> decoded and have it returned back to us after decoding?  If so, we
> could put our framesPlayed value there.  If the frame gets 2x
> deintelaced, we'd get back two frames with the same framesPlayed
> value.  Would that be a problem?  Alternatively, we could put our own
> copy of the frame timestamp there.  If it gets 2x deinterlaced, the
> second frame would come back with a slightly later timestamp than what
> our returned value, right?  If so, could not count those frames toward
> framesPlayed.

Hi David

That's a useful idea and would probably work if we needed something
for other decoders.

As far as I can tell, however, we never really have visibility of the
mediacodec frames before they come out of the decoder. Mediacodec
handles all of its buffering internally and for both direct rendering
and copy back decoding, the first we see of the frame is in
AvFormatDecoder::ProcessVideoFrame - which is the same point that we
process framesPlayed. I may be missing something but I can't currently
see it working.

The other solution would be to add some private data to the packets
fed into the decoder but AVPacket has no opaque field for such a use
case and it probably wouldn't be reliable - as frames are often
returned out of order.

Regards
Mark


More information about the mythtv-dev mailing list