• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * cmodule.h, component module interface class
3  *
4  * Copyright (c) 2009-2010 Wind River Systems, Inc.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __CMODULE_H
20 #define __CMODULE_H
21 
22 #include <module.h>
23 
24 /*
25  * WRS OMX-IL Component Module Symbol
26  */
27 #define WRS_OMXIL_CMODULE_SYMBOL            WRS_OMXIL_CMODULE
28 #define WRS_OMXIL_CMODULE_SYMBOL_STRING     "WRS_OMXIL_CMODULE"
29 
30 struct wrs_omxil_cmodule_ops_s {
31     OMX_ERRORTYPE (*instantiate)(OMX_PTR *);
32 };
33 
34 struct wrs_omxil_cmodule_s {
35     const char *name;
36 
37     const char **roles;
38     const int nr_roles;
39 
40     struct wrs_omxil_cmodule_ops_s *ops;
41 };
42 
43 class ComponentBase;
44 
45 class CModule {
46  public:
47     CModule(const OMX_STRING lname);
48     ~CModule();
49 
50     /*
51      * library loading / unloading
52      */
53     OMX_ERRORTYPE Load(int flag);
54     OMX_U32 Unload(void);
55 
56     /* end of library loading / unloading */
57 
58     /*
59      * accessor
60      */
61     /* library name */
62     OMX_STRING GetLibraryName(void);
63 
64     /* component name and roles */
65     OMX_STRING GetComponentName(void);
66     OMX_ERRORTYPE GetComponentRoles(OMX_U32 *nr_roles, OMX_U8 **roles);
67 
68     bool QueryHavingThisRole(const OMX_STRING role);
69 
70     /* end of accessor */
71 
72     /* library symbol method and helpers */
73     OMX_ERRORTYPE QueryComponentNameAndRoles(void);
74     OMX_ERRORTYPE InstantiateComponent(ComponentBase **instance);
75 
76     /* end of library symbol method and helpers */
77 
78  private:
79     /*
80      * library symbol
81      */
82     struct wrs_omxil_cmodule_s *wrs_omxil_cmodule;
83 
84     /* end of library symbol */
85 
86     /* component name */
87     char cname[OMX_MAX_STRINGNAME_SIZE];
88 
89     /* component roles */
90     OMX_U8 **roles;
91     OMX_U32 nr_roles;
92 
93     /* library name */
94     char lname[OMX_MAX_STRINGNAME_SIZE];
95     /* utils::module */
96     struct module *module;
97 };
98 
99 #endif /* __CMODULE_H */
100