aboutsummaryrefslogtreecommitdiff
path: root/base/inc/cmodule.h
blob: 439ca62ad34ca4b1b81c46665171ce5d9afe1476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * cmodule.h, component module interface class
 *
 * Copyright (c) 2009-2010 Wind River Systems, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __CMODULE_H
#define __CMODULE_H

#include <module.h>

/*
 * WRS OMX-IL Component Module Symbol
 */
#define WRS_OMXIL_CMODULE_SYMBOL            WRS_OMXIL_CMODULE
#define WRS_OMXIL_CMODULE_SYMBOL_STRING     "WRS_OMXIL_CMODULE"

struct wrs_omxil_cmodule_ops_s {
    OMX_ERRORTYPE (*instantiate)(OMX_PTR *);
};

struct wrs_omxil_cmodule_s {
    const char *name;

    const char **roles;
    const int nr_roles;

    struct wrs_omxil_cmodule_ops_s *ops;
};

class ComponentBase;

class CModule {
 public:
    CModule(const OMX_STRING lname);
    ~CModule();

    /*
     * library loading / unloading
     */
    OMX_ERRORTYPE Load(int flag);
    OMX_U32 Unload(void);

    /* end of library loading / unloading */

    /*
     * accessor
     */
    /* library name */
    OMX_STRING GetLibraryName(void);

    /* component name and roles */
    OMX_STRING GetComponentName(void);
    OMX_ERRORTYPE GetComponentRoles(OMX_U32 *nr_roles, OMX_U8 **roles);

    bool QueryHavingThisRole(const OMX_STRING role);

    /* end of accessor */

    /* library symbol method and helpers */
    OMX_ERRORTYPE QueryComponentNameAndRoles(void);
    OMX_ERRORTYPE InstantiateComponent(ComponentBase **instance);

    /* end of library symbol method and helpers */

 private:
    /*
     * library symbol
     */
    struct wrs_omxil_cmodule_s *wrs_omxil_cmodule;

    /* end of library symbol */

    /* component name */
    char cname[OMX_MAX_STRINGNAME_SIZE];

    /* component roles */
    OMX_U8 **roles;
    OMX_U32 nr_roles;

    /* library name */
    char lname[OMX_MAX_STRINGNAME_SIZE];
    /* utils::module */
    struct module *module;
};

#endif /* __CMODULE_H */