[FFmpeg-devel] [PATCH] ffprobe integration

Stefano Sabatini stefano.sabatini-lala
Sun Jan 3 17:49:37 CET 2010


On date Sunday 2010-01-03 01:23:25 +0100, Michael Niedermayer encoded:
> On Sun, Jan 03, 2010 at 12:21:20AM +0100, Stefano Sabatini wrote:
> [...]
> > +#undef exit
> > +#undef printf
> > +#undef fprintf
> 
> no chance
> new applications using libav* must be compileable without this hackery
> this is just a bad example

The simplest solution looks to me to do #undef HAVE_AV_CONFIG_H before
to include libav* headers, this way the inclusion of
libavutil/internal.h is inhibited, a better solution would be to
change the Makefiles in order to avoid to bestow the
-DHAVE_AV_CONFIH_H flag when compiling programs / test / example
files, I'd say to await for Mans before to try that (yes this would
allow to remove a bunch of ugly #undefs).

> > +
> > +const char program_name[] = "FFprobe";
> > +const int program_birth_year = 2007;
> > +
> > +/* globals */
> > +const OptionDef options[];
> > +
> > +/* FFprobe context */
> > +static const char *input_filename;
> > +static int value_string_flags = 0;
> > +static int do_show_format = 0;
> > +static int do_show_streams = 0;
> > +
> 
> > +const char *binary_unit_prefixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
> > +static const int binary_unit_prefixes_nb = FF_ARRAY_ELEMS(binary_unit_prefixes);
> > +
> > +const char *decimal_unit_prefixes[] = { "", "K", "M", "G", "T", "P" };
> > +static const int decimal_unit_prefixes_nb = FF_ARRAY_ELEMS(decimal_unit_prefixes);
> 
> dont we have this already somewhere?

Yes in libavcodec/eval.c, which is private.

> [...]
> > +    if (unit == UNIT_SECOND && flags & VALUE_STRING_USE_SEXAGESIMAL_TIME_FORMAT) {
> > +        int hours, mins, secs, usecs;
> > +        /* takes the 6 digits representing the microseconds and round */
> > +        usecs = (int)(round((val - floor(val)) * 1000000));
> > +        secs  = (int)val;
> > +        mins  = secs / 60;
> > +        secs %= 60;
> > +        hours = mins / 60;
> > +        mins %= 60;
> > +
> > +        snprintf(buf, buf_size, "%d:%02d:%02d.%06d", hours, mins, secs, usecs);
> 
> isnt there some formatting with %f possible for sec/usec?




More information about the ffmpeg-devel mailing list