xref: /OK3568_Linux_fs/external/rockit/mpi/example/common/tmedia/test_comm_tmd.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2020 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "test_comm_tmd.h"
18 
19 #include "rk_common.h"
20 
21 #define SIZE_ARRAY_ELEMS(a)          (sizeof(a) / sizeof((a)[0]))
22 
23 typedef struct _rkCodecInfo {
24     RK_CODEC_ID_E enRkCodecId;
25     int enTmdCodecId;
26     char mine[16];
27 } CODEC_INFO;
28 
29 static CODEC_INFO gCodecMapList[] = {
30     { RK_VIDEO_ID_MPEG1VIDEO,    0,  "mpeg1" },
31 };
32 
TEST_COMM_CodecIDTmdToRK(RK_S32 s32Id)33 RK_S32 TEST_COMM_CodecIDTmdToRK(RK_S32 s32Id) {
34     RK_BOOL bFound = RK_FALSE;
35     RK_U32 i = 0;
36     for (i = 0; i < SIZE_ARRAY_ELEMS(gCodecMapList); i++) {
37         if (s32Id == gCodecMapList[i].enTmdCodecId) {
38             bFound = RK_TRUE;
39             break;
40         }
41     }
42 
43     if (bFound)
44         return gCodecMapList[i].enRkCodecId;
45     else
46         return RK_VIDEO_ID_Unused;
47 }
48 
mpi_tmedia_free(void * opaque)49 static RK_S32 mpi_tmedia_free(void *opaque) {
50     return 0;
51 }
52 
TEST_COMM_TmdParserOpen(const char * uri,STREAM_INFO_S * pstStreamInfo)53 RK_S32 TEST_COMM_TmdParserOpen(const char *uri, STREAM_INFO_S *pstStreamInfo) {
54     return RK_FAILURE;
55 }
56 
TEST_COMM_TmdParserRead(STREAM_INFO_S * pstStreamInfo,STREAM_DATA_S * pstStreamData)57 RK_S32 TEST_COMM_TmdParserRead(STREAM_INFO_S *pstStreamInfo, STREAM_DATA_S *pstStreamData) {
58     return RK_FAILURE;
59 }
60 
TEST_COMM_TmdParserClose(STREAM_INFO_S * pstStreamInfo)61 RK_S32 TEST_COMM_TmdParserClose(STREAM_INFO_S *pstStreamInfo) {
62     return RK_SUCCESS;
63 }
64 
65