shithub: openh264

Download patch

ref: dc59a7586f689ad1356dd3ca27ca01ad0658d028
parent: 3b01ce3f827b329ebd6be09243b1cdeddf9bdcbf
parent: a436676bc8b92e271daea1ea7c3191d956c7f6e3
author: sijchen <sijchen@cisco.com>
date: Tue Apr 21 04:55:42 EDT 2015

Merge pull request #1906 from mstorsjo/dll-res

Include the version number and other info in the built DLL file

diff: cannot open a/codec/decoder/plus/res//null: file does not exist: 'a/codec/decoder/plus/res//null' diff: cannot open a/codec/encoder/plus/res//null: file does not exist: 'a/codec/encoder/plus/res//null'
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 # Object files
 *.o
 *.obj
+*.res
 
 # Dependency files
 *.d
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@
 vpath %.cpp $(SRC_PATH)
 vpath %.asm $(SRC_PATH)
 vpath %.S $(SRC_PATH)
+vpath %.rc $(SRC_PATH)
 
 OS=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
 ARCH=$(shell uname -m)
@@ -76,6 +77,7 @@
     QUIET_CCAS = @printf "CCAS\t$@\n";
     QUIET_ASM = @printf "ASM\t$@\n";
     QUIET_AR  = @printf "AR\t$@\n";
+    QUIET_RC  = @printf "RC\t$@\n";
     QUIET     = @
 endif
 
@@ -148,7 +150,7 @@
 ifeq (android,$(OS))
 clean: clean_Android
 endif
-	$(QUIET)rm -f $(OBJS) $(OBJS:.$(OBJ)=.d) $(OBJS:.$(OBJ)=.obj) $(LIBRARIES) $(BINARIES) *.lib *.a *.dylib *.dll *.so *.exe *.pdb *.exp *.pc
+	$(QUIET)rm -f $(OBJS) $(OBJS:.$(OBJ)=.d) $(OBJS:.$(OBJ)=.obj) $(LIBRARIES) $(BINARIES) *.lib *.a *.dylib *.dll *.so *.exe *.pdb *.exp *.pc *.res
 
 gmp-bootstrap:
 	if [ ! -d gmp-api ] ; then git clone https://github.com/mozilla/gmp-api gmp-api ; fi
--- a/build/msvc-common.mk
+++ b/build/msvc-common.mk
@@ -44,3 +44,6 @@
 SHLDFLAGS=-pdb:$(PROJECT_NAME).pdb -def:openh264.def -implib:$(EXTRA_LIBRARY)
 STATIC_LDFLAGS=
 CODEC_UNITTEST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS
+
+%.res: %.rc
+	$(QUIET_RC)rc -nologo $<
--- a/build/platform-msvc.mk
+++ b/build/platform-msvc.mk
@@ -3,3 +3,4 @@
 CFLAGS_OPT += -MT
 CFLAGS_DEBUG += -MTd -Gm
 
+$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER): openh264.res
--- a/codec/build/generate_codec_ver.sh
+++ b/codec/build/generate_codec_ver.sh
@@ -27,8 +27,17 @@
 echo "#include \"codec_app_def.h\"" >>codec_ver.h
 echo "" >>codec_ver.h
 
