oggdec: check stream index before using it in ogg_get_length()
[ffmpeg.git] / ffprobe.c
index e261db1..9bedbeb 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -65,7 +65,7 @@ static int show_private_data            = 1;
 
 static char *print_format;
 
-static const OptionDef options[];
+static const OptionDef *options;
 
 /* FFprobe context */
 static const char *input_filename;
@@ -1647,6 +1647,14 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
         if (s) print_str    ("sample_fmt", s);
         else   print_str_opt("sample_fmt", "unknown");
         print_int("nb_samples",         frame->nb_samples);
+        print_int("channels", av_frame_get_channels(frame));
+        if (av_frame_get_channel_layout(frame)) {
+            av_bprint_clear(&pbuf);
+            av_bprint_channel_layout(&pbuf, av_frame_get_channels(frame),
+                                     av_frame_get_channel_layout(frame));
+            print_str    ("channel_layout", pbuf.str);
+        } else
+            print_str_opt("channel_layout", "unknown");
         break;
     }
     show_tags(av_frame_get_metadata(frame));
@@ -1836,10 +1844,10 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     else                                print_str_opt("nb_read_frames", "N/A");
     if (nb_streams_packets[stream_idx]) print_fmt    ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
     else                                print_str_opt("nb_read_packets", "N/A");
-    show_tags(stream->metadata);
     if (do_show_data)
         writer_print_data(w, "extradata", dec_ctx->extradata,
                                           dec_ctx->extradata_size);
+    show_tags(stream->metadata);
 
     print_section_footer("stream");
     av_bprint_finalize(&pbuf, NULL);
@@ -2108,7 +2116,7 @@ static int opt_show_versions(const char *opt, const char *arg)
     return 0;
 }
 
-static const OptionDef options[] = {
+static const OptionDef real_options[] = {
 #include "cmdutils_common_opts.h"
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" },
     { "unit", OPT_BOOL, {(void*)&show_value_unit}, "show unit of the displayed values" },
@@ -2151,6 +2159,7 @@ int main(int argc, char **argv)
     int ret;
 
     av_log_set_flags(AV_LOG_SKIP_REPEATED);
+    options = real_options;
     parse_loglevel(argc, argv, options);
     av_register_all();
     avformat_network_init();