[x264-devel] commit: Add --disable-gpl option to configure (James Darnley )
git at videolan.org
git at videolan.org
Sun Sep 19 03:19:54 CEST 2010
x264 | branch: master | James Darnley <james.darnley at gmail.com> | Fri Sep 17 04:06:59 2010 -0700| [fa56d4e4720e39dbfad881cd81937f39efd83b7f] | committer: Jason Garrett-Glaser
Add --disable-gpl option to configure
Used for commercially-licensed versions of x264.
Doesn't currently change anything, but may be used to disable GPL-only CLI tools, such as video filters, in the future.
Also print the x264 license and libavformat license in version info.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=fa56d4e4720e39dbfad881cd81937f39efd83b7f
---
Makefile | 5 +++++
configure | 15 +++++++++++++++
filters/video/video.c | 2 ++
x264.c | 45 +++++++++++++++++++++++++++++++++------------
4 files changed, 55 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 0f4d0cf..bab55e5 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,11 @@ SRCSO =
CONFIG := $(shell cat config.h)
+# GPL-only files
+ifeq ($(GPL),yes)
+SRCCLI +=
+endif
+
# Optional module sources
ifneq ($(findstring HAVE_AVS, $(CONFIG)),)
SRCCLI += input/avs.c
diff --git a/configure b/configure
index 21f5166..1ad2b57 100755
--- a/configure
+++ b/configure
@@ -11,6 +11,7 @@ echo " --disable-avs disables avisynth support (windows only)"
echo " --disable-lavf disables libavformat support"
echo " --disable-ffms disables ffmpegsource support"
echo " --disable-gpac disables gpac support"
+echo " --disable-gpl disables GPL-only features"
echo " --disable-pthread disables multithreaded encoding"
echo " --disable-swscale disables swscale support"
echo " --disable-asm disables platform-specific assembly optimizations"
@@ -138,6 +139,7 @@ avs="auto"
lavf="auto"
ffms="auto"
gpac="auto"
+gpl="yes"
pthread="auto"
swscale="auto"
asm="auto"
@@ -192,6 +194,9 @@ for opt do
--disable-gpac)
gpac="no"
;;
+ --disable-gpl)
+ gpl="no"
+ ;;
--extra-asflags=*)
ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
;;
@@ -709,6 +714,12 @@ fi
define BIT_DEPTH $bit_depth
+if [ $gpl = yes ]; then
+ define HAVE_GPL 1
+else
+ define HAVE_GPL 0
+fi
+
rm -f conftest*
# generate config files
@@ -734,6 +745,7 @@ EXE=$EXE
VIS=$vis
HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
DEVNULL=$DEVNULL
+GPL=$gpl
EOF
if [ "$shared" = "yes" ]; then
@@ -776,7 +788,9 @@ Cflags: -I$includedir
EOF
filters="crop select_every"
+gpl_filters=""
[ $swscale = yes ] && filters="resize $filters"
+[ $gpl = yes ] && filters="$filters $gpl_filters"
cat > conftest.log <<EOF
Platform: $ARCH
@@ -786,6 +800,7 @@ avs: $avs
lavf: $lavf
ffms: $ffms
gpac: $gpac
+gpl: $gpl
pthread: $pthread
filters: $filters
debug: $debug
diff --git a/filters/video/video.c b/filters/video/video.c
index 2ee239f..61dc8c6 100644
--- a/filters/video/video.c
+++ b/filters/video/video.c
@@ -51,6 +51,8 @@ void x264_register_vid_filters()
REGISTER_VFILTER( fix_vfr_pts );
REGISTER_VFILTER( resize );
REGISTER_VFILTER( select_every );
+#if HAVE_GPL
+#endif
}
int x264_init_vid_filter( const char *name, hnd_t *handle, cli_vid_filter_t *filter,
diff --git a/x264.c b/x264.c
index 6eca53c..a1e7147 100644
--- a/x264.c
+++ b/x264.c
@@ -49,6 +49,8 @@
#endif
#if HAVE_LAVF
+#undef DECLARE_ALIGNED
+#include <libavformat/avformat.h>
#include <libavutil/pixfmt.h>
#include <libavutil/pixdesc.h>
#endif
@@ -199,6 +201,36 @@ void x264_cli_printf( int i_level, const char *fmt, ... )
va_end( arg );
}
+static void print_version_info()
+{
+#ifdef X264_POINTVER
+ printf( "x264 "X264_POINTVER"\n" );
+#else
+ printf( "x264 0.%d.X\n", X264_BUILD );
+#endif
+ printf( "built on " __DATE__ ", " );
+#ifdef __GNUC__
+ printf( "gcc: " __VERSION__ "\n" );
+#else
+ printf( "using a non-gcc compiler\n" );
+#endif
+ printf( "configuration: --bit-depth=%d\n", BIT_DEPTH );
+ printf( "x264 license: " );
+#if HAVE_GPL
+ printf( "GPL version 2 or later\n" );
+#else
+ printf( "Non-GPL commercial\n" );
+#endif
+#if HAVE_LAVF
+ const char *license = avformat_license();
+ printf( "libavformat license: %s\n", license );
+ if( !strcmp( license, "nonfree and unredistributable" ) ||
+ (!HAVE_GPL && (!strcmp( license, "GPL version 2 or later" )
+ || !strcmp( license, "GPL version 3 or later" ))))
+ printf( "WARNING: This binary is unredistributable!\n" );
+#endif
+}
+
/****************************************************************************
* main:
****************************************************************************/
@@ -1153,18 +1185,7 @@ static int Parse( int argc, char **argv, x264_param_t *param, cli_opt_t *opt )
Help( &defaults, 2 );
exit(0);
case 'V':
-#ifdef X264_POINTVER
- printf( "x264 "X264_POINTVER"\n" );
-#else
- printf( "x264 0.%d.X\n", X264_BUILD );
-#endif
- printf( "built on " __DATE__ ", " );
-#ifdef __GNUC__
- printf( "gcc: " __VERSION__ "\n" );
-#else
- printf( "using a non-gcc compiler\n" );
-#endif
- printf( "configuration: --bit-depth=%d\n", BIT_DEPTH );
+ print_version_info();
exit(0);
case OPT_FRAMES:
param->i_frame_total = X264_MAX( atoi( optarg ), 0 );
More information about the x264-devel
mailing list