xref: /rockchip-linux_mpp/mpp/codec/rc/test/rc_api_test.c (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2015 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 #define MODULE_TAG "mpp_api_test"
18 
19 #include <stdlib.h>
20 
21 #include "mpp_log.h"
22 #include "mpp_rc_api.h"
23 
24 #define MAX_QUERY_COUNT     16
25 
26 const RcImplApi test_h264_api = {
27     "test_h264e_rc",
28     MPP_VIDEO_CodingAVC,
29     0,
30     NULL,
31     NULL,
32     NULL,
33     NULL,
34     NULL,
35     NULL,
36     NULL,
37     NULL,
38 };
39 
40 const RcImplApi test_h265_api = {
41     "test_h265e_rc",
42     MPP_VIDEO_CodingHEVC,
43     0,
44     NULL,
45     NULL,
46     NULL,
47     NULL,
48     NULL,
49     NULL,
50     NULL,
51     NULL,
52 };
53 
main()54 int main()
55 {
56     RcApiQueryAll query;
57     RcApiBrief briefs[MAX_QUERY_COUNT];
58     RK_S32 i;
59 
60     mpp_log("rc api test start\n");
61 
62     query.brief = briefs;
63     query.max_count = MAX_QUERY_COUNT;
64     query.count = 0;
65 
66     rc_brief_get_all(&query);
67 
68     mpp_log("default rc api query result:\n");
69     for (i = 0; i < query.count; i++)
70         mpp_log("rc api %s type %x\n", briefs[i].name, briefs[i].type);
71 
72     mpp_log("add test rc api\n");
73 
74     rc_api_add(&test_h264_api);
75     rc_api_add(&test_h265_api);
76 
77     rc_brief_get_all(&query);
78 
79     mpp_log("rc api query result after adding\n");
80     for (i = 0; i < query.count; i++)
81         mpp_log("rc api %s type %x\n", briefs[i].name, briefs[i].type);
82 
83     mpp_log("mpp rc api test done\n");
84 
85     return 0;
86 }
87 
88