1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Broadcom BCM2835 V4L2 driver
4  *
5  * Copyright © 2013 Raspberry Pi (Trading) Ltd.
6  *
7  * Authors: Vincent Sanders @ Collabora
8  *          Dave Stevenson @ Broadcom
9  *		(now dave.stevenson@raspberrypi.org)
10  *          Simon Mellor @ Broadcom
11  *          Luke Diamand @ Broadcom
12  */
13 
14 /* common parameters */
15 
16 /** @name Parameter groups
17  * Parameters are divided into groups, and then allocated sequentially within
18  * a group using an enum.
19  * @{
20  */
21 
22 #ifndef MMAL_PARAMETERS_H
23 #define MMAL_PARAMETERS_H
24 
25 #include <linux/math.h>
26 
27 /** Common parameter ID group, used with many types of component. */
28 #define MMAL_PARAMETER_GROUP_COMMON		(0 << 16)
29 /** Camera-specific parameter ID group. */
30 #define MMAL_PARAMETER_GROUP_CAMERA		(1 << 16)
31 /** Video-specific parameter ID group. */
32 #define MMAL_PARAMETER_GROUP_VIDEO		(2 << 16)
33 /** Audio-specific parameter ID group. */
34 #define MMAL_PARAMETER_GROUP_AUDIO		(3 << 16)
35 /** Clock-specific parameter ID group. */
36 #define MMAL_PARAMETER_GROUP_CLOCK		(4 << 16)
37 /** Miracast-specific parameter ID group. */
38 #define MMAL_PARAMETER_GROUP_MIRACAST		(5 << 16)
39 
40 /* Common parameters */
41 enum mmal_parameter_common_type {
42 	/**< Never a valid parameter ID */
43 	MMAL_PARAMETER_UNUSED = MMAL_PARAMETER_GROUP_COMMON,
44 
45 		/**< MMAL_PARAMETER_ENCODING_T */
46 	MMAL_PARAMETER_SUPPORTED_ENCODINGS,
47 		/**< MMAL_PARAMETER_URI_T */
48 	MMAL_PARAMETER_URI,
49 		/** MMAL_PARAMETER_CHANGE_EVENT_REQUEST_T */
50 	MMAL_PARAMETER_CHANGE_EVENT_REQUEST,
51 		/** MMAL_PARAMETER_BOOLEAN_T */
52 	MMAL_PARAMETER_ZERO_COPY,
53 		/**< MMAL_PARAMETER_BUFFER_REQUIREMENTS_T */
54 	MMAL_PARAMETER_BUFFER_REQUIREMENTS,
55 		/**< MMAL_PARAMETER_STATISTICS_T */
56 	MMAL_PARAMETER_STATISTICS,
57 		/**< MMAL_PARAMETER_CORE_STATISTICS_T */
58 	MMAL_PARAMETER_CORE_STATISTICS,
59 		/**< MMAL_PARAMETER_MEM_USAGE_T */
60 	MMAL_PARAMETER_MEM_USAGE,
61 		/**< MMAL_PARAMETER_UINT32_T */
62 	MMAL_PARAMETER_BUFFER_FLAG_FILTER,
63 		/**< MMAL_PARAMETER_SEEK_T */
64 	MMAL_PARAMETER_SEEK,
65 		/**< MMAL_PARAMETER_BOOLEAN_T */
66 	MMAL_PARAMETER_POWERMON_ENABLE,
67 		/**< MMAL_PARAMETER_LOGGING_T */
68 	MMAL_PARAMETER_LOGGING,
69 		/**< MMAL_PARAMETER_UINT64_T */
70 	MMAL_PARAMETER_SYSTEM_TIME,
71 		/**< MMAL_PARAMETER_BOOLEAN_T */
72 	MMAL_PARAMETER_NO_IMAGE_PADDING,
73 };
74 
75 /* camera parameters */
76 
77 enum mmal_parameter_camera_type {
78 	/* 0 */
79 		/** @ref MMAL_PARAMETER_THUMBNAIL_CONFIG_T */
80 	MMAL_PARAMETER_THUMBNAIL_CONFIGURATION =
81 		MMAL_PARAMETER_GROUP_CAMERA,
82 		/**< Unused? */
83 	MMAL_PARAMETER_CAPTURE_QUALITY,
84 		/**< @ref MMAL_PARAMETER_INT32_T */
85 	MMAL_PARAMETER_ROTATION,
86 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
87 	MMAL_PARAMETER_EXIF_DISABLE,
88 		/**< @ref MMAL_PARAMETER_EXIF_T */
89 	MMAL_PARAMETER_EXIF,
90 		/**< @ref MMAL_PARAM_AWBMODE_T */
91 	MMAL_PARAMETER_AWB_MODE,
92 		/**< @ref MMAL_PARAMETER_IMAGEFX_T */
93 	MMAL_PARAMETER_IMAGE_EFFECT,
94 		/**< @ref MMAL_PARAMETER_COLOURFX_T */
95 	MMAL_PARAMETER_COLOUR_EFFECT,
96 		/**< @ref MMAL_PARAMETER_FLICKERAVOID_T */
97 	MMAL_PARAMETER_FLICKER_AVOID,
98 		/**< @ref MMAL_PARAMETER_FLASH_T */
99 	MMAL_PARAMETER_FLASH,
100 		/**< @ref MMAL_PARAMETER_REDEYE_T */
101 	MMAL_PARAMETER_REDEYE,
102 		/**< @ref MMAL_PARAMETER_FOCUS_T */
103 	MMAL_PARAMETER_FOCUS,
104 		/**< Unused? */
105 	MMAL_PARAMETER_FOCAL_LENGTHS,
106 		/**< @ref MMAL_PARAMETER_INT32_T */
107 	MMAL_PARAMETER_EXPOSURE_COMP,
108 		/**< @ref MMAL_PARAMETER_SCALEFACTOR_T */
109 	MMAL_PARAMETER_ZOOM,
110 		/**< @ref MMAL_PARAMETER_MIRROR_T */
111 	MMAL_PARAMETER_MIRROR,
112 
113 	/* 0x10 */
114 		/**< @ref MMAL_PARAMETER_UINT32_T */
115 	MMAL_PARAMETER_CAMERA_NUM,
116 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
117 	MMAL_PARAMETER_CAPTURE,
118 		/**< @ref MMAL_PARAMETER_EXPOSUREMODE_T */
119 	MMAL_PARAMETER_EXPOSURE_MODE,
120 		/**< @ref MMAL_PARAMETER_EXPOSUREMETERINGMODE_T */
121 	MMAL_PARAMETER_EXP_METERING_MODE,
122 		/**< @ref MMAL_PARAMETER_FOCUS_STATUS_T */
123 	MMAL_PARAMETER_FOCUS_STATUS,
124 		/**< @ref MMAL_PARAMETER_CAMERA_CONFIG_T */
125 	MMAL_PARAMETER_CAMERA_CONFIG,
126 		/**< @ref MMAL_PARAMETER_CAPTURE_STATUS_T */
127 	MMAL_PARAMETER_CAPTURE_STATUS,
128 		/**< @ref MMAL_PARAMETER_FACE_TRACK_T */
129 	MMAL_PARAMETER_FACE_TRACK,
130 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
131 	MMAL_PARAMETER_DRAW_BOX_FACES_AND_FOCUS,
132 		/**< @ref MMAL_PARAMETER_UINT32_T */
133 	MMAL_PARAMETER_JPEG_Q_FACTOR,
134 		/**< @ref MMAL_PARAMETER_FRAME_RATE_T */
135 	MMAL_PARAMETER_FRAME_RATE,
136 		/**< @ref MMAL_PARAMETER_CAMERA_STC_MODE_T */
137 	MMAL_PARAMETER_USE_STC,
138 		/**< @ref MMAL_PARAMETER_CAMERA_INFO_T */
139 	MMAL_PARAMETER_CAMERA_INFO,
140 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
141 	MMAL_PARAMETER_VIDEO_STABILISATION,
142 		/**< @ref MMAL_PARAMETER_FACE_TRACK_RESULTS_T */
143 	MMAL_PARAMETER_FACE_TRACK_RESULTS,
144 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
145 	MMAL_PARAMETER_ENABLE_RAW_CAPTURE,
146 
147 	/* 0x20 */
148 		/**< @ref MMAL_PARAMETER_URI_T */
149 	MMAL_PARAMETER_DPF_FILE,
150 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
151 	MMAL_PARAMETER_ENABLE_DPF_FILE,
152 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
153 	MMAL_PARAMETER_DPF_FAIL_IS_FATAL,
154 		/**< @ref MMAL_PARAMETER_CAPTUREMODE_T */
155 	MMAL_PARAMETER_CAPTURE_MODE,
156 		/**< @ref MMAL_PARAMETER_FOCUS_REGIONS_T */
157 	MMAL_PARAMETER_FOCUS_REGIONS,
158 		/**< @ref MMAL_PARAMETER_INPUT_CROP_T */
159 	MMAL_PARAMETER_INPUT_CROP,
160 		/**< @ref MMAL_PARAMETER_SENSOR_INFORMATION_T */
161 	MMAL_PARAMETER_SENSOR_INFORMATION,
162 		/**< @ref MMAL_PARAMETER_FLASH_SELECT_T */
163 	MMAL_PARAMETER_FLASH_SELECT,
164 		/**< @ref MMAL_PARAMETER_FIELD_OF_VIEW_T */
165 	MMAL_PARAMETER_FIELD_OF_VIEW,
166 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
167 	MMAL_PARAMETER_HIGH_DYNAMIC_RANGE,
168 		/**< @ref MMAL_PARAMETER_DRC_T */
169 	MMAL_PARAMETER_DYNAMIC_RANGE_COMPRESSION,
170 		/**< @ref MMAL_PARAMETER_ALGORITHM_CONTROL_T */
171 	MMAL_PARAMETER_ALGORITHM_CONTROL,
172 		/**< @ref MMAL_PARAMETER_RATIONAL_T */
173 	MMAL_PARAMETER_SHARPNESS,
174 		/**< @ref MMAL_PARAMETER_RATIONAL_T */
175 	MMAL_PARAMETER_CONTRAST,
176 		/**< @ref MMAL_PARAMETER_RATIONAL_T */
177 	MMAL_PARAMETER_BRIGHTNESS,
178 		/**< @ref MMAL_PARAMETER_RATIONAL_T */
179 	MMAL_PARAMETER_SATURATION,
180 
181 	/* 0x30 */
182 		/**< @ref MMAL_PARAMETER_UINT32_T */
183 	MMAL_PARAMETER_ISO,
184 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
185 	MMAL_PARAMETER_ANTISHAKE,
186 		/** @ref MMAL_PARAMETER_IMAGEFX_PARAMETERS_T */
187 	MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS,
188 		/** @ref MMAL_PARAMETER_BOOLEAN_T */
189 	MMAL_PARAMETER_CAMERA_BURST_CAPTURE,
190 		/** @ref MMAL_PARAMETER_UINT32_T */
191 	MMAL_PARAMETER_CAMERA_MIN_ISO,
192 		/** @ref MMAL_PARAMETER_CAMERA_USE_CASE_T */
193 	MMAL_PARAMETER_CAMERA_USE_CASE,
194 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
195 	MMAL_PARAMETER_CAPTURE_STATS_PASS,
196 		/** @ref MMAL_PARAMETER_UINT32_T */
197 	MMAL_PARAMETER_CAMERA_CUSTOM_SENSOR_CONFIG,
198 		/** @ref MMAL_PARAMETER_BOOLEAN_T */
199 	MMAL_PARAMETER_ENABLE_REGISTER_FILE,
200 		/** @ref MMAL_PARAMETER_BOOLEAN_T */
201 	MMAL_PARAMETER_REGISTER_FAIL_IS_FATAL,
202 		/** @ref MMAL_PARAMETER_CONFIGFILE_T */
203 	MMAL_PARAMETER_CONFIGFILE_REGISTERS,
204 		/** @ref MMAL_PARAMETER_CONFIGFILE_CHUNK_T */
205 	MMAL_PARAMETER_CONFIGFILE_CHUNK_REGISTERS,
206 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
207 	MMAL_PARAMETER_JPEG_ATTACH_LOG,
208 		/**< @ref MMAL_PARAMETER_ZEROSHUTTERLAG_T */
209 	MMAL_PARAMETER_ZERO_SHUTTER_LAG,
210 		/**< @ref MMAL_PARAMETER_FPS_RANGE_T */
211 	MMAL_PARAMETER_FPS_RANGE,
212 		/**< @ref MMAL_PARAMETER_INT32_T */
213 	MMAL_PARAMETER_CAPTURE_EXPOSURE_COMP,
214 
215 	/* 0x40 */
216 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
217 	MMAL_PARAMETER_SW_SHARPEN_DISABLE,
218 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
219 	MMAL_PARAMETER_FLASH_REQUIRED,
220 		/**< @ref MMAL_PARAMETER_BOOLEAN_T */
221 	MMAL_PARAMETER_SW_SATURATION_DISABLE,
222 		/**< Takes a @ref MMAL_PARAMETER_UINT32_T */
223 	MMAL_PARAMETER_SHUTTER_SPEED,
224 		/**< Takes a @ref MMAL_PARAMETER_AWB_GAINS_T */
225 	MMAL_PARAMETER_CUSTOM_AWB_GAINS,
226 };
227 
228 enum mmal_parameter_camera_config_timestamp_mode {
229 	MMAL_PARAM_TIMESTAMP_MODE_ZERO = 0, /* Always timestamp frames as 0 */
230 	MMAL_PARAM_TIMESTAMP_MODE_RAW_STC,  /* Use the raw STC value
231 					     * for the frame timestamp
232 					     */
233 	MMAL_PARAM_TIMESTAMP_MODE_RESET_STC, /* Use the STC timestamp
234 					      * but subtract the
235 					      * timestamp of the first
236 					      * frame sent to give a
237 					      * zero based timestamp.
238 					      */
239 };
240 
241 struct mmal_parameter_fps_range {
242 	/**< Low end of the permitted framerate range */
243 	struct s32_fract	fps_low;
244 	/**< High end of the permitted framerate range */
245 	struct s32_fract	fps_high;
246 };
247 
248 /* camera configuration parameter */
249 struct mmal_parameter_camera_config {
250 	/* Parameters for setting up the image pools */
251 	u32 max_stills_w; /* Max size of stills capture */
252 	u32 max_stills_h;
253 	u32 stills_yuv422; /* Allow YUV422 stills capture */
254 	u32 one_shot_stills; /* Continuous or one shot stills captures. */
255 
256 	u32 max_preview_video_w; /* Max size of the preview or video
257 				  * capture frames
258 				  */
259 	u32 max_preview_video_h;
260 	u32 num_preview_video_frames;
261 
262 	/** Sets the height of the circular buffer for stills capture. */
263 	u32 stills_capture_circular_buffer_height;
264 
265 	/** Allows preview/encode to resume as fast as possible after the stills
266 	 * input frame has been received, and then processes the still frame in
267 	 * the background whilst preview/encode has resumed.
268 	 * Actual mode is controlled by MMAL_PARAMETER_CAPTURE_MODE.
269 	 */
270 	u32 fast_preview_resume;
271 
272 	/** Selects algorithm for timestamping frames if
273 	 * there is no clock component connected.
274 	 * enum mmal_parameter_camera_config_timestamp_mode
275 	 */
276 	s32 use_stc_timestamp;
277 };
278 
279 enum mmal_parameter_exposuremode {
280 	MMAL_PARAM_EXPOSUREMODE_OFF,
281 	MMAL_PARAM_EXPOSUREMODE_AUTO,
282 	MMAL_PARAM_EXPOSUREMODE_NIGHT,
283 	MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW,
284 	MMAL_PARAM_EXPOSUREMODE_BACKLIGHT,
285 	MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT,
286 	MMAL_PARAM_EXPOSUREMODE_SPORTS,
287 	MMAL_PARAM_EXPOSUREMODE_SNOW,
288 	MMAL_PARAM_EXPOSUREMODE_BEACH,
289 	MMAL_PARAM_EXPOSUREMODE_VERYLONG,
290 	MMAL_PARAM_EXPOSUREMODE_FIXEDFPS,
291 	MMAL_PARAM_EXPOSUREMODE_ANTISHAKE,
292 	MMAL_PARAM_EXPOSUREMODE_FIREWORKS,
293 };
294 
295 enum mmal_parameter_exposuremeteringmode {
296 	MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE,
297 	MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT,
298 	MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT,
299 	MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX,
300 };
301 
302 enum mmal_parameter_awbmode {
303 	MMAL_PARAM_AWBMODE_OFF,
304 	MMAL_PARAM_AWBMODE_AUTO,
305 	MMAL_PARAM_AWBMODE_SUNLIGHT,
306 	MMAL_PARAM_AWBMODE_CLOUDY,
307 	MMAL_PARAM_AWBMODE_SHADE,
308 	MMAL_PARAM_AWBMODE_TUNGSTEN,
309 	MMAL_PARAM_AWBMODE_FLUORESCENT,
310 	MMAL_PARAM_AWBMODE_INCANDESCENT,
311 	MMAL_PARAM_AWBMODE_FLASH,
312 	MMAL_PARAM_AWBMODE_HORIZON,
313 };
314 
315 enum mmal_parameter_imagefx {
316 	MMAL_PARAM_IMAGEFX_NONE,
317 	MMAL_PARAM_IMAGEFX_NEGATIVE,
318 	MMAL_PARAM_IMAGEFX_SOLARIZE,
319 	MMAL_PARAM_IMAGEFX_POSTERIZE,
320 	MMAL_PARAM_IMAGEFX_WHITEBOARD,
321 	MMAL_PARAM_IMAGEFX_BLACKBOARD,
322 	MMAL_PARAM_IMAGEFX_SKETCH,
323 	MMAL_PARAM_IMAGEFX_DENOISE,
324 	MMAL_PARAM_IMAGEFX_EMBOSS,
325 	MMAL_PARAM_IMAGEFX_OILPAINT,
326 	MMAL_PARAM_IMAGEFX_HATCH,
327 	MMAL_PARAM_IMAGEFX_GPEN,
328 	MMAL_PARAM_IMAGEFX_PASTEL,
329 	MMAL_PARAM_IMAGEFX_WATERCOLOUR,
330 	MMAL_PARAM_IMAGEFX_FILM,
331 	MMAL_PARAM_IMAGEFX_BLUR,
332 	MMAL_PARAM_IMAGEFX_SATURATION,
333 	MMAL_PARAM_IMAGEFX_COLOURSWAP,
334 	MMAL_PARAM_IMAGEFX_WASHEDOUT,
335 	MMAL_PARAM_IMAGEFX_POSTERISE,
336 	MMAL_PARAM_IMAGEFX_COLOURPOINT,
337 	MMAL_PARAM_IMAGEFX_COLOURBALANCE,
338 	MMAL_PARAM_IMAGEFX_CARTOON,
339 };
340 
341 enum MMAL_PARAM_FLICKERAVOID {
342 	MMAL_PARAM_FLICKERAVOID_OFF,
343 	MMAL_PARAM_FLICKERAVOID_AUTO,
344 	MMAL_PARAM_FLICKERAVOID_50HZ,
345 	MMAL_PARAM_FLICKERAVOID_60HZ,
346 	MMAL_PARAM_FLICKERAVOID_MAX = 0x7FFFFFFF
347 };
348 
349 struct mmal_parameter_awbgains {
350 	struct s32_fract r_gain;	/**< Red gain */
351 	struct s32_fract b_gain;	/**< Blue gain */
352 };
353 
354 /** Manner of video rate control */
355 enum mmal_parameter_rate_control_mode {
356 	MMAL_VIDEO_RATECONTROL_DEFAULT,
357 	MMAL_VIDEO_RATECONTROL_VARIABLE,
358 	MMAL_VIDEO_RATECONTROL_CONSTANT,
359 	MMAL_VIDEO_RATECONTROL_VARIABLE_SKIP_FRAMES,
360 	MMAL_VIDEO_RATECONTROL_CONSTANT_SKIP_FRAMES
361 };
362 
363 enum mmal_video_profile {
364 	MMAL_VIDEO_PROFILE_H263_BASELINE,
365 	MMAL_VIDEO_PROFILE_H263_H320CODING,
366 	MMAL_VIDEO_PROFILE_H263_BACKWARDCOMPATIBLE,
367 	MMAL_VIDEO_PROFILE_H263_ISWV2,
368 	MMAL_VIDEO_PROFILE_H263_ISWV3,
369 	MMAL_VIDEO_PROFILE_H263_HIGHCOMPRESSION,
370 	MMAL_VIDEO_PROFILE_H263_INTERNET,
371 	MMAL_VIDEO_PROFILE_H263_INTERLACE,
372 	MMAL_VIDEO_PROFILE_H263_HIGHLATENCY,
373 	MMAL_VIDEO_PROFILE_MP4V_SIMPLE,
374 	MMAL_VIDEO_PROFILE_MP4V_SIMPLESCALABLE,
375 	MMAL_VIDEO_PROFILE_MP4V_CORE,
376 	MMAL_VIDEO_PROFILE_MP4V_MAIN,
377 	MMAL_VIDEO_PROFILE_MP4V_NBIT,
378 	MMAL_VIDEO_PROFILE_MP4V_SCALABLETEXTURE,
379 	MMAL_VIDEO_PROFILE_MP4V_SIMPLEFACE,
380 	MMAL_VIDEO_PROFILE_MP4V_SIMPLEFBA,
381 	MMAL_VIDEO_PROFILE_MP4V_BASICANIMATED,
382 	MMAL_VIDEO_PROFILE_MP4V_HYBRID,
383 	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDREALTIME,
384 	MMAL_VIDEO_PROFILE_MP4V_CORESCALABLE,
385 	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCODING,
386 	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCORE,
387 	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSCALABLE,
388 	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSIMPLE,
389 	MMAL_VIDEO_PROFILE_H264_BASELINE,
390 	MMAL_VIDEO_PROFILE_H264_MAIN,
391 	MMAL_VIDEO_PROFILE_H264_EXTENDED,
392 	MMAL_VIDEO_PROFILE_H264_HIGH,
393 	MMAL_VIDEO_PROFILE_H264_HIGH10,
394 	MMAL_VIDEO_PROFILE_H264_HIGH422,
395 	MMAL_VIDEO_PROFILE_H264_HIGH444,
396 	MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE,
397 	MMAL_VIDEO_PROFILE_DUMMY = 0x7FFFFFFF
398 };
399 
400 enum mmal_video_level {
401 	MMAL_VIDEO_LEVEL_H263_10,
402 	MMAL_VIDEO_LEVEL_H263_20,
403 	MMAL_VIDEO_LEVEL_H263_30,
404 	MMAL_VIDEO_LEVEL_H263_40,
405 	MMAL_VIDEO_LEVEL_H263_45,
406 	MMAL_VIDEO_LEVEL_H263_50,
407 	MMAL_VIDEO_LEVEL_H263_60,
408 	MMAL_VIDEO_LEVEL_H263_70,
409 	MMAL_VIDEO_LEVEL_MP4V_0,
410 	MMAL_VIDEO_LEVEL_MP4V_0b,
411 	MMAL_VIDEO_LEVEL_MP4V_1,
412 	MMAL_VIDEO_LEVEL_MP4V_2,
413 	MMAL_VIDEO_LEVEL_MP4V_3,
414 	MMAL_VIDEO_LEVEL_MP4V_4,
415 	MMAL_VIDEO_LEVEL_MP4V_4a,
416 	MMAL_VIDEO_LEVEL_MP4V_5,
417 	MMAL_VIDEO_LEVEL_MP4V_6,
418 	MMAL_VIDEO_LEVEL_H264_1,
419 	MMAL_VIDEO_LEVEL_H264_1b,
420 	MMAL_VIDEO_LEVEL_H264_11,
421 	MMAL_VIDEO_LEVEL_H264_12,
422 	MMAL_VIDEO_LEVEL_H264_13,
423 	MMAL_VIDEO_LEVEL_H264_2,
424 	MMAL_VIDEO_LEVEL_H264_21,
425 	MMAL_VIDEO_LEVEL_H264_22,
426 	MMAL_VIDEO_LEVEL_H264_3,
427 	MMAL_VIDEO_LEVEL_H264_31,
428 	MMAL_VIDEO_LEVEL_H264_32,
429 	MMAL_VIDEO_LEVEL_H264_4,
430 	MMAL_VIDEO_LEVEL_H264_41,
431 	MMAL_VIDEO_LEVEL_H264_42,
432 	MMAL_VIDEO_LEVEL_H264_5,
433 	MMAL_VIDEO_LEVEL_H264_51,
434 	MMAL_VIDEO_LEVEL_DUMMY = 0x7FFFFFFF
435 };
436 
437 struct mmal_parameter_video_profile {
438 	enum mmal_video_profile profile;
439 	enum mmal_video_level level;
440 };
441 
442 /* video parameters */
443 
444 enum mmal_parameter_video_type {
445 	/** @ref MMAL_DISPLAYREGION_T */
446 	MMAL_PARAMETER_DISPLAYREGION = MMAL_PARAMETER_GROUP_VIDEO,
447 
448 	/** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */
449 	MMAL_PARAMETER_SUPPORTED_PROFILES,
450 
451 	/** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */
452 	MMAL_PARAMETER_PROFILE,
453 
454 	/** @ref MMAL_PARAMETER_UINT32_T */
455 	MMAL_PARAMETER_INTRAPERIOD,
456 
457 	/** @ref MMAL_PARAMETER_VIDEO_RATECONTROL_T */
458 	MMAL_PARAMETER_RATECONTROL,
459 
460 	/** @ref MMAL_PARAMETER_VIDEO_NALUNITFORMAT_T */
461 	MMAL_PARAMETER_NALUNITFORMAT,
462 
463 	/** @ref MMAL_PARAMETER_BOOLEAN_T */
464 	MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
465 
466 	/** @ref MMAL_PARAMETER_UINT32_T.
467 	 * Setting the value to zero resets to the default (one slice per
468 	 * frame).
469 	 */
470 	MMAL_PARAMETER_MB_ROWS_PER_SLICE,
471 
472 	/** @ref MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION_T */
473 	MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION,
474 
475 	/** @ref MMAL_PARAMETER_VIDEO_EEDE_ENABLE_T */
476 	MMAL_PARAMETER_VIDEO_EEDE_ENABLE,
477 
478 	/** @ref MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE_T */
479 	MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE,
480 
481 	/** @ref MMAL_PARAMETER_BOOLEAN_T. Request an I-frame. */
482 	MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME,
483 	/** @ref MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T */
484 	MMAL_PARAMETER_VIDEO_INTRA_REFRESH,
485 
486 	/** @ref MMAL_PARAMETER_BOOLEAN_T. */
487 	MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
488 
489 	/** @ref MMAL_PARAMETER_UINT32_T. Run-time bit rate control */
490 	MMAL_PARAMETER_VIDEO_BIT_RATE,
491 
492 	/** @ref MMAL_PARAMETER_FRAME_RATE_T */
493 	MMAL_PARAMETER_VIDEO_FRAME_RATE,
494 
495 	/** @ref MMAL_PARAMETER_UINT32_T. */
496 	MMAL_PARAMETER_VIDEO_ENCODE_MIN_QUANT,
497 
498 	/** @ref MMAL_PARAMETER_UINT32_T. */
499 	MMAL_PARAMETER_VIDEO_ENCODE_MAX_QUANT,
500 
501 	/** @ref MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL_T. */
502 	MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL,
503 
504 	MMAL_PARAMETER_EXTRA_BUFFERS, /**< @ref MMAL_PARAMETER_UINT32_T. */
505 	/** @ref MMAL_PARAMETER_UINT32_T.
506 	 * Changing this parameter from the default can reduce frame rate
507 	 * because image buffers need to be re-pitched.
508 	 */
509 	MMAL_PARAMETER_VIDEO_ALIGN_HORIZ,
510 
511 	/** @ref MMAL_PARAMETER_UINT32_T.
512 	 * Changing this parameter from the default can reduce frame rate
513 	 * because image buffers need to be re-pitched.
514 	 */
515 	MMAL_PARAMETER_VIDEO_ALIGN_VERT,
516 
517 	/** @ref MMAL_PARAMETER_BOOLEAN_T. */
518 	MMAL_PARAMETER_VIDEO_DROPPABLE_PFRAMES,
519 
520 	/** @ref MMAL_PARAMETER_UINT32_T. */
521 	MMAL_PARAMETER_VIDEO_ENCODE_INITIAL_QUANT,
522 
523 	/**< @ref MMAL_PARAMETER_UINT32_T. */
524 	MMAL_PARAMETER_VIDEO_ENCODE_QP_P,
525 
526 	/**< @ref MMAL_PARAMETER_UINT32_T. */
527 	MMAL_PARAMETER_VIDEO_ENCODE_RC_SLICE_DQUANT,
528 
529 	/** @ref MMAL_PARAMETER_UINT32_T */
530 	MMAL_PARAMETER_VIDEO_ENCODE_FRAME_LIMIT_BITS,
531 
532 	/** @ref MMAL_PARAMETER_UINT32_T. */
533 	MMAL_PARAMETER_VIDEO_ENCODE_PEAK_RATE,
534 
535 	/* H264 specific parameters */
536 
537 	/** @ref MMAL_PARAMETER_BOOLEAN_T. */
538 	MMAL_PARAMETER_VIDEO_ENCODE_H264_DISABLE_CABAC,
539 
540 	/** @ref MMAL_PARAMETER_BOOLEAN_T. */
541 	MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_LATENCY,
542 
543 	/** @ref MMAL_PARAMETER_BOOLEAN_T. */
544 	MMAL_PARAMETER_VIDEO_ENCODE_H264_AU_DELIMITERS,
545 
546 	/** @ref MMAL_PARAMETER_UINT32_T. */
547 	MMAL_PARAMETER_VIDEO_ENCODE_H264_DEBLOCK_IDC,
548 
549 	/** @ref MMAL_PARAMETER_VIDEO_ENCODER_H264_MB_INTRA_MODES_T. */
550 	MMAL_PARAMETER_VIDEO_ENCODE_H264_MB_INTRA_MODE,
551 
552 	/** @ref MMAL_PARAMETER_BOOLEAN_T */
553 	MMAL_PARAMETER_VIDEO_ENCODE_HEADER_ON_OPEN,
554 
555 	/** @ref MMAL_PARAMETER_BOOLEAN_T */
556 	MMAL_PARAMETER_VIDEO_ENCODE_PRECODE_FOR_QP,
557 
558 	/** @ref MMAL_PARAMETER_VIDEO_DRM_INIT_INFO_T. */
559 	MMAL_PARAMETER_VIDEO_DRM_INIT_INFO,
560 
561 	/** @ref MMAL_PARAMETER_BOOLEAN_T */
562 	MMAL_PARAMETER_VIDEO_TIMESTAMP_FIFO,
563 
564 	/** @ref MMAL_PARAMETER_BOOLEAN_T */
565 	MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT,
566 
567 	/** @ref MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER_T. */
568 	MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER,
569 
570 	/** @ref MMAL_PARAMETER_BYTES_T */
571 	MMAL_PARAMETER_VIDEO_DECODE_CONFIG_VD3,
572 
573 	/**< @ref MMAL_PARAMETER_BOOLEAN_T */
574 	MMAL_PARAMETER_VIDEO_ENCODE_H264_VCL_HRD_PARAMETERS,
575 
576 	/**< @ref MMAL_PARAMETER_BOOLEAN_T */
577 	MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_DELAY_HRD_FLAG,
578 
579 	/**< @ref MMAL_PARAMETER_BOOLEAN_T */
580 	MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER
581 };
582 
583 /** Valid mirror modes */
584 enum mmal_parameter_mirror {
585 	MMAL_PARAM_MIRROR_NONE,
586 	MMAL_PARAM_MIRROR_VERTICAL,
587 	MMAL_PARAM_MIRROR_HORIZONTAL,
588 	MMAL_PARAM_MIRROR_BOTH,
589 };
590 
591 enum mmal_parameter_displaytransform {
592 	MMAL_DISPLAY_ROT0 = 0,
593 	MMAL_DISPLAY_MIRROR_ROT0 = 1,
594 	MMAL_DISPLAY_MIRROR_ROT180 = 2,
595 	MMAL_DISPLAY_ROT180 = 3,
596 	MMAL_DISPLAY_MIRROR_ROT90 = 4,
597 	MMAL_DISPLAY_ROT270 = 5,
598 	MMAL_DISPLAY_ROT90 = 6,
599 	MMAL_DISPLAY_MIRROR_ROT270 = 7,
600 };
601 
602 enum mmal_parameter_displaymode {
603 	MMAL_DISPLAY_MODE_FILL = 0,
604 	MMAL_DISPLAY_MODE_LETTERBOX = 1,
605 };
606 
607 enum mmal_parameter_displayset {
608 	MMAL_DISPLAY_SET_NONE = 0,
609 	MMAL_DISPLAY_SET_NUM = 1,
610 	MMAL_DISPLAY_SET_FULLSCREEN = 2,
611 	MMAL_DISPLAY_SET_TRANSFORM = 4,
612 	MMAL_DISPLAY_SET_DEST_RECT = 8,
613 	MMAL_DISPLAY_SET_SRC_RECT = 0x10,
614 	MMAL_DISPLAY_SET_MODE = 0x20,
615 	MMAL_DISPLAY_SET_PIXEL = 0x40,
616 	MMAL_DISPLAY_SET_NOASPECT = 0x80,
617 	MMAL_DISPLAY_SET_LAYER = 0x100,
618 	MMAL_DISPLAY_SET_COPYPROTECT = 0x200,
619 	MMAL_DISPLAY_SET_ALPHA = 0x400,
620 };
621 
622 /* rectangle, used lots so it gets its own struct */
623 struct vchiq_mmal_rect {
624 	s32 x;
625 	s32 y;
626 	s32 width;
627 	s32 height;
628 };
629 
630 struct mmal_parameter_displayregion {
631 	/** Bitfield that indicates which fields are set and should be
632 	 * used. All other fields will maintain their current value.
633 	 * \ref MMAL_DISPLAYSET_T defines the bits that can be
634 	 * combined.
635 	 */
636 	u32 set;
637 
638 	/** Describes the display output device, with 0 typically
639 	 * being a directly connected LCD display.  The actual values
640 	 * will depend on the hardware.  Code using hard-wired numbers
641 	 * (e.g. 2) is certain to fail.
642 	 */
643 
644 	u32 display_num;
645 	/** Indicates that we are using the full device screen area,
646 	 * rather than a window of the display.  If zero, then
647 	 * dest_rect is used to specify a region of the display to
648 	 * use.
649 	 */
650 
651 	s32 fullscreen;
652 	/** Indicates any rotation or flipping used to map frames onto
653 	 * the natural display orientation.
654 	 */
655 	u32 transform; /* enum mmal_parameter_displaytransform */
656 
657 	/** Where to display the frame within the screen, if
658 	 * fullscreen is zero.
659 	 */
660 	struct vchiq_mmal_rect dest_rect;
661 
662 	/** Indicates which area of the frame to display. If all
663 	 * values are zero, the whole frame will be used.
664 	 */
665 	struct vchiq_mmal_rect src_rect;
666 
667 	/** If set to non-zero, indicates that any display scaling
668 	 * should disregard the aspect ratio of the frame region being
669 	 * displayed.
670 	 */
671 	s32 noaspect;
672 
673 	/** Indicates how the image should be scaled to fit the
674 	 * display. \code MMAL_DISPLAY_MODE_FILL \endcode indicates
675 	 * that the image should fill the screen by potentially
676 	 * cropping the frames.  Setting \code mode \endcode to \code
677 	 * MMAL_DISPLAY_MODE_LETTERBOX \endcode indicates that all the
678 	 * source region should be displayed and black bars added if
679 	 * necessary.
680 	 */
681 	u32 mode; /* enum mmal_parameter_displaymode */
682 
683 	/** If non-zero, defines the width of a source pixel relative
684 	 * to \code pixel_y \endcode.  If zero, then pixels default to
685 	 * being square.
686 	 */
687 	u32 pixel_x;
688 
689 	/** If non-zero, defines the height of a source pixel relative
690 	 * to \code pixel_x \endcode.  If zero, then pixels default to
691 	 * being square.
692 	 */
693 	u32 pixel_y;
694 
695 	/** Sets the relative depth of the images, with greater values
696 	 * being in front of smaller values.
697 	 */
698 	u32 layer;
699 
700 	/** Set to non-zero to ensure copy protection is used on
701 	 * output.
702 	 */
703 	s32 copyprotect_required;
704 
705 	/** Level of opacity of the layer, where zero is fully
706 	 * transparent and 255 is fully opaque.
707 	 */
708 	u32 alpha;
709 };
710 
711 #define MMAL_MAX_IMAGEFX_PARAMETERS 5
712 
713 struct mmal_parameter_imagefx_parameters {
714 	enum mmal_parameter_imagefx effect;
715 	u32 num_effect_params;
716 	u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS];
717 };
718 
719 #define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4
720 #define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2
721 #define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16
722 
723 struct mmal_parameter_camera_info_camera {
724 	u32 port_id;
725 	u32 max_width;
726 	u32 max_height;
727 	u32 lens_present;
728 	u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN];
729 };
730 
731 enum mmal_parameter_camera_info_flash_type {
732 	/* Make values explicit to ensure they match values in config ini */
733 	MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0,
734 	MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED   = 1,
735 	MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2,
736 	MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF
737 };
738 
739 struct mmal_parameter_camera_info_flash {
740 	enum mmal_parameter_camera_info_flash_type flash_type;
741 };
742 
743 struct mmal_parameter_camera_info {
744 	u32 num_cameras;
745 	u32 num_flashes;
746 	struct mmal_parameter_camera_info_camera
747 		cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS];
748 	struct mmal_parameter_camera_info_flash
749 				flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES];
750 };
751 
752 #endif
753