[FFmpeg-devel] [RFC] print license and configuration for each lib
Stefano Sabatini
stefano.sabatini-lala
Fri Oct 30 19:20:38 CET 2009
On date Friday 2009-10-30 18:51:23 +0100, Diego Biurrun encoded:
> On Wed, Oct 28, 2009 at 06:59:11PM +0000, M?ns Rullg?rd wrote:
> > Diego Biurrun <diego at biurrun.de> writes:
> >
> > > Here's something I started and wanted to have some feedback on before I
> > > progress. Sometimes it can be useful to have the exact configuration
> > > and license string in each library and have it printed by each library.
> > >
> > > Here is a proof of concept patch that does it for libavutil and
> > > libavcodec. Once the chinks are worked out I can lather, rinse, repeat
> > > for the others.
> > >
> > > I made two alternative implementations, choose the one you prefer.
> > > Things that could possibly be improved (but might not be worth the
> > > trouble):
> > >
> > > - The licensing information for each library could be more detailed.
> > > For example, libavutil is always LGPL, even when FFmpeg was compiled
> > > in GPL mode.
> > > - Use a single function to perform the job.
> > >
> > > +void avutil_configuration(void)
> > > +{
> > > + const char* configuration = "libavutil configuration: " FFMPEG_CONFIGURATION;
> > > + av_log(NULL, AV_LOG_INFO, "%s\n", configuration);
> > > +}
> > > +
> > > +void avutil_license(void)
> > > +{
> > > + const char* libavutil_license = "libavutil license: "FFMPEG_LICENSE;
> > > + av_log(NULL, AV_LOG_INFO, "%s\n", libavutil_license);
> > > +}
> >
> > Returning the string would probably be more flexible.
>
> Like I have done in $attached for libavcodec? Anything else?
>
> Diego
> Index: configure
> ===================================================================
> --- configure (Revision 20419)
> +++ configure (Arbeitskopie)
> @@ -2751,6 +2751,7 @@
> echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
> echo "#define FFMPEG_CONFIG_H" >> $TMPH
> echo "#define FFMPEG_CONFIGURATION \"$(c_escape $FFMPEG_CONFIGURATION)\"" >> $TMPH
> +echo "#define FFMPEG_LICENSE \"$(c_escape $license)\"" >> $TMPH
> echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH
>
> echo "#define CC_TYPE \"$cc_type\"" >> $TMPH
> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h (Revision 20419)
> +++ libavcodec/avcodec.h (Arbeitskopie)
> @@ -3062,6 +3062,16 @@
> unsigned avcodec_version(void);
>
> /**
> + * Prints the libavcodec build-time configuration.
> + */
> +const char* avcodec_configuration(void);
Nit: "const char* " -> "const char *", here and below.
> +
> +/**
> + * Prints the libavcodec license.
> + */
> +const char* avcodec_license(void);
> +/**
> * Initializes libavcodec.
> *
> * @warning This function must be called before any other libavcodec
> Index: libavcodec/utils.c
> ===================================================================
> --- libavcodec/utils.c (Revision 20419)
> +++ libavcodec/utils.c (Arbeitskopie)
> @@ -924,6 +924,16 @@
> return LIBAVCODEC_VERSION_INT;
> }
>
> +const char* avcodec_configuration(void)
> +{
> + return "libavcodec configuration: " FFMPEG_CONFIGURATION "\n";
> +}
>
> +
> +const char* avcodec_license(void)
> +{
> + return "libavcodec license: " FFMPEG_LICENSE "\n";
> +}
>
> +
> void avcodec_init(void)
> {
> static int initialized = 0;
> Index: cmdutils.c
> ===================================================================
> --- cmdutils.c (Revision 20419)
> +++ cmdutils.c (Arbeitskopie)
> @@ -317,6 +317,8 @@
> {
> unsigned int version;
> PRINT_LIB_VERSION(outstream, avutil, AVUTIL, indent);
> + fprintf(stderr, avcodec_configuration());
> + fprintf(stderr, avcodec_license());
Why not to extend the PRINT_LIB_VERSION macro?
Then it could be renamed e.g. PRINT_LIB_INFO().
> PRINT_LIB_VERSION(outstream, avcodec, AVCODEC, indent);
> PRINT_LIB_VERSION(outstream, avformat, AVFORMAT, indent);
> PRINT_LIB_VERSION(outstream, avdevice, AVDEVICE, indent);
Anyway IMO would be better *before to apply this*, to work out some
way to provide per-library licensing information, rather than spit-out
wrong informations, e.g. lavu showing up a nonfree/GPL license.
Regards.
--
FFmpeg = Fiendish and Fostering Meaningless Powerful Ecletic God
More information about the ffmpeg-devel
mailing list