[FFmpeg-cvslog] avprobe: print information from the codec descriptor

Anton Khirnov git at videolan.org
Mon Apr 11 17:01:45 CEST 2016


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jan 21 16:40:59 2016 +0100| [168a443d43b10ef6a3545d64b2f8bc90144ce4b7] | committer: Anton Khirnov

avprobe: print information from the codec descriptor

avprobe is not doing any decoding, so this is more correct than printing
information from a random codec implementation.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=168a443d43b10ef6a3545d64b2f8bc90144ce4b7
---

 avprobe.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/avprobe.c b/avprobe.c
index 3dd41bb..1fdcd01 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -600,7 +600,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
 {
     AVStream *stream = fmt_ctx->streams[stream_idx];
     AVCodecContext *dec_ctx;
-    const AVCodec *dec;
+    const AVCodecDescriptor *codec_desc;
     const char *profile;
     char val_str[128];
     AVRational display_aspect_ratio, *sar = NULL;
@@ -611,9 +611,10 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
     probe_int("index", stream->index);
 
     dec_ctx = stream->codec;
-    if ((dec = dec_ctx->codec)) {
-        probe_str("codec_name", dec->name);
-        probe_str("codec_long_name", dec->long_name);
+    codec_desc = avcodec_descriptor_get(dec_ctx->codec_id);
+    if (codec_desc) {
+        probe_str("codec_name", codec_desc->name);
+        probe_str("codec_long_name", codec_desc->long_name);
     } else {
         probe_str("codec_name", "unknown");
     }
@@ -630,7 +631,8 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
                                       dec_ctx->codec_tag));
 
     /* print profile, if there is one */
-    if (dec && (profile = av_get_profile_name(dec, dec_ctx->profile)))
+    profile = avcodec_profile_name(dec_ctx->codec_id, dec_ctx->profile);
+    if (profile)
         probe_str("profile", profile);
 
     switch (dec_ctx->codec_type) {



More information about the ffmpeg-cvslog mailing list