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#ifndef MMAL_MSG_FORMAT_H
15#define MMAL_MSG_FORMAT_H
16
17#include <linux/math.h>
18
19#include "mmal-msg-common.h"
20
21/* MMAL_ES_FORMAT_T */
22
23struct mmal_audio_format {
24	u32 channels;		/* Number of audio channels */
25	u32 sample_rate;	/* Sample rate */
26
27	u32 bits_per_sample;	/* Bits per sample */
28	u32 block_align;	/* Size of a block of data */
29};
30
31struct mmal_video_format {
32	u32 width;		/* Width of frame in pixels */
33	u32 height;		/* Height of frame in rows of pixels */
34	struct mmal_rect crop;	/* Visible region of the frame */
35	struct s32_fract frame_rate;	/* Frame rate */
36	struct s32_fract par;		/* Pixel aspect ratio */
37
38	/*
39	 * FourCC specifying the color space of the video stream. See the
40	 * MmalColorSpace "pre-defined color spaces" for some examples.
41	 */
42	u32 color_space;
43};
44
45struct mmal_subpicture_format {
46	u32 x_offset;
47	u32 y_offset;
48};
49
50union mmal_es_specific_format {
51	struct mmal_audio_format audio;
52	struct mmal_video_format video;
53	struct mmal_subpicture_format subpicture;
54};
55
56/* Definition of an elementary stream format (MMAL_ES_FORMAT_T) */
57struct mmal_es_format_local {
58	u32 type;	/* enum mmal_es_type */
59
60	u32 encoding;	/* FourCC specifying encoding of the elementary
61			 * stream.
62			 */
63	u32 encoding_variant;	/* FourCC specifying the specific
64				 * encoding variant of the elementary
65				 * stream.
66				 */
67
68	union mmal_es_specific_format *es;	/* Type specific
69						 * information for the
70						 * elementary stream
71						 */
72
73	u32 bitrate;	/* Bitrate in bits per second */
74	u32 flags;	/* Flags describing properties of the elementary
75			 * stream.
76			 */
77
78	u32 extradata_size;	/* Size of the codec specific data */
79	u8  *extradata;		/* Codec specific data */
80};
81
82/* Remote definition of an elementary stream format (MMAL_ES_FORMAT_T) */
83struct mmal_es_format {
84	u32 type;	/* enum mmal_es_type */
85
86	u32 encoding;	/* FourCC specifying encoding of the elementary
87			 * stream.
88			 */
89	u32 encoding_variant;	/* FourCC specifying the specific
90				 * encoding variant of the elementary
91				 * stream.
92				 */
93
94	u32 es;	/* Type specific
95		 * information for the
96		 * elementary stream
97		 */
98
99	u32 bitrate;	/* Bitrate in bits per second */
100	u32 flags;	/* Flags describing properties of the elementary
101			 * stream.
102			 */
103
104	u32 extradata_size;	/* Size of the codec specific data */
105	u32 extradata;		/* Codec specific data */
106};
107
108#endif /* MMAL_MSG_FORMAT_H */
109