1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, 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 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON 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 |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | #ifndef MMAL_UTIL_PARAMS_H |
29 | #define MMAL_UTIL_PARAMS_H |
30 | |
31 | #include "interface/mmal/mmal.h" |
32 | |
33 | #ifdef __cplusplus |
34 | extern "C" { |
35 | #endif |
36 | |
37 | /** |
38 | * @file |
39 | * Utility functions to set some common parameters. |
40 | */ |
41 | |
42 | /** Helper function to set the value of a boolean parameter. |
43 | * @param port port on which to set the parameter |
44 | * @param id parameter id |
45 | * @param value value to set the parameter to |
46 | * |
47 | * @return MMAL_SUCCESS or error |
48 | */ |
49 | MMAL_STATUS_T mmal_port_parameter_set_boolean(MMAL_PORT_T *port, uint32_t id, MMAL_BOOL_T value); |
50 | |
51 | /** Helper function to get the value of a boolean parameter. |
52 | * @param port port on which to get the parameter |
53 | * @param id parameter id |
54 | * @param value pointer to where the value will be returned |
55 | * |
56 | * @return MMAL_SUCCESS or error |
57 | */ |
58 | MMAL_STATUS_T mmal_port_parameter_get_boolean(MMAL_PORT_T *port, uint32_t id, MMAL_BOOL_T *value); |
59 | |
60 | /** Helper function to set the value of a 64 bits unsigned integer parameter. |
61 | * @param port port on which to set the parameter |
62 | * @param id parameter id |
63 | * @param value value to set the parameter to |
64 | * |
65 | * @return MMAL_SUCCESS or error |
66 | */ |
67 | MMAL_STATUS_T mmal_port_parameter_set_uint64(MMAL_PORT_T *port, uint32_t id, uint64_t value); |
68 | |
69 | /** Helper function to get the value of a 64 bits unsigned integer parameter. |
70 | * @param port port on which to get the parameter |
71 | * @param id parameter id |
72 | * @param value pointer to where the value will be returned |
73 | * |
74 | * @return MMAL_SUCCESS or error |
75 | */ |
76 | MMAL_STATUS_T mmal_port_parameter_get_uint64(MMAL_PORT_T *port, uint32_t id, uint64_t *value); |
77 | |
78 | /** Helper function to set the value of a 64 bits signed integer parameter. |
79 | * @param port port on which to set the parameter |
80 | * @param id parameter id |
81 | * @param value value to set the parameter to |
82 | * |
83 | * @return MMAL_SUCCESS or error |
84 | */ |
85 | MMAL_STATUS_T mmal_port_parameter_set_int64(MMAL_PORT_T *port, uint32_t id, int64_t value); |
86 | |
87 | /** Helper function to get the value of a 64 bits signed integer parameter. |
88 | * @param port port on which to get the parameter |
89 | * @param id parameter id |
90 | * @param value pointer to where the value will be returned |
91 | * |
92 | * @return MMAL_SUCCESS or error |
93 | */ |
94 | MMAL_STATUS_T mmal_port_parameter_get_int64(MMAL_PORT_T *port, uint32_t id, int64_t *value); |
95 | |
96 | /** Helper function to set the value of a 32 bits unsigned integer parameter. |
97 | * @param port port on which to set the parameter |
98 | * @param id parameter id |
99 | * @param value value to set the parameter to |
100 | * |
101 | * @return MMAL_SUCCESS or error |
102 | */ |
103 | MMAL_STATUS_T mmal_port_parameter_set_uint32(MMAL_PORT_T *port, uint32_t id, uint32_t value); |
104 | |
105 | /** Helper function to get the value of a 32 bits unsigned integer parameter. |
106 | * @param port port on which to get the parameter |
107 | * @param id parameter id |
108 | * @param value pointer to where the value will be returned |
109 | * |
110 | * @return MMAL_SUCCESS or error |
111 | */ |
112 | MMAL_STATUS_T mmal_port_parameter_get_uint32(MMAL_PORT_T *port, uint32_t id, uint32_t *value); |
113 | |
114 | /** Helper function to set the value of a 32 bits signed integer parameter. |
115 | * @param port port on which to set the parameter |
116 | * @param id parameter id |
117 | * @param value value to set the parameter to |
118 | * |
119 | * @return MMAL_SUCCESS or error |
120 | */ |
121 | MMAL_STATUS_T mmal_port_parameter_set_int32(MMAL_PORT_T *port, uint32_t id, int32_t value); |
122 | |
123 | /** Helper function to get the value of a 32 bits signed integer parameter. |
124 | * @param port port on which to get the parameter |
125 | * @param id parameter id |
126 | * @param value pointer to where the value will be returned |
127 | * |
128 | * @return MMAL_SUCCESS or error |
129 | */ |
130 | MMAL_STATUS_T mmal_port_parameter_get_int32(MMAL_PORT_T *port, uint32_t id, int32_t *value); |
131 | |
132 | /** Helper function to set the value of a rational parameter. |
133 | * @param port port on which to set the parameter |
134 | * @param id parameter id |
135 | * @param value value to set the parameter to |
136 | * |
137 | * @return MMAL_SUCCESS or error |
138 | */ |
139 | MMAL_STATUS_T mmal_port_parameter_set_rational(MMAL_PORT_T *port, uint32_t id, MMAL_RATIONAL_T value); |
140 | |
141 | /** Helper function to get the value of a rational parameter. |
142 | * @param port port on which to get the parameter |
143 | * @param id parameter id |
144 | * @param value pointer to where the value will be returned |
145 | * |
146 | * @return MMAL_SUCCESS or error |
147 | */ |
148 | MMAL_STATUS_T mmal_port_parameter_get_rational(MMAL_PORT_T *port, uint32_t id, MMAL_RATIONAL_T *value); |
149 | |
150 | /** Helper function to set the value of a string parameter. |
151 | * @param port port on which to set the parameter |
152 | * @param id parameter id |
153 | * @param value null-terminated string value |
154 | * |
155 | * @return MMAL_SUCCESS or error |
156 | */ |
157 | MMAL_STATUS_T mmal_port_parameter_set_string(MMAL_PORT_T *port, uint32_t id, const char *value); |
158 | |
159 | /** Helper function to set the value of an array of bytes parameter. |
160 | * @param port port on which to set the parameter |
161 | * @param id parameter id |
162 | * @param data pointer to the array of bytes |
163 | * @param size size of the array of bytes |
164 | * |
165 | * @return MMAL_SUCCESS or error |
166 | */ |
167 | MMAL_STATUS_T mmal_port_parameter_set_bytes(MMAL_PORT_T *port, uint32_t id, |
168 | const uint8_t *data, unsigned int size); |
169 | |
170 | /** Helper function to set a MMAL_PARAMETER_URI_T parameter on a port. |
171 | * @param port port on which to set the parameter |
172 | * @param uri URI string |
173 | * |
174 | * @return MMAL_SUCCESS or error |
175 | */ |
176 | MMAL_STATUS_T mmal_util_port_set_uri(MMAL_PORT_T *port, const char *uri); |
177 | |
178 | /** Set the display region. |
179 | * @param port port to configure |
180 | * @param region region |
181 | * |
182 | * @return MMAL_SUCCESS or error |
183 | */ |
184 | MMAL_STATUS_T mmal_util_set_display_region(MMAL_PORT_T *port, |
185 | MMAL_DISPLAYREGION_T *region); |
186 | |
187 | /** Tell the camera to use the STC for timestamps rather than the clock. |
188 | * |
189 | * @param port port to configure |
190 | * @param mode STC mode to use |
191 | * @return MMAL_SUCCESS or error |
192 | */ |
193 | MMAL_STATUS_T mmal_util_camera_use_stc_timestamp(MMAL_PORT_T *port, MMAL_CAMERA_STC_MODE_T mode); |
194 | |
195 | /** Get the MMAL core statistics for a given port. |
196 | * |
197 | * @param port port to query |
198 | * @param dir port direction |
199 | * @param reset reset the stats as well |
200 | * @param stats filled in with results |
201 | * @return MMAL_SUCCESS or error |
202 | */ |
203 | MMAL_STATUS_T mmal_util_get_core_port_stats(MMAL_PORT_T *port, MMAL_CORE_STATS_DIR dir, MMAL_BOOL_T reset, |
204 | MMAL_CORE_STATISTICS_T *stats); |
205 | |
206 | #ifdef __cplusplus |
207 | } |
208 | #endif |
209 | |
210 | #endif |
211 | |