[FFmpeg-devel] [PATCH] Get avcodec configuration at runtime.

Måns Rullgård mans
Mon Jan 25 04:20:23 CET 2010


Ramiro Polla <ramiro.polla at gmail.com> writes:

> 2010/1/25 M?ns Rullg?rd <mans at mansr.com>:
>> Ramiro Polla <ramiro.polla at gmail.com> writes:
>>> On Thu, Jan 21, 2010 at 6:43 PM, Reinhard Tartler <siretart at tauware.de> wrote:
>>>> On Do, Jan 21, 2010 at 21:23:10 (CET), M?ns Rullg?rd wrote:
>>>>> Ramiro Polla <ramiro.polla at gmail.com> writes:
>>>>>> Currently cmdutils.c hardcodes FFMPEG_CONFIGURATION to print out in
>>>>>> the banner. This is a problem when someone updates libavcodec and
>>>>>> keeps the same ffmpeg executable. For example debian has different
>>>>>> libavcodec packages with different codecs enabled.
>>>>
>>>> That's ubuntu. debian (currently) allows only the crippled version.
>>>>
>>>>>> Attached patch makes cmdutils.c use avcodec_configuration(), but
>>>>>> that's not good also because people might have mixed libav* libraries
>>>>>> around.
>>>>>>
>>>>>> Suggestions welcome...
>>>>>
>>>>> Print all of them. ?To avoid ugly clutter we could check if they are
>>>>> all the same and print it only once if they are.
>>>>
>>>> sounds most usable.
>>>
>>> Patch attached.
>>>
>>> Index: cmdutils.c
>>> ===================================================================
>>> --- cmdutils.c ? ? ? ?(revision 21440)
>>> +++ cmdutils.c ? ? ? ?(working copy)
>>> @@ -352,7 +352,30 @@
>>> ? ? ? ? ? ? ?program_name, program_birth_year, this_year);
>>> ? ? ?fprintf(stderr, " ?built on %s %s with %s %s\n",
>>> ? ? ? ? ? ? ?__DATE__, __TIME__, CC_TYPE, CC_VERSION);
>>> + ? ?if (strcmp(avcodec_configuration(), avdevice_configuration()) ||
>>> +#if CONFIG_AVFILTER
>>> + ? ? ? ?strcmp(avcodec_configuration(), avfilter_configuration()) ||
>>> +#endif
>>> + ? ? ? ?strcmp(avcodec_configuration(), avformat_configuration()) ||
>>> + ? ? ? ?strcmp(avcodec_configuration(), avutil_configuration ?()) ||
>>> +#if CONFIG_POSTPROC
>>> + ? ? ? ?strcmp(avcodec_configuration(), postproc_configuration()) ||
>>> +#endif
>>> + ? ? ? ?strcmp(avcodec_configuration(), swscale_configuration ())) {
>>> + ? ? ? ?fprintf(stderr, " ?WARNING: library configurations are mismatched!\n");
>>> + ? ? ? ?fprintf(stderr, " ?avcodec ?configuration: %s\n", avcodec_configuration ());
>>> +#if CONFIG_AVFILTER
>>> + ? ? ? ?fprintf(stderr, " ?avfilter configuration: %s\n", avfilter_configuration());
>>> +#endif
>>> + ? ? ? ?fprintf(stderr, " ?avformat configuration: %s\n", avformat_configuration());
>>> + ? ? ? ?fprintf(stderr, " ?avutil ? configuration: %s\n", avutil_configuration ?());
>>> +#if CONFIG_POSTPROC
>>> + ? ? ? ?fprintf(stderr, " ?postproc configuration: %s\n", postproc_configuration());
>>> +#endif
>>> + ? ? ? ?fprintf(stderr, " ?swscale ?configuration: %s\n", swscale_configuration ());
>>> + ? ?} else {
>>> ? ? ?fprintf(stderr, " ?configuration: " FFMPEG_CONFIGURATION "\n");
>>> + ? ?}
>>> ? ? ?print_all_lib_versions(stderr, 1);
>>> ?}
>>
>> This is totally unreadable.
>
> I don't know what could make it much more readable, but new something attached.
>
> Index: cmdutils.c
> ===================================================================
> --- cmdutils.c	(revision 21440)
> +++ cmdutils.c	(working copy)
> @@ -352,7 +352,35 @@
>              program_name, program_birth_year, this_year);
>      fprintf(stderr, "  built on %s %s with %s %s\n",
>              __DATE__, __TIME__, CC_TYPE, CC_VERSION);
> +
> +    if (strcmp(avutil_configuration(), avcodec_configuration ()) ||
> +        strcmp(avutil_configuration(), avformat_configuration()) ||
> +        strcmp(avutil_configuration(), avdevice_configuration()) ||
> +#if CONFIG_AVFILTER
> +        strcmp(avutil_configuration(), avfilter_configuration()) ||
> +#endif
> +        strcmp(avutil_configuration(), swscale_configuration ()) ||
> +#if CONFIG_POSTPROC
> +        strcmp(avutil_configuration(), postproc_configuration()) ||
> +#endif
> +        )
> +    {
> +        fprintf(stderr, "  WARNING: library configurations are mismatched!\n");
> +        fprintf(stderr, "  avutil   configuration: %s\n", avutil_configuration  ());
> +        fprintf(stderr, "  avcodec  configuration: %s\n", avcodec_configuration ());
> +        fprintf(stderr, "  avformat configuration: %s\n", avformat_configuration());
> +        fprintf(stderr, "  avformat configuration: %s\n", avdevice_configuration());
> +#if CONFIG_AVFILTER
> +        fprintf(stderr, "  avfilter configuration: %s\n", avfilter_configuration());
> +#endif
> +        fprintf(stderr, "  swscale  configuration: %s\n", swscale_configuration ());
> +#if CONFIG_POSTPROC
> +        fprintf(stderr, "  postproc configuration: %s\n", postproc_configuration());
> +#endif
> +    } else {
>      fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
> +    }
> +
>      print_all_lib_versions(stderr, 1);
>  }

Is that supposed to be different?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list