[FFmpeg-devel] [RFC] print license and configuration for each lib

Måns Rullgård mans
Sun Nov 1 16:06:12 CET 2009


Diego Biurrun <diego at biurrun.de> writes:

> On Fri, Oct 30, 2009 at 08:54:16PM +0000, M?ns Rullg?rd wrote:
>> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
>> 
>> > On Fri, Oct 30, 2009 at 07:54:40PM +0000, M?ns Rullg?rd wrote:
>> >> Diego Biurrun <diego at biurrun.de> writes:
>> >> >> > Like I have done in $attached for libavcodec?  Anything else?
>> >> >> >
>> >> >> > +const char* avcodec_license(void)
>> >> >> > +{
>> >> >> > +    return "libavcodec license: " FFMPEG_LICENSE "\n";
>> >> >> > +}
>> >> >> 
>> >> >> Drop the "libfoo thing:" prefixes.  Whatever is using the string can
>> >> >> add those in a way that makes sense in its context.
>> >> >
>> >> > I agree that this would likely be more flexible, but note that I have a
>> >> > vested interest in seeing this exact string appear in the lib binary :)
>> >> 
>> >> Then return a pointer part-way into the string.
>> >
>> > Just in case it is not clear e.g.:
>> > #define LICENSEHDR "libavcodec license: "
>> > return LICENSEHDR FFMPEG_LICENSE + strlen(LICENSEHDR);
>> 
>> If you don't trust the compiler to optimise the strlen(), which I
>> dont, use sizeof(LICENSEHDR)-1.
>
> OK, here is a version that should be fit for inclusion.
>
> libavdevice/alldevices.c should probably be split into alldevices.c and
> avdevice.c or similar.
>
> Diego
>
> Index: libavutil/utils.c
> ===================================================================
> --- libavutil/utils.c	(Revision 20428)
> +++ libavutil/utils.c	(Arbeitskopie)
> @@ -16,6 +16,7 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>  
> +#include "config.h"
>  #include "avutil.h"
>  
>  /**
> @@ -27,3 +28,14 @@
>  {
>      return LIBAVUTIL_VERSION_INT;
>  }
> +
> +const char * avutil_configuration(void)
> +{
> +    return FFMPEG_CONFIGURATION;
> +}
> +
> +const char * avutil_license(void)
> +{
> +#define LICENSE_PREFIX "libavutil license: "
> +    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
> +}
> Index: libavutil/avutil.h
> ===================================================================
> --- libavutil/avutil.h	(Revision 20428)
> +++ libavutil/avutil.h	(Arbeitskopie)
> @@ -53,6 +53,16 @@
>   */
>  unsigned avutil_version(void);
>  
> +/**
> + * Prints the libavutil build-time configuration.

No, it doesn't.

> + */
> +const char * avutil_configuration(void);

Same error in all the doxy comments.

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



More information about the ffmpeg-devel mailing list