]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/dump.c
movenc: Add a flag for using default-base-is-moof in tfhd atoms
[ffmpeg] / libavformat / dump.c
index cdf2da1ca87d231f5a88ac6b1c8bd56d1aed5128..99188f0a5137060bec7490b2935388da339d3b75 100644 (file)
@@ -27,6 +27,7 @@
 #include "libavutil/log.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/replaygain.h"
+#include "libavutil/stereo3d.h"
 
 #include "avformat.h"
 
@@ -115,11 +116,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)
@@ -229,6 +230,51 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd)
     print_peak(ctx, "album peak", rg->album_peak);
 }
 
+static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
+{
+    AVStereo3D *stereo;
+
+    if (sd->size < sizeof(*stereo)) {
+        av_log(ctx, AV_LOG_INFO, "invalid data");
+        return;
+    }
+
+    stereo = (AVStereo3D *)sd->data;
+
+    switch (stereo->type) {
+    case AV_STEREO3D_2D:
+        av_log(ctx, AV_LOG_INFO, "2D");
+        break;
+    case AV_STEREO3D_SIDEBYSIDE:
+        av_log(ctx, AV_LOG_INFO, "side by side");
+        break;
+    case AV_STEREO3D_TOPBOTTOM:
+        av_log(ctx, AV_LOG_INFO, "top and bottom");
+        break;
+    case AV_STEREO3D_FRAMESEQUENCE:
+        av_log(ctx, AV_LOG_INFO, "frame alternate");
+        break;
+    case AV_STEREO3D_CHECKERBOARD:
+        av_log(ctx, AV_LOG_INFO, "checkerboard");
+        break;
+    case AV_STEREO3D_LINES:
+        av_log(ctx, AV_LOG_INFO, "interleaved lines");
+        break;
+    case AV_STEREO3D_COLUMNS:
+        av_log(ctx, AV_LOG_INFO, "interleaved columns");
+        break;
+    case AV_STEREO3D_SIDEBYSIDE_QUINCUNX:
+        av_log(ctx, AV_LOG_INFO, "side by side (quincunx subsampling)");
+        break;
+    default:
+        av_log(ctx, AV_LOG_WARNING, "unknown");
+        break;
+    }
+
+    if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
+        av_log(ctx, AV_LOG_INFO, " (inverted)");
+}
+
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
 {
     int i;
@@ -262,6 +308,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
             av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
                    av_display_rotation_get((int32_t *)sd.data));
             break;
+        case AV_PKT_DATA_STEREO3D:
+            av_log(ctx, AV_LOG_INFO, "stereo3d: ");
+            dump_stereo3d(ctx, &sd);
+            break;
         default:
             av_log(ctx, AV_LOG_WARNING,
                    "unknown side data type %d (%d bytes)", sd.type, sd.size);
@@ -282,7 +332,7 @@ static void dump_stream_format(AVFormatContext *ic, int i,
     AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
 
     avcodec_string(buf, sizeof(buf), st->codec, is_output);
-    av_log(NULL, AV_LOG_INFO, "    Stream #%d.%d", index, i);
+    av_log(NULL, AV_LOG_INFO, "    Stream #%d:%d", index, i);
 
     /* the pid is an important information, so we display it */
     /* XXX: add a generic system */
@@ -307,11 +357,17 @@ 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 (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 tbn = st->time_base.den && st->time_base.num;
+        int tbc = st->codec->time_base.den && st->codec->time_base.num;
+
+        if (fps || tbn || tbc)
+            av_log(NULL, AV_LOG_INFO, "\n      ");
+        if (fps)
+            print_fps(av_q2d(st->avg_frame_rate), tbn || tbc ? "fps, " : "fps");
+        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");
     }
 
@@ -390,7 +446,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,