print svn version number in SEI info and in CLI/VfW.
authorLoren Merritt <pengvado@videolan.org>
Tue, 5 Apr 2005 20:39:47 +0000 (20:39 +0000)
committerLoren Merritt <pengvado@videolan.org>
Tue, 5 Apr 2005 20:39:47 +0000 (20:39 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@185 df754926-b1dd-0310-bc7b-ec298dee348c

Makefile
build/cygwin/Makefile
encoder/set.c
version.sh [new file with mode: 0755]
vfw/config.c
x264.c

index 6a5ce3e..b2a85d5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -91,18 +91,21 @@ checkasm: testing/checkasm.c libx264.a
 %.o: %.asm
        $(AS) $(ASFLAGS) -o $@ $<
 
-.depend: $(SRCS) x264.c
+.depend: $(SRCS) x264.c config.h
        rm -f .depend
 # Hacky - because gcc 2.9x doesn't have -MT
        $(foreach SRC, $(SRCS) x264.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
 
+config.h: $(wildcard .svn/entries */.svn/entries)
+       ./version.sh
+
 depend: .depend
 ifneq ($(wildcard .depend),)
 include .depend
 endif
 
 clean:
-       rm -f $(OBJS) $(OBJASM) *.a x264.o .depend x264 TAGS
+       rm -f $(OBJS) $(OBJASM) config.h *.a x264.o .depend x264 TAGS
 
 distclean: clean
 
index 630d2ee..70d7b8d 100644 (file)
@@ -98,6 +98,12 @@ $(DIR_BUILD):
        @mkdir -p $(DIR_BUILD)/$(@D)
        @$(CC) $(CFLAGS) -c -o $(DIR_BUILD)/$@ $<
 
+encoder/set.c: config.h
+config.h:
+       @echo " C: $@"
+       @cd $(DIR_SRC) && \
+       ./version.sh
+
 libx264.a: $(DIR_BUILD) $(OBJECTS)
        @echo " L: $(@F)"
        @cd $(DIR_BUILD) && \
@@ -118,7 +124,7 @@ checkasm.exe: $(DIR_BUILD) libx264.a $(OBJECTS) testing/checkasm.obj
 
 clean:
        @echo " Cl: Object files and target lib"
-       @$(RM) $(DIR_BUILD)
+       @$(RM) $(DIR_BUILD) $(DIR_SRC)/config.h
 
 install: x264.exe
        install x264.h $(DIR_INSTALL)/include/
index a729238..e9a5e3c 100644 (file)
@@ -35,6 +35,7 @@
 #include "x264.h"
 #include "common/bs.h"
 #include "common/set.h"
+#include "config.h"
 
 void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
 {
@@ -403,8 +404,8 @@ void x264_sei_version_write( bs_t *s )
     };
     char version[256];
     int length;
-    sprintf( version, "x264 - core %d - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html",
-             X264_BUILD );
+    sprintf( version, "x264 - core %d%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html",
+             X264_BUILD, X264_VERSION );
     length = strlen(version)+1+16;
 
     bs_write( s, 8, 0x5 ); // payload_type = user_data_unregistered
diff --git a/version.sh b/version.sh
new file mode 100755 (executable)
index 0000000..ca88c8d
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+VER=`svnversion .`
+if [[ $VER && $VER != exported ]]
+then echo "#define X264_VERSION \" svn-$VER\"" > config.h
+else echo "#define X264_VERSION \"\"" > config.h
+fi
index e6dee61..0e9a8cd 100644 (file)
@@ -31,6 +31,7 @@
  **************************************************************************/
 
 #include "x264vfw.h"
+#include "config.h"
 #include <stdio.h>  /* sprintf */
 #include <commctrl.h>
 
@@ -470,7 +471,7 @@ BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
     case WM_INITDIALOG :
     {
         char temp[1024];
-        sprintf( temp, "Core %d, build %s %s", X264_BUILD, __DATE__, __TIME__ );
+        sprintf( temp, "Core %d%s, build %s %s", X264_BUILD, X264_VERSION, __DATE__, __TIME__ );
         SetDlgItemText( hDlg, IDC_BUILD,  temp );
         break;
     }
diff --git a/x264.c b/x264.c
index 525d494..1e5d6e5 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -43,6 +43,7 @@
 #endif
 
 #include "common/common.h"
+#include "config.h"
 #include "x264.h"
 
 #define DATA_MAX 3000000
@@ -124,8 +125,8 @@ int main( int argc, char **argv )
 static void Help( x264_param_t *defaults )
 {
     fprintf( stderr,
-             "x264 build:%d\n"
-             "Syntax: x264 [options] [-o out.h26l] in.yuv widthxheigh\n"
+             "x264 build:%d%s\n"
+             "Syntax: x264 [options] [-o out.264] in.yuv widthxheigh\n"
              "\n"
              "  -h, --help                  Print this help\n"
              "\n"
@@ -185,7 +186,7 @@ static void Help( x264_param_t *defaults )
              "      --quiet                 Quiet Mode\n"
              "  -v, --verbose               Print stats for each frame\n"
              "\n",
-            X264_BUILD,
+            X264_BUILD, X264_VERSION,
             defaults->i_keyint_max,
             defaults->i_keyint_min,
             defaults->i_scenecut_threshold,