1# Run this to update the codec_ver.h at changes of api 2 3#!/bin/sh 4# 5 6if [ "$1"x = ""x ]; then 7 echo "Please input the version number as: major_ver.minor_ver.patch.reserve" 8 exit 127 9fi 10 11codec_ver=`echo "$1" | egrep "^([0-9]+[.]){3}[0-9]+$"` 12 13if [ $? -ne 0 ]; then 14 echo "Please input the version number as: major_ver.minor_ver.patch.reserve" 15 exit 127 16fi 17 18revision=`git show | head -n 1` 19revision=`echo $revision|cut -d' ' -f2|sed -e 's#[ ]*\(.*\)[ ]*#\1#'` 20revision=${revision:0:7} 21 22echo "//The current file is auto-generated by script: generate_codec_ver.sh" >>codec_ver.h 23echo "#ifndef CODEC_VER_H" >>codec_ver.h 24echo "#define CODEC_VER_H" >>codec_ver.h 25echo "" >>codec_ver.h 26 27echo "#include \"codec_app_def.h\"" >>codec_ver.h 28echo "" >>codec_ver.h 29 30fullver="$1" 31major="${1%%.*}" 32tmp=${1#*.} 33minor="${tmp%%.*}" 34tmp=${tmp#*.} 35revnr="${tmp%%.*}" 36tmp=${tmp#*.} 37resnr="${tmp%%.*}" 38 39echo "static const OpenH264Version g_stCodecVersion = {$major, $minor, $revnr, $resnr};" >>codec_ver.h 40echo "static const char* const g_strCodecVer = \"OpenH264 version:$fullver\";" >>codec_ver.h 41#if [ "$2"x = ""x ]; then 42#echo "static const char* const g_strCodecBuildNum = \"OpenH264 revision:$revision\";" >> codec_ver.h 43#else 44#echo "static const char* const g_strCodecBuildNum = \"OpenH264 build:$2, OpenH264 revision:$revision\";" >> codec_ver.h 45#fi 46echo "" >>codec_ver.h 47 48#define OPENH264_MAJOR 1, #define OPENH264_MINOR 2 #define OPENH264_REVISION 3 #define OPENH264_RESERVED 0 49echo "#define OPENH264_MAJOR ($major)" >>codec_ver.h 50echo "#define OPENH264_MINOR ($minor)" >>codec_ver.h 51echo "#define OPENH264_REVISION ($revnr)" >>codec_ver.h 52echo "#define OPENH264_RESERVED ($resnr)" >>codec_ver.h 53echo "" >>codec_ver.h 54 55echo "#endif // CODEC_VER_H" >>codec_ver.h 56 57mv -f codec_ver.h ../api/svc/codec_ver.h 58 59# Ignore non-utf8 chars in the input 60export LC_ALL=C 61cat ../../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 62mv openh264.rc.tmp ../../openh264.rc 63