-echo "static const OpenH264Version g_stCodecVersion  = {$1};"|tr '.' ',' >>codec_ver.h
-echo "static const char* const g_strCodecVer  = \"OpenH264 version:$1\";" >>codec_ver.h
+fullver="$1"
+major="${1%%.*}"
+tmp=${1#*.}
+minor="${tmp%%.*}"
+tmp=${tmp#*.}
+revnr="${tmp%%.*}"
+tmp=${tmp#*.}
+resnr="${tmp%%.*}"
+
+echo "static const OpenH264Version g_stCodecVersion  = {$major,$minor,$revnr,$resnr};" >>codec_ver.h
+echo "static const char* const g_strCodecVer  = \"OpenH264 version:$fullver\";" >>codec_ver.h
 #if [ "$2"x = ""x ]; then
 #echo "static const char* const g_strCodecBuildNum = \"OpenH264 revision:$revision\";" >> codec_ver.h
 #else
@@ -37,18 +46,17 @@
 echo "" >>codec_ver.h
 
 #define OPENH264_MAJOR 1, #define OPENH264_MINOR 2 #define OPENH264_REVISION 3 #define OPENH264_RESERVED 0
-echo "#define OPENH264_MAJOR (${1%%.*})" >>codec_ver.h
-
-tmp=${1#*.}
-echo "#define OPENH264_MINOR (${tmp%%.*})" >>codec_ver.h
-
-tmp=${tmp#*.}
-echo "#define OPENH264_REVISION (${tmp%%.*})" >>codec_ver.h
-
-tmp=${tmp#*.}
-echo "#define OPENH264_RESERVED (${tmp%%.*})" >>codec_ver.h
+echo "#define OPENH264_MAJOR ($major)" >>codec_ver.h
+echo "#define OPENH264_MINOR ($minor)" >>codec_ver.h
+echo "#define OPENH264_REVISION ($revnr)" >>codec_ver.h
+echo "#define OPENH264_RESERVED ($resnr)" >>codec_ver.h
 echo "" >>codec_ver.h
 
 echo "#endif  // CODEC_VER_H" >>codec_ver.h
 
 mv -f codec_ver.h ../api/svc/codec_ver.h
+
+# Ignore non-utf8 chars in the input
+export LC_ALL=C
+cat ../../openh264.rc.template | sed "s/\$MAJOR/$major/g" | sed "s/\$MINOR/$minor/g" | sed "s/\$REVISION/$revnr/g" | sed "s/\$RESERVED/$resnr/g" > openh264.rc.tmp
+mv openh264.rc.tmp ../../openh264.rc
--- a/codec/build/win32/dec/WelsDecPlus.vcproj
+++ b/codec/build/win32/dec/WelsDecPlus.vcproj
@@ -368,7 +368,7 @@
 			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
 			>
 			<File
-				RelativePath="..\..\..\decoder\plus\res\welsdec.rc"
+				RelativePath="..\..\..\..\openh264.rc"
 				>
 			</File>
 		</Filter>
--- a/codec/build/win32/enc/WelsEncPlus.vcproj
+++ b/codec/build/win32/enc/WelsEncPlus.vcproj
@@ -395,7 +395,7 @@
 			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
 			>
 			<File
-				RelativePath="..\..\..\encoder\plus\res\welsenc.rc"
+				RelativePath="..\..\..\..\openh264.rc"
 				>
 			</File>
 		</Filter>
--- a/codec/decoder/plus/res/resource.h
+++ /dev/null
@@ -1,15 +1,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by welsdec.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        101
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1000
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
--- a/codec/decoder/plus/res/welsdec.rc
+++ /dev/null
@@ -1,115 +1,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "windows.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Chinese (P.R.C.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
-#ifdef _WIN32
-LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
-#pragma code_page(936)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
-    "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
-    "#include ""windows.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-#endif    // Chinese (P.R.C.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,0,0
- PRODUCTVERSION 0,0,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "Comments", "Cisco OpenH264 decoder"
-            VALUE "CompanyName", "Cisco system"
-            VALUE "FileDescription", "Cisco OpenH264 decoder"
-            VALUE "FileVersion", "0, 0, 0, 0"
-            VALUE "InternalName", "welsdec.dll"
-            VALUE "LegalCopyright", "� 2011-2015 Cisco and/or its affiliates. All rights reserved."
-            VALUE "OriginalFilename", "welsdec.dll"
-            VALUE "ProductName", "Cisco OpenH264 decoder"
-            VALUE "ProductVersion", "0, 0, 0, 0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
--- a/codec/encoder/plus/res/resource.h
+++ /dev/null
@@ -1,15 +1,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by welsenc.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        101
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1000
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
--- a/codec/encoder/plus/res/welsenc.rc
+++ /dev/null
@@ -1,115 +1,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "windows.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Chinese (P.R.C.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
-#ifdef _WIN32
-LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
-#pragma code_page(936)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
-    "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
-    "#include ""windows.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-#endif    // Chinese (P.R.C.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,0,0
- PRODUCTVERSION 0,0,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "Comments", "Cisco OpenH264 H.264 (Wels)  encoder"
-            VALUE "CompanyName", "Cisco Systems"
-            VALUE "FileDescription", "Cisco OpenH264 H.264  encoder"
-            VALUE "FileVersion", "0, 0, 0, 0"
-            VALUE "InternalName", "welsenc.dll"
-            VALUE "LegalCopyright", "� 2011-2015 Cisco and/or its affiliates. All rights reserved."
-            VALUE "OriginalFilename", "welsenc.dll"
-            VALUE "ProductName", "Cisco OpenH264 H.264  encoder"
-            VALUE "ProductVersion", "0, 0, 0, 0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
--- /dev/null
+++ b/openh264.rc
@@ -1,0 +1,61 @@
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "windows.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,4,0,0
+ PRODUCTVERSION 1,4,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "Cisco OpenH264 codec"
+            VALUE "CompanyName", "Cisco Systems Inc."
+            VALUE "FileDescription", "Cisco OpenH264 codec"
+            VALUE "FileVersion", "1.4.0.0"
+            VALUE "InternalName", "openh264.dll"
+            VALUE "LegalCopyright", "� 2011-2015 Cisco and/or its affiliates. All rights reserved."
+            VALUE "OriginalFilename", "openh264.dll"
+            VALUE "ProductName", "Cisco OpenH264 codec"
+            VALUE "ProductVersion", "1.4.0.0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+++ b/openh264.rc.template
@@ -1,0 +1,61 @@
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "windows.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION $MAJOR,$MINOR,$REVISION,$RESERVED
+ PRODUCTVERSION $MAJOR,$MINOR,$REVISION,$RESERVED
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "Cisco OpenH264 codec"
+            VALUE "CompanyName", "Cisco Systems Inc."
+            VALUE "FileDescription", "Cisco OpenH264 codec"
+            VALUE "FileVersion", "$MAJOR.$MINOR.$REVISION.$RESERVED"
+            VALUE "InternalName", "openh264.dll"
+            VALUE "LegalCopyright", "� 2011-2015 Cisco and/or its affiliates. All rights reserved."
+            VALUE "OriginalFilename", "openh264.dll"
+            VALUE "ProductName", "Cisco OpenH264 codec"
+            VALUE "ProductVersion", "$MAJOR.$MINOR.$REVISION.$RESERVED"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////