Showing the changes to codec/encoder/core/src/property.cpp (1 of 308 files). Show all
Unified · Split
| @@ -0,0 +1,149 @@ | |||
| 1 | /*! | ||
| 2 | * \copy | ||
| 3 | * Copyright (c) 2009-2013, Cisco Systems | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * | ||
| 13 | * * Redistributions in binary form must reproduce the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer in | ||
| 15 | * the documentation and/or other materials provided with the | ||
| 16 | * distribution. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 29 | * POSSIBILITY OF SUCH DAMAGE. | ||
| 30 | * | ||
| 31 | * | ||
| 32 | * \file property.c | ||
| 33 | * | ||
| 34 | * \brief CODE name, library module and corresponding version are included | ||
| 35 | * | ||
| 36 | * \date 03/10/2009 Created | ||
| 37 | * | ||
| 38 | ************************************************************************************* | ||
| 39 | */ | ||
| 40 | #include <string.h> | ||
| 41 | #include <stdlib.h> | ||
| 42 | #include "property.h" | ||
| 43 | #include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms | ||
| 44 | namespace WelsSVCEnc { | ||
| 45 | #define WELS_CODE_NAME "Wels" | ||
| 46 | #define WELS_LIB_NAME "Encoder" | ||
| 47 | |||
| 48 | #define WELS_VERSION_INT 0x000001 // v 0.0.1 | ||
| 49 | #define WELS_VERSION_STR "0.0.1" | ||
| 50 | |||
| 51 | #define WELS_BUILD_NUM "090420" // yymmdd | ||
| 52 | |||
| 53 | //////////////summary information////////////// | ||
| 54 | |||
| 55 | #define WELS_IDENT WELS_CODE_NAME WELS_LIB_NAME "v" WELS_VERSION_STR "b" WELS_BUILD_NUM | ||
| 56 | |||
| 57 | /*! | ||
| 58 | * \brief get code name | ||
| 59 | * \param pBuf pBuffer to restore code name | ||
| 60 | * \param iSize size of pBuffer overall | ||
| 61 | * \return actual size of pBuffer used; 0 returned in failure | ||
| 62 | */ | ||
| 63 | int32_t GetCodeName(str_t *pBuf, int32_t iSize) | ||
| 64 | { | ||
| 65 | int32_t iLen = 0; | ||
| 66 | |||
| 67 | if ( NULL == pBuf ) | ||
| 68 | return 0; | ||
| 69 | |||
| 70 | iLen = STRNLEN( WELS_CODE_NAME, 4 ); // confirmed_safe_unsafe_usage | ||
| 71 | if ( iSize <= iLen ) | ||
| 72 | return 0; | ||
| 73 | |||
| 74 | pBuf[iLen] = '\0'; | ||
| 75 | STRNCPY( pBuf, iSize, WELS_CODE_NAME, iLen); // confirmed_safe_unsafe_usage | ||
| 76 | |||
| 77 | return iLen; | ||
| 78 | } | ||
| 79 | |||
| 80 | /*! | ||
| 81 | * \brief get library/module name | ||
| 82 | * \param pBuf pBuffer to restore module name | ||
| 83 | * \param iSize size of pBuffer overall | ||
| 84 | * \return actual size of pBuffer used; 0 returned in failure | ||
| 85 | */ | ||
| 86 | int32_t GetLibName(str_t *pBuf, int32_t iSize) | ||
| 87 | { | ||
| 88 | int32_t iLen = 0; | ||
| 89 | |||
| 90 | if ( NULL == pBuf ) | ||
| 91 | return 0; | ||
| 92 | |||
| 93 | iLen = STRNLEN( WELS_LIB_NAME, 7 ); // confirmed_safe_unsafe_usage | ||
| 94 | if ( iSize <= iLen ) | ||
| 95 | return 0; | ||
| 96 | |||
| 97 | pBuf[iLen] = '\0'; | ||
| 98 | STRNCPY( pBuf, iSize, WELS_LIB_NAME, iLen ); // confirmed_safe_unsafe_usage | ||
| 99 | |||
| 100 | return iLen; | ||
| 101 | } | ||
| 102 | |||
| 103 | /*! | ||
| 104 | * \brief get version number | ||
| 105 | * \param pBuf pBuffer to restore version number | ||
| 106 | * \param iSize size of pBuffer overall | ||
| 107 | * \return actual size of pBuffer used; 0 returned in failure | ||
| 108 | */ | ||
| 109 | int32_t GetVerNum(str_t *pBuf, int32_t iSize) | ||
| 110 | { | ||
| 111 | int32_t iLen = 0; | ||
| 112 | |||
| 113 | if ( NULL == pBuf ) | ||
| 114 | return 0; | ||
| 115 | |||
| 116 | iLen = STRNLEN( WELS_VERSION_STR, 5 ); // confirmed_safe_unsafe_usage | ||
| 117 | if ( iSize <= iLen ) | ||
| 118 | return 0; | ||
| 119 | |||
| 120 | pBuf[iLen] = '\0'; | ||
| 121 | STRNCPY( pBuf, iSize, WELS_VERSION_STR, iLen ); // confirmed_safe_unsafe_usage | ||
| 122 | |||
| 123 | return iLen; | ||
| 124 | } | ||
| 125 | |||
| 126 | /*! | ||
| 127 | * \brief get identify information | ||
| 128 | * \param pBuf pBuffer to restore indentify information | ||
| 129 | * \param iSize size of pBuffer overall | ||
| 130 | * \return actual size of pBuffer used; 0 returned in failure | ||
| 131 | */ | ||
| 132 | int32_t GetIdentInfo(str_t *pBuf, int32_t iSize) | ||
| 133 | { | ||
| 134 | int32_t iLen = 0; | ||
| 135 | |||
| 136 | if ( NULL == pBuf ) | ||
| 137 | return 0; | ||
| 138 | |||
| 139 | iLen = STRNLEN( WELS_IDENT, 30 ); // confirmed_safe_unsafe_usage | ||
| 140 | if ( iSize <= iLen ) | ||
| 141 | return 0; | ||
| 142 | |||
| 143 | pBuf[iLen] = '\0'; | ||
| 144 | STRNCPY( pBuf, iSize, WELS_IDENT, iLen ); // confirmed_safe_unsafe_usage | ||
| 145 | |||
| 146 | return iLen; | ||
| 147 | } | ||
| 148 | |||
| 149 | } // namespace WelsSVCEnc | ||