[FFmpeg-devel] [PATCH] ffprobe integration

Stefano Sabatini stefano.sabatini-lala
Mon Feb 15 00:59:13 CET 2010


On date Sunday 2010-02-14 23:31:11 +0100, Michael Niedermayer encoded:
> On Sun, Feb 14, 2010 at 07:19:16PM +0100, Stefano Sabatini wrote:
[...]
> > Dropped opt.c use, flags and enum for units.
> 
> great now its 339 lines instead of 416
> 
> 
> [...]
> 
> > +#define UNIT_NONE_STR            ""
> > +#define UNIT_SECOND_STR          "s"
> > +#define UNIT_HERTZ_STR           "Hz"
> > +#define UNIT_BIT_STR             "bit"
> > +#define UNIT_BYTE_STR            "byte"
> > +#define UNIT_BIT_PER_SECOND_STR  "bit/s"
> > +#define UNIT_BYTE_PER_SECOND_STR "byte/s"
> 
> static const char *unit_none_str=""
> ...
> would allow you to compare for == and avoid the strcmp

Fine.

> [...]
> > +static char *time_value_string(char *buf, int buf_size, int64_t val, AVRational *time_base)
> > +{
> 
> > +    if (val == AV_NOPTS_VALUE)
> > +        snprintf(buf, buf_size, "N/A");
> > +    else
> 
> {}

Done.

> [...]
> 
> > +        /* output avi tags */
> > +        a = isprint(a = dec_ctx->codec_tag     & 0xff) ? a : '_';
> > +        b = isprint(b = dec_ctx->codec_tag>>8  & 0xff) ? b : '_';
> > +        c = isprint(c = dec_ctx->codec_tag>>16 & 0xff) ? c : '_';
> > +        d = isprint(d = dec_ctx->codec_tag>>24 & 0xff) ? d : '_';
> 
> obfuscated

Deobfuscated.
Also I changed how it prints the unprintable characters, it should
help to make more intelligible some fourcc, e.g.:
RGB_ -> RGB[15]

> > +        printf("codec_tag_string=%c%c%c%c\n", a, b, c, d);
> > +        printf("codec_tag=0x%04x\n", dec_ctx->codec_tag);
> > +
> > +        switch (dec_ctx->codec_type) {
> > +        case CODEC_TYPE_VIDEO:
> > +            printf("width=%d\n",                   dec_ctx->width);
> > +            printf("height=%d\n",                  dec_ctx->height);
> > +            printf("has_b_frames=%d\n",            dec_ctx->has_b_frames);
> > +            printf("sample_aspect_ratio=%d:%d\n",  dec_ctx->sample_aspect_ratio.num,
> > +                                                   dec_ctx->sample_aspect_ratio.den);
> > +            printf("display_aspect_ratio=%d:%d\n", dec_ctx->sample_aspect_ratio.num,
> > +                                                   dec_ctx->sample_aspect_ratio.den);
> > +            printf("pix_fmt=%s\n",                 av_pix_fmt_descriptors[dec_ctx->pix_fmt].name);
> > +            break;
> > +
> > +        case CODEC_TYPE_AUDIO:
> > +            printf("sample_rate=%s\n",             value_string(val_str, sizeof(val_str),
> > +                                                                (double)dec_ctx->sample_rate,
> 
> useless cast
> 
> 
> > +                                                                UNIT_HERTZ_STR));
> > +            printf("channels=%d\n",                dec_ctx->channels);
> > +            printf("bits_per_sample=%d\n",         av_get_bits_per_sample(dec_ctx->codec_id));
> > +            break;
> > +
> 
> > +        default:
> > +            break;
> 
> useless

Removed.

Regards.
-- 
FFmpeg = Freak & Fostering Mega Problematic Ecumenical Ghost
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-ffprobe.patch
Type: text/x-diff
Size: 17296 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100215/de1984ba/attachment.patch>



More information about the ffmpeg-devel mailing list