Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git] / ffmpeg / libavformat / dump.c
index 3a7adbe01432d3071350483e824278d14509d693..56b37ff7d8236e6fea85e0b6b9a5833bc1b5754d 100644 (file)
@@ -27,6 +27,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
 #include "libavutil/avstring.h"
 #include "libavutil/replaygain.h"
 #include "libavutil/stereo3d.h"
@@ -118,11 +119,11 @@ static void print_fps(double d, const char *postfix)
 {
     uint64_t v = lrintf(d * 100);
     if (v % 100)
-        av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
+        av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
     else if (v % (100 * 1000))
-        av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
+        av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
     else
-        av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
+        av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
 }
 
 static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
@@ -345,8 +346,15 @@ static void dump_stream_format(AVFormatContext *ic, int i,
     int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
     AVStream *st = ic->streams[i];
     AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
+    char *separator = ic->dump_separator;
+    char **codec_separator = av_opt_ptr(st->codec->av_class, st->codec, "dump_separator");
+    int use_format_separator = !*codec_separator;
 
+    if (use_format_separator)
+        *codec_separator = av_strdup(separator);
     avcodec_string(buf, sizeof(buf), st->codec, is_output);
+    if (use_format_separator)
+        av_freep(codec_separator);
     av_log(NULL, AV_LOG_INFO, "    Stream #%d:%d", index, i);
 
     /* the pid is an important information, so we display it */
@@ -372,15 +380,21 @@ static void dump_stream_format(AVFormatContext *ic, int i,
     }
 
     if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if (st->avg_frame_rate.den && st->avg_frame_rate.num)
-            print_fps(av_q2d(st->avg_frame_rate), "fps");
-#if FF_API_R_FRAME_RATE
-        if (st->r_frame_rate.den && st->r_frame_rate.num)
-            print_fps(av_q2d(st->r_frame_rate), "tbr");
-#endif
-        if (st->time_base.den && st->time_base.num)
-            print_fps(1 / av_q2d(st->time_base), "tbn");
-        if (st->codec->time_base.den && st->codec->time_base.num)
+        int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
+        int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
+        int tbn = st->time_base.den && st->time_base.num;
+        int tbc = st->codec->time_base.den && st->codec->time_base.num;
+
+        if (fps || tbr || tbn || tbc)
+            av_log(NULL, AV_LOG_INFO, "%s", separator);
+
+        if (fps)
+            print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
+        if (tbr)
+            print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
+        if (tbn)
+            print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
+        if (tbc)
             print_fps(1 / av_q2d(st->codec->time_base), "tbc");
     }
 
@@ -460,7 +474,7 @@ void av_dump_format(AVFormatContext *ic, int index,
 
     for (i = 0; i < ic->nb_chapters; i++) {
         AVChapter *ch = ic->chapters[i];
-        av_log(NULL, AV_LOG_INFO, "    Chapter #%d.%d: ", index, i);
+        av_log(NULL, AV_LOG_INFO, "    Chapter #%d:%d: ", index, i);
         av_log(NULL, AV_LOG_INFO,
                "start %f, ", ch->start * av_q2d(ch->time_base));
         av_log(NULL, AV_LOG_INFO,