Le 29 oct. 2009 à 23:35, Bruce Wheaton a écrit :
What is reordered_opaque for? I presume it helps with reordered
packets, and I see anecdotal evidence that if I want to override
get_buffer, I should set the frame's reordered_opaque to the current
codec pts, but I'm not sure if it's essential.
Currently, in my video decode tasks, I get the pts of the first
video packet, and use that as the pts of the video frame I obtain (I
stay in the decode job until I get a complete video frame). Is that
no longer a valid approach?
It will not work with codec that use frame reordering (H.264 for
example). To reorder the frame, the decoder will bufferize decoded
frames, and so when you call decode_frame with such decoder, the
decoded frame returned may not be the one corresponding to the packet
you pass as argument.
In such cases, packet pts will not match frame pts.
Have a look at ffplay.c to see how you can properly handle this kind
of movies.
is->video_st->codec->reordered_opaque= pkt->pts;
len1 = avcodec_decode_video2(is->video_st->codec, frame,
&got_picture, pkt);
if ((decoder_reorder_pts || pkt->dts == AV_NOPTS_VALUE) &&
frame->reordered_opaque != AV_NOPTS_VALUE)
pts= frame->reordered_opaque;
else if (pkt->dts != AV_NOPTS_VALUE)
pts= pkt->dts;
else
pts= 0;
pts *= av_q2d(is->video_st->time_base);
I just started to use the ffmpeg-mt branch, if that matters, and I
did add:
#ifdef AVCODEC_HAS_REORDERED_OPAQUE
// take over pts for this frame to have it reordered
pic->reordered_opaque = c->reordered_opaque;
#endif
To my buffer callback.
Regards,
Bruce Wheaton
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
-- Jean-Daniel
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user