[FFmpeg-cvslog] ffmpeg: change sync_opts code to be more similar to qatar.

Michael Niedermayer git at videolan.org
Wed Feb 8 23:53:25 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Feb  8 23:14:28 2012 +0100| [d8710228eaafbcf60aa72861de81fc849759ea0b] | committer: Michael Niedermayer

ffmpeg: change sync_opts code to be more similar to qatar.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8710228eaafbcf60aa72861de81fc849759ea0b
---

 ffmpeg.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index d2cbd03..f34d3dc 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1078,6 +1078,8 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
             av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n");
             exit_program(1);
         }
+
+        ost->sync_opts += frame->nb_samples;
     }
 
     got_packet = 0;
@@ -1101,9 +1103,6 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
         av_free_packet(&pkt);
     }
 
-    if (frame)
-        ost->sync_opts += frame->nb_samples;
-
     return ret;
 }
 
@@ -1356,6 +1355,8 @@ static void do_subtitle_out(AVFormatContext *s,
         nb = 1;
 
     for (i = 0; i < nb; i++) {
+        ost->sync_opts = av_rescale_q(pts, ist->st->time_base, enc->time_base);
+
         sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
         // start_display_time is required to be 0
         sub->pts               += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q);



More information about the ffmpeg-cvslog mailing list