1/*
2Copyright (c) 2012, Broadcom Europe Ltd
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the copyright holder nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28/** \file
29 * OpenMAX IL adaptation layer for MMAL - Parameters related functions
30 */
31
32#ifndef MMALOMX_UTIL_PARAMS_H
33#define MMALOMX_UTIL_PARAMS_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/** The structure that all OMX parameters containing a port start with */
40typedef struct MMALOMX_PARAM_OMX_HEADER_T
41{
42 OMX_U32 nSize;
43 OMX_VERSIONTYPE nVersion;
44 OMX_U32 nPortIndex;
45} MMALOMX_PARAM_OMX_HEADER_T;
46
47/** The structure that all OMX parameters without a port start with */
48typedef struct MMALOMX_PARAM_OMX_HEADER_PORTLESS_T
49{
50 OMX_U32 nSize;
51 OMX_VERSIONTYPE nVersion;
52} MMALOMX_PARAM_OMX_HEADER_PORTLESS_T;
53
54typedef enum {
55 MMALOMX_PARAM_MAPPING_TO_MMAL,
56 MMALOMX_PARAM_MAPPING_TO_OMX
57} MMALOMX_PARAM_MAPPING_DIRECTION;
58
59typedef struct MMALOMX_PARAM_ENUM_TRANSLATE_T {
60 uint32_t mmal;
61 uint32_t omx;
62} MMALOMX_PARAM_ENUM_TRANSLATE_T;
63
64typedef enum MMALOMX_PARAM_TRANSLATION_TYPE_T {
65 MMALOMX_PARAM_TRANSLATION_TYPE_NONE = 0,
66 MMALOMX_PARAM_TRANSLATION_TYPE_SIMPLE,
67 MMALOMX_PARAM_TRANSLATION_TYPE_CUSTOM,
68 MMALOMX_PARAM_TRANSLATION_TYPE_DIRECT,
69} MMALOMX_PARAM_TRANSLATION_TYPE_T;
70
71/** MMAL <-> OMX parameter translation information */
72typedef struct MMALOMX_PARAM_TRANSLATION_T
73{
74 uint32_t mmal_id; /**< MMAL parameter id */
75 uint32_t omx_id; /**< OpenMAX IL parameter index */
76 unsigned int mmal_size:16;
77 unsigned int omx_size:16;
78 unsigned int portless:1;
79 unsigned int double_translation:1;
80 MMALOMX_PARAM_TRANSLATION_TYPE_T type:4;
81
82 struct {
83 MMAL_STATUS_T (*simple)(MMALOMX_PARAM_MAPPING_DIRECTION dir,
84 MMAL_PARAMETER_HEADER_T *mmal_param, OMX_PTR omx_param);
85 MMAL_STATUS_T (*generic)(MMALOMX_PARAM_MAPPING_DIRECTION dir,
86 const struct MMALOMX_PARAM_TRANSLATION_T *xlat,
87 MMAL_PARAMETER_HEADER_T *mmal_param, OMX_PTR omx_param, MMAL_PORT_T *mmal_port);
88 MMAL_STATUS_T (*list)(MMALOMX_PARAM_MAPPING_DIRECTION dir,
89 const struct MMALOMX_PARAM_TRANSLATION_T *xlat, unsigned int index,
90 MMAL_PARAMETER_HEADER_T *mmal_param, OMX_PTR omx_param, MMAL_PORT_T *mmal_port);
91 MMAL_STATUS_T (*custom)(MMALOMX_PARAM_MAPPING_DIRECTION dir,
92 const struct MMALOMX_PARAM_TRANSLATION_T *xlat,
93 MMAL_PARAMETER_HEADER_T *mmal_param, OMX_PTR omx_param, MMAL_PORT_T *mmal_port);
94 } fn;
95
96 const struct MMALOMX_PARAM_ENUM_TRANSLATE_T *xlat_enum;
97 unsigned int xlat_enum_num;
98
99 const char *mmal_name; /**< MMAL parameter name */
100 const char *omx_name; /**< OMX parameter name */
101
102} MMALOMX_PARAM_TRANSLATION_T;
103
104const char *mmalomx_parameter_name_omx(uint32_t id);
105const char *mmalomx_parameter_name_mmal(uint32_t id);
106const MMALOMX_PARAM_TRANSLATION_T *mmalomx_find_parameter_from_omx_id(uint32_t id);
107const MMALOMX_PARAM_TRANSLATION_T *mmalomx_find_parameter_from_mmal_id(uint32_t id);
108const MMALOMX_PARAM_TRANSLATION_T *mmalomx_find_parameter_enum(unsigned int index);
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* MMALOMX_UTIL_PARAMS_H */
115