[FFmpeg-devel] Implement missing av*_version() functions

Michael Niedermayer michaelni
Tue Aug 5 03:28:24 CEST 2008


On Sun, Aug 03, 2008 at 07:53:36PM +0200, Stefano Sabatini wrote:
> On date Sunday 2008-08-03 19:02:40 +0200, Diego Biurrun encoded:
> > On Sun, Aug 03, 2008 at 06:56:18PM +0200, Stefano Sabatini wrote:
> > > On date Sunday 2008-08-03 17:00:47 +0200, Michael Niedermayer encoded:
> > > > On Sun, Aug 03, 2008 at 04:49:05PM +0200, Diego Biurrun wrote:
> > > [...]
> > > > > What is the problem with mixing the version of the headers and of the
> > > > > linked library anyway?  Do I understand correctly that it is for the
> > > > > case where ffmpeg/ffplay/ffserver is dynamically linked and the version
> > > > > of the linked libs differs from the version of the headers used to
> > > > > compile the binary?
> > > > 
> > > > yes, its kinda usefull for bugreports where the user has several libs and
> > > > by mistake linked to the wrong one.
> > > > 
> > > > > And thus ideally there should be a _version() function for every single
> > > > > library?
> > > > 
> > > > yes
> > > 
> > > partly based on some patches by Andreas ?man.
> > 
> > I was about to implement this, you beat me to it, nice :)
> 
> :)
> 
> > > --- libavutil/Makefile	(revision 14521)
> > > +++ libavutil/Makefile	(working copy)
> > > @@ -21,6 +21,7 @@
> > >         sha1.o \
> > >         string.o \
> > >         tree.o \
> > > +       utils.o
> > 
> > Add a backslash, this makes adding new entries easier.
> 
> Fixed.
> 
> > > --- libavdevice/Makefile	(revision 14521)
> > > +++ libavdevice/Makefile	(working copy)
> > > @@ -5,7 +5,8 @@
> > >  
> > > -OBJS    = alldevices.o
> > > +OBJS    = alldevices.o \
> > > +          utils.o
> > 
> > ditto
> 
> Fixed.
> 
> > > --- cmdutils.c	(revision 14521)
> > > +++ cmdutils.c	(working copy)
> > > @@ -223,7 +223,7 @@
> > >             "libavcodec  %d\n"
> > >             "libavformat %d\n"
> > >             "libavdevice %d\n",
> > > -           LIBAVUTIL_BUILD, avcodec_version(), LIBAVFORMAT_BUILD, LIBAVDEVICE_BUILD);
> > > +           avutil_version(), avcodec_version(), avformat_version(), avdevice_version());
> > What about show_banner()?
> 
> I think that we should change somehow the behaviour here, maybe we
> could avoid to print the various compile-time libav* versions in
> show_banner(), which may be deduced anyway from the SVN revision number,
> but print both compile-time and link-time/run-time versions in
> show_version().
> 
> Also I'd like to use human-readable version forms in show_version(),
> anyway this is another thread...
> 
> While I was at it I also added an avfilter_version() patch.
> 
> Regards.
> -- 
> FFmpeg = Frenzy and Freak Magic Proud Evanescent Gospel

> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h	(revision 14521)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -2527,8 +2527,13 @@
>  #endif
>  AVCodec *av_codec_next(AVCodec *c);
>  
> -/* returns LIBAVCODEC_VERSION_INT constant */
> +/**
> + * Get the libavcodec version as determined at link-time, or at runtime
> + * for dynamic linking.
> + * @return the LIBAVCODEC_VERSION_INT constant
> + */

rejected


>  unsigned avcodec_version(void);
> +
>  #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
>  /* returns LIBAVCODEC_BUILD constant */
>  attribute_deprecated unsigned avcodec_build(void);

> Index: libavformat/avformat.h
> ===================================================================
> --- libavformat/avformat.h	(revision 14521)
> +++ libavformat/avformat.h	(working copy)
> @@ -22,7 +22,7 @@
>  #define FFMPEG_AVFORMAT_H
>  
>  #define LIBAVFORMAT_VERSION_MAJOR 52
> -#define LIBAVFORMAT_VERSION_MINOR 18
> +#define LIBAVFORMAT_VERSION_MINOR 19
>  #define LIBAVFORMAT_VERSION_MICRO  0
>  
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

ok


> @@ -35,6 +35,13 @@
>  
>  #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
>  
> +/**
> + * Get the libavformat version as determined at link-time, or at runtime
> + * for dynamic linking.
> + * @return the LIBAVFORMAT_VERSION_INT constant
> + */

no


