[FFmpeg-devel] [PATCH] ffprobe: print is_avc for H.264

Michael Niedermayer michaelni at gmx.at
Thu Nov 3 15:32:07 CET 2011


On Thu, Nov 03, 2011 at 01:27:39AM +0100, Michael Niedermayer wrote:
> On Wed, Nov 02, 2011 at 09:37:55PM +0100, Stefano Sabatini wrote:
> > On date Wednesday 2011-11-02 18:58:15 +0100, Michael Niedermayer encoded:
> > > See attachment
> > > the h264.c part needed for this will be in git in a moment
> > > 
> > > -- 
> > > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > > 
> > > The real ebay dictionary, page 2
> > > "100% positive feedback" - "All either got their money back or didnt complain"
> > > "Best seller ever, very honest" - "Seller refunded buyer after failed scam"
> > 
> > > From 2ec0de491875cf5a227a22edd51ee8ff6ef55b2b Mon Sep 17 00:00:00 2001
> > > From: Michael Niedermayer <michaelni at gmx.at>
> > > Date: Wed, 2 Nov 2011 18:38:53 +0100
> > > Subject: [PATCH] ffprobe: print is_avc for H.264
> > > 
> > > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > > ---
> > >  ffprobe.c |    3 +++
> > >  1 files changed, 3 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/ffprobe.c b/ffprobe.c
> > > index 470001c..eb28364 100644
> > > --- a/ffprobe.c
> > > +++ b/ffprobe.c
> > > @@ -696,6 +696,9 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
> > >              }
> > >              print_str("pix_fmt", av_x_if_null(av_get_pix_fmt_name(dec_ctx->pix_fmt), "unknown"));
> > >              print_int("level",   dec_ctx->level);
> > 
> > > +            if(dec_ctx->codec_id == CODEC_ID_H264 && dec_ctx->codec->priv_class){
> > > +                print_int("is_avc", av_get_int(dec_ctx->priv_data, "is_avc", NULL));
> > > +            }
> > 
> > I'm not really fond of exposing private data in this crude way, but
> > since a more generic implementation may require time and/or result
> > completely overkill, I assume it is fine if you have a sensible use
> > case for this.
> > Extra karma points if you might avoid the if(..){ style weirdness.
> 
> ill think about writing a more generic solution, if i loose interrest
> ill commit this 

heres a more generic solution: (ill commit in a day if no objections)

commit 1a7de74db47a9915a150f668aa69fb418b540c97
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Thu Nov 3 15:26:42 2011 +0100

    ffprobe: Print format specific variables of codecs.

    Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

diff --git a/ffprobe.c b/ffprobe.c
index 470001c..a3ae794 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -709,6 +709,17 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     } else {
         print_str("codec_type", "unknown");
     }
+    if(dec_ctx->codec && dec_ctx->codec->priv_class){
+        AVOption *opt=NULL;
+        while(opt=av_opt_next(dec_ctx->priv_data,opt)){
+            uint8_t *str;
+            if(opt->flags) continue;
+            if(av_opt_get(dec_ctx->priv_data, opt->name, 0, &str)>=0){
+                print_str(opt->name, str);
+                av_free(str);
+            }
+        }
+    }

     if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS)
         print_fmt("id", "0x%x", stream->id);


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111103/139593e0/attachment.asc>


More information about the ffmpeg-devel mailing list