shithub: openh264

Download patch

ref: 333cf6aa976f6c9c632957696ffcbc84e6a189a5
parent: 0cafc565becf6e6b02abbdf0865960b65f8e3b21
author: huili2 <[email protected]>
date: Wed Jul 9 22:16:29 EDT 2014

version-generate

--- a/Makefile
+++ b/Makefile
@@ -114,7 +114,9 @@
 
 .PHONY: test gtest-bootstrap clean
 
-all:	libraries binaries
+all:	General_ver libraries binaries
+General_ver:
+	sh ./codec/common/generate_version.sh
 
 clean:
 ifeq (android,$(OS))
--- a/codec/build/iOS/dec/welsdec/welsdec.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/dec/welsdec/welsdec.xcodeproj/project.pbxproj
@@ -49,6 +49,7 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+		04FE0680196FD8BE0004D7CE /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = version.h; path = ../../../common/inc/version.h; sourceTree = "<group>"; };
 		4CBC1B80194AC4E100214D9E /* intra_pred_aarch64_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = intra_pred_aarch64_neon.S; path = arm64/intra_pred_aarch64_neon.S; sourceTree = "<group>"; };
 		4CE4427918B6FC360017DF25 /* libwelsdec.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwelsdec.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		4CE4427C18B6FC360017DF25 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -265,6 +266,7 @@
 		4CE4467C18BC5EAA0017DF25 /* inc */ = {
 			isa = PBXGroup;
 			children = (
+				04FE0680196FD8BE0004D7CE /* version.h */,
 				9AED66571946A1EB009A3567 /* welsCodecTrace.h */,
 				4CE4467E18BC5EAA0017DF25 /* welsDecoderExt.h */,
 			);
--- a/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
@@ -64,6 +64,7 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+		04FE0684196FD9370004D7CE /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = version.h; path = ../../../common/inc/version.h; sourceTree = "<group>"; };
 		4C23BC5F195A77E0003B81FC /* intra_pred_sad_3_opt_aarch64_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = intra_pred_sad_3_opt_aarch64_neon.S; path = arm64/intra_pred_sad_3_opt_aarch64_neon.S; sourceTree = "<group>"; };
 		4C34066618C57D0400DFA14A /* intra_pred_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = intra_pred_neon.S; sourceTree = "<group>"; };
 		4C34066718C57D0400DFA14A /* intra_pred_sad_3_opt_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = intra_pred_sad_3_opt_neon.S; sourceTree = "<group>"; };
@@ -347,6 +348,7 @@
 		4CE446FC18BC605C0017DF25 /* inc */ = {
 			isa = PBXGroup;
 			children = (
+				04FE0684196FD9370004D7CE /* version.h */,
 				9AED664819469FAF009A3567 /* welsCodecTrace.h */,
 				4CE446FE18BC605C0017DF25 /* welsEncoderExt.h */,
 			);
--- /dev/null
+++ b/codec/common/generate_version.sh
@@ -1,0 +1,20 @@
+#!/bin/bash
+rm -f codec/common/inc/version.h
+git rev-list HEAD | sort > config.git-hash
+LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
+if [ $LOCALVER \> 1 ] ; then
+    VER="$(git rev-list HEAD -n 1 | cut -c 1-7)"
+    if git status | grep -q "modified:" ; then
+        VER="${VER}+M"
+    fi
+    GIT_VERSION=$VER
+else
+    GIT_VERSION=
+    VER="x"
+fi
+GIT_VERSION='"'$GIT_VERSION'"'
+rm -f config.git-hash
+
+cat codec/common/inc/version.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > codec/common/inc/version.h
+
+echo "Generated codec/common/inc/version.h"
--- /dev/null
+++ b/codec/common/inc/version.h
@@ -1,0 +1,6 @@
+#ifndef VERSION_H
+#define VERSION_H
+
+#define VERSION_NUMBER "openh264 default: 1.1"
+
+#endif // VERSION_H
--- /dev/null
+++ b/codec/common/inc/version.h.template
@@ -1,0 +1,6 @@
+#ifndef VERSION_H
+#define VERSION_H
+
+#define VERSION_NUMBER $FULL_VERSION
+
+#endif // VERSION_H
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -46,6 +46,7 @@
 #include "typedefs.h"
 #include "mem_align.h"
 #include "utils.h"
+#include "version.h"
 
 //#include "macros.h"
 #include "decoder.h"
@@ -211,7 +212,7 @@
   if (NULL == m_pDecContext)
     return;
 
-  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder()..");
+  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder(), openh264 codec version = %s.", VERSION_NUMBER);
 
   WelsEndDecoder (m_pDecContext);
 
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -37,7 +37,7 @@
 #include "wels_const.h"
 #include "utils.h"
 #include "macros.h"
-
+#include "version.h"
 #include "crt_util_safe_x.h"	// Safe CRT routines like util for cross platforms
 #include "ref_list_mgr_svc.h"
 
@@ -174,7 +174,7 @@
   }
 
   m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
-
+  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::InitEncoder(), openh264 codec version = %s", VERSION_NUMBER);
 #ifdef REC_FRAME_COUNT
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
            "CWelsH264SVCEncoder::InitEncoder, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", m_uiCountFrameNum, m_iCspInternal);