> +unsigned avformat_version(void);
> +
>  #include <time.h>
>  #include <stdio.h>  /* FILE */
>  #include "libavcodec/avcodec.h"
> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c	(revision 14521)
> +++ libavformat/utils.c	(working copy)
> @@ -71,6 +71,11 @@
>      format->next = NULL;
>  }
>  
> +unsigned avformat_version(void)
> +{
> +  return LIBAVFORMAT_VERSION_INT;
> +}
> +
>  int match_ext(const char *filename, const char *extensions)
>  {
>      const char *ext, *p;

ok



> Index: libavfilter/avfilter.h
> ===================================================================
> --- libavfilter/avfilter.h	(revision 14521)
> +++ libavfilter/avfilter.h	(working copy)
> @@ -23,7 +23,7 @@
>  #define FFMPEG_AVFILTER_H
>  
>  #define LIBAVFILTER_VERSION_MAJOR  0
> -#define LIBAVFILTER_VERSION_MINOR  0
> +#define LIBAVFILTER_VERSION_MINOR  1
>  #define LIBAVFILTER_VERSION_MICRO  0
>  
>  #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

not ok yet, as depends on rejected parts


> @@ -37,6 +37,13 @@
>  #include <stddef.h>
>  #include "libavcodec/avcodec.h"
>  
> +/**
> + * Get the libavfilter version as determined at link-time, or at runtime
> + * for dynamic linking.
> + * @return the LIBAVFILTER_VERSION_INT constant
> + */

no


> +unsigned avfilter_version(void);
> +
>  typedef struct AVFilterContext AVFilterContext;
>  typedef struct AVFilterLink    AVFilterLink;
>  typedef struct AVFilterPad     AVFilterPad;

ok


> Index: libavfilter/utils.c
> ===================================================================
> --- libavfilter/utils.c	(revision 0)
> +++ libavfilter/utils.c	(revision 0)
> @@ -0,0 +1,28 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#include "avfilter.h"
> +
> +/**
> + * @file libavfilter/utils.c
> + * various utility functions
> + */
> +
> +unsigned avfilter_version(void)
> +{
> +  return LIBAVFILTER_VERSION_INT;
> +}
> Index: libavfilter/Makefile
> ===================================================================
> --- libavfilter/Makefile	(revision 14521)
> +++ libavfilter/Makefile	(working copy)
> @@ -9,6 +9,7 @@
>         avfilter.o \
>         defaults.o \
>         formats.o \
> +       utils.o \
>  
>  #OBJS-$(CONFIG_XXX_FILTER)    += vf_xxx.o
>  

no, there surely is another file that can be used, we dont need a new one
just for this 1 line function


> Index: libavutil/avutil.h
> ===================================================================
> --- libavutil/avutil.h	(revision 14521)
> +++ libavutil/avutil.h	(working copy)
> @@ -35,7 +35,7 @@
>  #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
>  
>  #define LIBAVUTIL_VERSION_MAJOR 49
> -#define LIBAVUTIL_VERSION_MINOR  7
> +#define LIBAVUTIL_VERSION_MINOR  8
>  #define LIBAVUTIL_VERSION_MICRO  0
>  
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

not ok due to rejected dependancy


> @@ -48,6 +48,12 @@
>  
>  #define LIBAVUTIL_IDENT         "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
>  
> +/**
> + * Get the libavutil version as determined at link-time, or at runtime
> + * for dynamic linking.
> + * @return the LIBAVUTIL_VERSION_INT constant
> + */

no


> +unsigned avutil_version(void);

ok

>  
>  #include "common.h"
>  #include "mathematics.h"
> Index: libavutil/utils.c
> ===================================================================
> --- libavutil/utils.c	(revision 0)
> +++ libavutil/utils.c	(revision 0)
> @@ -0,0 +1,28 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#include "avutil.h"
> +
> +/**
> + * @file libavutil/utils.c
> + * various utility functions
> + */
> +
> +unsigned avutil_version(void)
> +{
> +  return LIBAVUTIL_VERSION_INT;
> +}
> Index: libavutil/Makefile
> ===================================================================
> --- libavutil/Makefile	(revision 14521)
> +++ libavutil/Makefile	(working copy)
> @@ -21,6 +21,7 @@
>         sha1.o \
>         string.o \
>         tree.o \
> +       utils.o \
>  
>  HEADERS = adler32.h \
>            avstring.h \

no


> Index: libavdevice/avdevice.h
> ===================================================================
> --- libavdevice/avdevice.h	(revision 14521)
> +++ libavdevice/avdevice.h	(working copy)
> @@ -19,8 +19,10 @@
>  #ifndef FFMPEG_AVDEVICE_H
>  #define FFMPEG_AVDEVICE_H
>  
> +#include "libavutil/avutil.h"
> +

no


>  #define LIBAVDEVICE_VERSION_MAJOR 52
> -#define LIBAVDEVICE_VERSION_MINOR  0
> +#define LIBAVDEVICE_VERSION_MINOR  1
>  #define LIBAVDEVICE_VERSION_MICRO  0
>  
>  #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
> @@ -32,6 +34,13 @@
>  #define LIBAVDEVICE_BUILD       LIBAVDEVICE_VERSION_INT
>  
>  /**
> + * Get the libavdevice version as determined at link-time, or at runtime
> + * for dynamic linking.
> + * @return the LIBAVDEVICE_VERSION_INT constant
> + */

no


> +unsigned avdevice_version(void);

ok


> +
> +/**
>   * Initialize libavdevice and register all the input and output devices.
>   * @warning This function is not thread safe.
>   */
> Index: libavdevice/utils.c
> ===================================================================
> --- libavdevice/utils.c	(revision 0)
> +++ libavdevice/utils.c	(revision 0)
> @@ -0,0 +1,29 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "avdevice.h"
> +
> +/**
> + * @file libavdevice/utils.c
> + * various utility functions
> + */
> +
> +unsigned avdevice_version(void)
> +{
> +  return LIBAVDEVICE_VERSION_INT;
> +}
> Index: libavdevice/Makefile
> ===================================================================
> --- libavdevice/Makefile	(revision 14521)
> +++ libavdevice/Makefile	(working copy)
> @@ -5,7 +5,8 @@
>  
>  HEADERS = avdevice.h
>  
> -OBJS    = alldevices.o
> +OBJS    = alldevices.o \
> +          utils.o \

no


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080805/ada3ca3c/attachment.pgp>



More information about the ffmpeg-devel mailing list