1 /****************************************************************************** 2 * 3 * Copyright (C) 2015 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 21 /** 22 ******************************************************************************* 23 * @file 24 * ih264e_version.c 25 * 26 * @brief 27 * Contains version info for H264 encoder 28 * 29 * @author 30 * ittiam 31 * 32 * @par List of Functions: 33 * - ih264e_get_version() 34 * 35 * @remarks 36 * None 37 * 38 ******************************************************************************* 39 */ 40 41 /*****************************************************************************/ 42 /* File Includes */ 43 /*****************************************************************************/ 44 /* system include files */ 45 #include <stdio.h> 46 #include <stddef.h> 47 #include <stdlib.h> 48 #include <string.h> 49 50 /* user include files */ 51 #include "ih264_typedefs.h" 52 #include "iv2.h" 53 #include "ive2.h" 54 #include "ih264e.h" 55 #include "ih264_defs.h" 56 #include "ih264_debug.h" 57 #include "ih264_structs.h" 58 #include "ih264e_version.h" 59 60 61 /*****************************************************************************/ 62 /* Constant Macros */ 63 /*****************************************************************************/ 64 65 /** 66 * Name of the codec and target platform (All Cortex A processors in this case) 67 */ 68 #define CODEC_NAME "H264ENC" 69 /** 70 * Codec release type, production or evaluation 71 */ 72 #define CODEC_RELEASE_TYPE "production" 73 /** 74 * Version string. First two digits signify major version and last two minor 75 */ 76 #define CODEC_RELEASE_VER "01.00" 77 /** 78 * Vendor name 79 */ 80 #define CODEC_VENDOR "ITTIAM" 81 82 #define MAX_STRLEN 511 83 /** 84 ******************************************************************************* 85 * Concatenates various strings to form a version string 86 ******************************************************************************* 87 */ 88 #ifdef __ANDROID__ 89 #define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor) \ 90 snprintf(version_string, MAX_STRLEN, \ 91 "@(#)Id:%s_%s Ver:%s Released by %s", \ 92 codec_name, codec_release_type, codec_release_ver, codec_vendor) 93 #else 94 #define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor) \ 95 snprintf(version_string, MAX_STRLEN, \ 96 "@(#)Id:%s_%s Ver:%s Released by %s Build: %s @ %s", \ 97 codec_name, codec_release_type, codec_release_ver, codec_vendor, __DATE__, __TIME__) 98 #endif 99 100 /*****************************************************************************/ 101 /* Function Definitions */ 102 /*****************************************************************************/ 103 104 /** 105 ******************************************************************************* 106 * 107 * @brief 108 * Fills the version info in the given char pointer 109 * 110 * @par Description: 111 * Fills the version info in the given char pointer 112 * 113 * @param[in] pc_version 114 * Pointer to hold version info 115 * 116 * @param[in] u4_version_bufsize 117 * Size of the buffer passed 118 * 119 * @returns error status 120 * 121 * @remarks none 122 * 123 ******************************************************************************* 124 */ 125 IV_STATUS_T ih264e_get_version(CHAR *pc_version, UWORD32 u4_version_bufsize) 126 { 127 CHAR ac_version_tmp[MAX_STRLEN]; 128 129 VERSION(ac_version_tmp, CODEC_NAME, CODEC_RELEASE_TYPE, CODEC_RELEASE_VER, 130 CODEC_VENDOR); 131 132 if (u4_version_bufsize >= (strlen(ac_version_tmp) + 1)) 133 { 134 memcpy(pc_version, ac_version_tmp, (strlen(ac_version_tmp) + 1)); 135 return IV_SUCCESS; 136 } 137 else 138 { 139 return IV_FAIL; 140 } 141 } 142