]> git.sesse.net Git - x264/commitdiff
Add --disable-gpl option to configure
authorJames Darnley <james.darnley@gmail.com>
Fri, 17 Sep 2010 11:06:59 +0000 (04:06 -0700)
committerFiona Glaser <fiona@x264.com>
Sun, 19 Sep 2010 01:18:00 +0000 (18:18 -0700)
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.

Makefile
configure
filters/video/video.c
x264.c

index 0f4d0cf7456eba902a0f12135b3a0b442fa05365..bab55e546e7497485c53aae24cab689fd6034658 100644 (file)
--- 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
index 21f5166b53bc8e7df76343f4493e7ddb526f3e00..1ad2b579cb7fe41a124e14f19de8e16bbfeac2b8 100755 (executable)
--- 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
index 2ee239f4f69381d4afa745e34d807bc77d0dc8b0..61dc8c6c929be90ac4e2054fe7bde04364c709b2 100644 (file)
@@ -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 ab499005478d8b64352ac7e628f78d07c3232d52..d9239c70a3505c4c17c66150d22bea040665204b 100644 (file)
--- 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 );