1/******************************************************************************
2*
3* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
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/**
19*******************************************************************************
20* @file
21*  ihevcd_version.c
22*
23* @brief
24*  Contains version info for HEVC decoder
25*
26* @author
27*  Harish
28*
29* @par List of Functions:
30* - ihevcd_get_version()
31*
32* @remarks
33*  None
34*
35*******************************************************************************
36*/
37/*****************************************************************************/
38/* File Includes                                                             */
39/*****************************************************************************/
40#include <stdio.h>
41#include <stddef.h>
42#include <stdlib.h>
43#include <string.h>
44
45#include "ihevc_typedefs.h"
46#include "iv.h"
47#include "ivd.h"
48#include "ihevcd_cxa.h"
49
50#include "ihevc_defs.h"
51#include "ihevc_debug.h"
52#include "ihevc_structs.h"
53/**
54 * Name of the codec
55 */
56#define CODEC_NAME              "HEVCDEC"
57/**
58 * Codec release type, production or evaluation
59 */
60#define CODEC_RELEASE_TYPE      "production"
61/**
62 * Version string. First two digits signify major version and last two minor
63 * Increment major version for API change or major feature update
64 */
65#define CODEC_RELEASE_VER       "05.00"
66/**
67 * Vendor name
68 */
69#define CODEC_VENDOR            "ITTIAM"
70
71/**
72*******************************************************************************
73* Concatenates various strings to form a version string
74*******************************************************************************
75*/
76#define MAXVERSION_STRLEN       511
77#ifdef __ANDROID__
78#define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor)    \
79    snprintf(version_string, MAXVERSION_STRLEN,                                                     \
80             "@(#)Id:%s_%s Ver:%s Released by %s",                                                  \
81             codec_name, codec_release_type, codec_release_ver, codec_vendor)
82#else
83#define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor)    \
84    snprintf(version_string, MAXVERSION_STRLEN,                                                     \
85             "@(#)Id:%s_%s Ver:%s Released by %s Build: %s @ %s",                                   \
86             codec_name, codec_release_type, codec_release_ver, codec_vendor, __DATE__, __TIME__)
87#endif
88
89/**
90*******************************************************************************
91*
92* @brief
93*  Fills the version info in the given string
94*
95* @par Description:
96*
97*
98* @param[in] pc_version_string
99*  Pointer to hold version info
100*
101* @param[in] u4_version_buffer_size
102*  Size of the buffer passed
103*
104* @returns  Status
105*
106* @remarks
107*
108*
109*******************************************************************************
110*/
111IV_API_CALL_STATUS_T ihevcd_get_version(CHAR *pc_version_string,
112                                        UWORD32 u4_version_buffer_size)
113{
114    CHAR ac_version_tmp[MAXVERSION_STRLEN + 1];
115    UWORD32 u4_len;
116    VERSION(ac_version_tmp, CODEC_NAME, CODEC_RELEASE_TYPE, CODEC_RELEASE_VER, CODEC_VENDOR);
117    u4_len = strnlen(ac_version_tmp, MAXVERSION_STRLEN) + 1;
118    if(u4_version_buffer_size >= u4_len)
119    {
120        memcpy(pc_version_string, ac_version_tmp, u4_len);
121        return IV_SUCCESS;
122    }
123    else
124    {
125        return IV_FAIL;
126    }
127
128}
129
130
131