From b780e711dd0a1e97535c690f84e9726eefa95c2c Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Tue, 5 Apr 2005 20:39:47 +0000 Subject: [PATCH] print svn version number in SEI info and in CLI/VfW. git-svn-id: svn://svn.videolan.org/x264/trunk@185 df754926-b1dd-0310-bc7b-ec298dee348c --- Makefile | 7 +++++-- build/cygwin/Makefile | 8 +++++++- encoder/set.c | 5 +++-- version.sh | 6 ++++++ vfw/config.c | 3 ++- x264.c | 7 ++++--- 6 files changed, 27 insertions(+), 9 deletions(-) create mode 100755 version.sh diff --git a/Makefile b/Makefile index 6a5ce3ee..b2a85d5c 100644 --- 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 diff --git a/build/cygwin/Makefile b/build/cygwin/Makefile index 630d2eef..70d7b8dd 100644 --- a/build/cygwin/Makefile +++ b/build/cygwin/Makefile @@ -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/ diff --git a/encoder/set.c b/encoder/set.c index a7292384..e9a5e3ca 100644 --- a/encoder/set.c +++ b/encoder/set.c @@ -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 index 00000000..ca88c8d0 --- /dev/null +++ b/version.sh @@ -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 diff --git a/vfw/config.c b/vfw/config.c index e6dee61e..0e9a8cd0 100644 --- a/vfw/config.c +++ b/vfw/config.c @@ -31,6 +31,7 @@ **************************************************************************/ #include "x264vfw.h" +#include "config.h" #include /* sprintf */ #include @@ -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 525d494c..1e5d6e5a 100644 --- 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, -- 2.47.3