shithub: openh264

Download patch

ref: 91574afca4d32a80a8f66794d85090fbe65c55eb
parent: 5b2469c0b5bff8c40a1960b17c920504cb4759bd
parent: e6134b5972005a9764c5766adeb178474c81556e
author: ruil2 <ruil2@cisco.com>
date: Thu Dec 18 12:33:29 EST 2014

Merge pull request #1603 from sijchen/add_ver1

add generating script and the first version of codec_ver.h

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -60,6 +60,19 @@
 #define UNSPECIFIED_BIT_RATE 0          ///< to do: add detail comment
 
 /**
+ * @brief Struct of OpenH264 version
+ */
+///
+/// E.g. SDK version is 1.2.0.0, major version number is 1, minor version number is 2, and revision number is 0.
+typedef struct  _tagVersion
+{
+  unsigned int uMajor;				///< The major version number
+  unsigned int uMinor;				///< The minor version number
+  unsigned int uRevision;				///< The revision number
+  unsigned int uReserved;				///< The reserved number, it should be 0.
+}Openh264Version;
+
+/**
 * @brief Decoding status
 */
 typedef enum {
--- /dev/null
+++ b/codec/api/svc/codec_ver.h
@@ -1,0 +1,15 @@
+//The current file is auto-generated by script: generate_codec_ver.sh
+#ifndef CODEC_VER_H
+#define CODEC_VER_H
+
+#include "codec_app_def.h"
+
+static const Openh264Version g_stCodecVersion  = {1,3,0,0};
+static const char* g_strCodecVer  = "Openh264 version:1.3.0.0";
+
+#define OPENH264_MAJOR (1)
+#define OPENH264_MINOR (3)
+#define OPENH264_REVISION (0)
+#define OPENH264_RESERVED (0)
+
+#endif  // CODEC_VER_H
--- /dev/null
+++ b/codec/build/generate_codec_ver.sh
@@ -1,0 +1,54 @@
+# Run this to update the codec_ver.h at changes of api
+
+#!/bin/sh
+#
+
+if [ "$1"x = ""x ]; then
+	echo "Please input the version number as : major_ver.minor_ver.patch.reserve"
+	exit 127
+fi
+
+codec_ver=`echo "$1" | egrep  "^([0-9]+[.]){3}[0-9]+$"`
+
+if [ $? -ne 0 ]; then
+	echo "Please input the version number as : major_ver.minor_ver.patch.reserve"
+	exit 127
+fi
+
+revision=`git show | head -n 1`
+revision=`echo $revision|cut -d' ' -f2|sed -e 's#[ ]*\(.*\)[ ]*#\1#'`
+revision=${revision:0:7}
+
+echo "//The current file is auto-generated by script: generate_codec_ver.sh" >>codec_ver.h
+echo "#ifndef CODEC_VER_H" >>codec_ver.h
+echo "#define CODEC_VER_H" >>codec_ver.h
+echo "" >>codec_ver.h
+
+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* g_strCodecVer  = \"Openh264 version:$1\";" >>codec_ver.h
+#if [ "$2"x = ""x ]; then
+#echo "static const char* g_strCodecBuildNum = \"Openh264 revision:$revision\";" >> codec_ver.h
+#else
+#echo "static const char* g_strCodecBuildNum = \"Openh264 build:$2, OpenH264 revision:$revision\";" >> codec_ver.h
+#fi
+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 "" >>codec_ver.h
+
+echo "#endif  // CODEC_VER_H" >>codec_ver.h
+
+mv -f codec_ver.h ../api/svc/codec_ver.h