[FFmpeg-devel] [PATCH] Make ffmpeg.c use picture.pkt_pts in place of reordered_opaque, which is deprecated for this use.

Stefano Sabatini stefano.sabatini-lala
Thu Jan 27 21:26:49 CET 2011


---
 ffmpeg.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 691b73e..cde7488 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1493,8 +1493,6 @@ static int output_packet(AVInputStream *ist, int ist_index,
 
     if(pkt->dts != AV_NOPTS_VALUE)
         ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
-    if(pkt->pts != AV_NOPTS_VALUE)
-        pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
 
     //while we have more to decode or while the decoder did output something on EOF
     while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) {
@@ -1547,8 +1545,6 @@ static int output_packet(AVInputStream *ist, int ist_index,
                     decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
                     /* XXX: allocate picture correctly */
                     avcodec_get_frame_defaults(&picture);
-                    ist->st->codec->reordered_opaque = pkt_pts;
-                    pkt_pts = AV_NOPTS_VALUE;
 
                     ret = avcodec_decode_video2(ist->st->codec,
                                                 &picture, &got_picture, &avpkt);
@@ -1559,7 +1555,9 @@ static int output_packet(AVInputStream *ist, int ist_index,
                         /* no picture yet */
                         goto discard_packet;
                     }
-                    ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.reordered_opaque, ist->pts);
+                    pkt_pts = picture.pkt_pts != AV_NOPTS_VALUE ?
+                        av_rescale_q(picture.pkt_pts, ist->st->time_base, AV_TIME_BASE_Q) : AV_NOPTS_VALUE;
+                    ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, pkt_pts, ist->pts);
                     if (ist->st->codec->time_base.num != 0) {
                         int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
                         ist->next_pts += ((int64_t)AV_TIME_BASE *
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list