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 of 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
45 /* System Include Files */
46 #include <stdio.h>
47 #include <stddef.h>
48 #include <stdlib.h>
49 #include <string.h>
50
51 /* User Include Files */
52 #include "ih264_typedefs.h"
53 #include "iv2.h"
54 #include "ih264e_version.h"
55
56
57 /*****************************************************************************/
58 /* Constant Macros */
59 /*****************************************************************************/
60
61 /**
62 * Name of the codec and target platform (All Cortex A processors in this case)
63 */
64 #define CODEC_NAME "H264ENC"
65 /**
66 * Codec release type, production or evaluation
67 */
68 #define CODEC_RELEASE_TYPE "production"
69 /**
70 * Version string. First two digits signify major version and last two minor
71 */
72 #define CODEC_RELEASE_VER "01.02"
73 /**
74 * Vendor name
75 */
76 #define CODEC_VENDOR "ITTIAM"
77
78 #define MAX_STRLEN 511
79 /**
80 *******************************************************************************
81 * Concatenates various strings to form a version string
82 *******************************************************************************
83 */
84 #ifdef ANDROID
85 #define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor) \
86 snprintf(version_string, MAX_STRLEN, \
87 "@(#)Id:%s_%s Ver:%s Released by %s", \
88 codec_name, codec_release_type, codec_release_ver, codec_vendor)
89 #else
90 #define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor) \
91 snprintf(version_string, MAX_STRLEN, \
92 "@(#)Id:%s_%s Ver:%s Released by %s Build: %s @ %s", \
93 codec_name, codec_release_type, codec_release_ver, codec_vendor, __DATE__, __TIME__)
94 #endif
95
96 /*****************************************************************************/
97 /* Function Definitions */
98 /*****************************************************************************/
99
100 /**
101 *******************************************************************************
102 *
103 * @brief
104 * Fills the version info in the given char pointer
105 *
106 * @par Description:
107 * Fills the version info in the given char pointer
108 *
109 * @param[in] pc_version
110 * Pointer to hold version info
111 *
112 * @param[in] u4_version_bufsize
113 * Size of the buffer passed
114 *
115 * @returns error status
116 *
117 * @remarks none
118 *
119 *******************************************************************************
120 */
ih264e_get_version(CHAR * pc_version,UWORD32 u4_version_bufsize)121 IV_STATUS_T ih264e_get_version(CHAR *pc_version, UWORD32 u4_version_bufsize)
122 {
123 CHAR ac_version_tmp[MAX_STRLEN];
124
125 VERSION(ac_version_tmp, CODEC_NAME, CODEC_RELEASE_TYPE, CODEC_RELEASE_VER,
126 CODEC_VENDOR);
127
128 if (u4_version_bufsize >= (strlen(ac_version_tmp) + 1))
129 {
130 memcpy(pc_version, ac_version_tmp, (strlen(ac_version_tmp) + 1));
131 return IV_SUCCESS;
132 }
133 else
134 {
135 return IV_FAIL;
136 }
137 }
138