]> git.sesse.net Git - ffmpeg/blobdiff - ffprobe.c
Merge commit '52567e8198669a1e7493c75771613f87a90466c3'
[ffmpeg] / ffprobe.c
index a7e329c107de025715fe4587b9d0e229f35e2c36..b9c37603848bcc5186cdf4ebb7bf057cc5260468 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -37,6 +37,7 @@
 #include "libavutil/hash.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/stereo3d.h"
 #include "libavutil/dict.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/libm.h"
@@ -1759,6 +1760,35 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
     return ret;
 }
 
+static void print_pkt_side_data(WriterContext *w,
+                                const AVPacketSideData *side_data,
+                                int nb_side_data,
+                                SectionID id_data_list,
+                                SectionID id_data)
+{
+    int i;
+
+    writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
+    for (i = 0; i < nb_side_data; i++) {
+        const AVPacketSideData *sd = &side_data[i];
+        const char *name = av_packet_side_data_name(sd->type);
+
+        writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA);
+        print_str("side_data_type", name ? name : "unknown");
+        print_int("side_data_size", sd->size);
+        if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
+            writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
+            print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
+        } else if (sd->type == AV_PKT_DATA_STEREO3D) {
+            const AVStereo3D *stereo = (AVStereo3D *)sd->data;
+            print_str("type", av_stereo3d_type_name(stereo->type));
+            print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
+        }
+        writer_print_section_footer(w);
+    }
+    writer_print_section_footer(w);
+}
+
 static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
 {
     char val_str[128];
@@ -1788,7 +1818,6 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
     print_fmt("flags", "%c",      pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
 
     if (pkt->side_data_elems) {
-        int i;
         int size;
         const uint8_t *side_metadata;
 
@@ -1799,20 +1828,10 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
                 show_tags(w, dict, SECTION_ID_PACKET_TAGS);
             av_dict_free(&dict);
         }
-        writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA_LIST);
-        for (i = 0; i < pkt->side_data_elems; i++) {
-            AVPacketSideData *sd = &pkt->side_data[i];
-            const char *name = av_packet_side_data_name(sd->type);
-            writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA);
-            print_str("side_data_type", name ? name : "unknown");
-            print_int("side_data_size", sd->size);
-            if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
-                writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
-                print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
-            }
-            writer_print_section_footer(w);
-        }
-        writer_print_section_footer(w);
+
+        print_pkt_side_data(w, pkt->side_data, pkt->side_data_elems,
+                            SECTION_ID_PACKET_SIDE_DATA_LIST,
+                            SECTION_ID_PACKET_SIDE_DATA);
     }
 
     if (do_show_data)
@@ -2357,22 +2376,9 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
         ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS);
 
     if (stream->nb_side_data) {
-        int i;
-        writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
-        for (i = 0; i < stream->nb_side_data; i++) {
-            AVPacketSideData *sd = &stream->side_data[i];
-            const char *name = av_packet_side_data_name(sd->type);
-
-            writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA);
-            print_str("side_data_type", name ? name : "unknown");
-            print_int("side_data_size", sd->size);
-            if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
-                writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
-                print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
-            }
-            writer_print_section_footer(w);
-        }
-        writer_print_section_footer(w);
+        print_pkt_side_data(w, stream->side_data, stream->nb_side_data,
+                            SECTION_ID_STREAM_SIDE_DATA_LIST,
+                            SECTION_ID_STREAM_SIDE_DATA);
     }
 
     writer_print_section_footer(w);