[FFmpeg-cvslog] ffmpeg: rework debugging timestamp logs in process_input()

Stefano Sabatini git at videolan.org
Tue Nov 20 22:56:36 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sat Nov 17 11:12:04 2012 +0100| [3d52083a274eaf92b1ef4c6e607e03374647a8c7] | committer: Stefano Sabatini

ffmpeg: rework debugging timestamp logs in process_input()

Print timestamps before and after ffmpeg timestamp postprocessing.
Help to debug how ffmpeg processes the input timestamps.

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

 ffmpeg.c |   30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index e5bd1b1..0c98fb7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2750,6 +2750,17 @@ static int process_input(int file_index)
     if (ist->discard)
         goto discard_packet;
 
+    if (debug_ts) {
+        av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
+                "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%"PRId64"\n",
+                ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),
+                av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
+                av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
+                av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
+                av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
+                input_files[ist->file_index]->ts_offset);
+    }
+
     if(!ist->wrap_correction_done && input_files[file_index]->ctx->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){
         int64_t stime = av_rescale_q(input_files[file_index]->ctx->start_time, AV_TIME_BASE_Q, ist->st->time_base);
         int64_t stime2= stime + (1ULL<<ist->st->pts_wrap_bits);
@@ -2775,17 +2786,6 @@ static int process_input(int file_index)
     if (pkt.dts != AV_NOPTS_VALUE)
         pkt.dts *= ist->ts_scale;
 
-    if (debug_ts) {
-        av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
-                "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s  pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%"PRId64"\n",
-                ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),
-                av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q),
-                av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q),
-                av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
-                av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
-                input_files[ist->file_index]->ts_offset);
-    }
-
     if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
         !copy_ts) {
         int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
@@ -2823,6 +2823,14 @@ static int process_input(int file_index)
         }
     }
 
+    if (debug_ts) {
+        av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%"PRId64"\n",
+                ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->st->codec->codec_type),
+                av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base),
+                av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base),
+                input_files[ist->file_index]->ts_offset);
+    }
+
     sub2video_heartbeat(ist, pkt.pts);
 
     ret = output_packet(ist, &pkt);



More information about the ffmpeg-cvslog mailing list