[FFmpeg-devel] [PATCH] Print chapter info in dump_format().

Anton Khirnov wyskas
Sun Feb 28 09:40:03 CET 2010


---
 libavformat/utils.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1fbceea..a79f789 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3009,6 +3009,20 @@ void dump_format(AVFormatContext *ic,
         }
         av_log(NULL, AV_LOG_INFO, "\n");
     }
+    for (i = 0; i < ic->nb_chapters; i++) {
+        AVChapter *ch = ic->chapters[i];
+        int secs, us;
+
+        av_log(NULL, AV_LOG_INFO, "    Chapter #%d.%d: ", index, i);
+        secs = av_rescale_q(ch->start, ch->time_base, (AVRational){1, 1});
+        us   = av_rescale_q(ch->start, ch->time_base, AV_TIME_BASE_Q) % AV_TIME_BASE;
+        av_log(NULL, AV_LOG_INFO, "start %d.%06d, ", secs, us);
+        secs = av_rescale_q(ch->end, ch->time_base, (AVRational){1, 1});
+        us   = av_rescale_q(ch->end, ch->time_base, AV_TIME_BASE_Q) % AV_TIME_BASE;
+        av_log(NULL, AV_LOG_INFO, "end %d.%06d\n", secs, us);
+
+        dump_metadata(NULL, ch->metadata, "    ");
+    }
     if(ic->nb_programs) {
         int j, k, total = 0;
         for(j=0; j<ic->nb_programs; j++) {
-- 
1.6.6.1




More information about the ffmpeg-devel mailing list