xref: /OK3568_Linux_fs/external/mpp/mpp/codec/rc/rc_impl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2016 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 #ifndef __RC_IMPL_H__
18 #define __RC_IMPL_H__
19 
20 #include "mpp_list.h"
21 #include "mpp_rc_api.h"
22 
23 #define MAX_RC_API_COUNT        32
24 
25 #ifdef __cplusplus
26 
27 class RcImplApiService
28 {
29 private:
30     // avoid any unwanted function
31     RcImplApiService();
32     ~RcImplApiService();
33     RcImplApiService(const RcImplApiService &);
34     RcImplApiService &operator=(const RcImplApiService &);
35 
36     RK_U32              mApiCount;
37 
38     struct list_head    mApis;
39 
40 public:
get_instance()41     static RcImplApiService *get_instance() {
42         static RcImplApiService instance;
43         AutoMutex auto_lock(get_lock());
44         return &instance;
45     }
get_lock()46     static Mutex *get_lock() {
47         static Mutex lock;
48         return &lock;
49     }
50 
51     MPP_RET     api_add(const RcImplApi *api);
52     RcImplApi   *api_get(MppCodingType type, const char *name);
53 
54     MPP_RET     api_get_all(RcApiBrief *brief, RK_S32 *count, RK_S32 max_count);
55     MPP_RET     api_get_by_type(RcApiBrief *brief, RK_S32 *count,
56                                 RK_S32 max_count, MppCodingType type);
57 };
58 
59 #endif
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif /* __RC_IMPL_H__ */
70