1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Broadcom BM2835 V4L2 driver
4  *
5  * Copyright © 2013 Raspberry Pi (Trading) Ltd.
6  *
7  * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk>
8  *          Dave Stevenson <dsteve@broadcom.com>
9  *          Simon Mellor <simellor@broadcom.com>
10  *          Luke Diamand <luked@broadcom.com>
11  */
12 
13 #ifndef MMAL_MSG_FORMAT_H
14 #define MMAL_MSG_FORMAT_H
15 
16 #include "mmal-msg-common.h"
17 
18 /* MMAL_ES_FORMAT_T */
19 
20 struct mmal_audio_format {
21 	u32 channels;           /**< Number of audio channels */
22 	u32 sample_rate;        /**< Sample rate */
23 
24 	u32 bits_per_sample;    /**< Bits per sample */
25 	u32 block_align;        /**< Size of a block of data */
26 };
27 
28 struct mmal_video_format {
29 	u32 width;        /**< Width of frame in pixels */
30 	u32 height;       /**< Height of frame in rows of pixels */
31 	struct mmal_rect crop;         /**< Visible region of the frame */
32 	struct mmal_rational frame_rate;   /**< Frame rate */
33 	struct mmal_rational par;          /**< Pixel aspect ratio */
34 
35 	/* FourCC specifying the color space of the video stream. See the
36 	 * \ref MmalColorSpace "pre-defined color spaces" for some examples.
37 	 */
38 	u32 color_space;
39 };
40 
41 struct mmal_subpicture_format {
42 	u32 x_offset;
43 	u32 y_offset;
44 };
45 
46 union mmal_es_specific_format {
47 	struct mmal_audio_format audio;
48 	struct mmal_video_format video;
49 	struct mmal_subpicture_format subpicture;
50 };
51 
52 /** Definition of an elementary stream format (MMAL_ES_FORMAT_T) */
53 struct mmal_es_format_local {
54 	u32 type;      /* enum mmal_es_type */
55 
56 	u32 encoding;  /* FourCC specifying encoding of the elementary stream.*/
57 	u32 encoding_variant; /* FourCC specifying the specific
58 			       * encoding variant of the elementary
59 			       * stream.
60 			       */
61 
62 	union mmal_es_specific_format *es;  /* Type specific
63 					     * information for the
64 					     * elementary stream
65 					     */
66 
67 	u32 bitrate;        /**< Bitrate in bits per second */
68 	u32 flags; /**< Flags describing properties of the elementary stream. */
69 
70 	u32 extradata_size;       /**< Size of the codec specific data */
71 	u8  *extradata;           /**< Codec specific data */
72 };
73 
74 /** Remote definition of an elementary stream format (MMAL_ES_FORMAT_T) */
75 struct mmal_es_format {
76 	u32 type;      /* enum mmal_es_type */
77 
78 	u32 encoding;  /* FourCC specifying encoding of the elementary stream.*/
79 	u32 encoding_variant; /* FourCC specifying the specific
80 			       * encoding variant of the elementary
81 			       * stream.
82 			       */
83 
84 	u32 es; /* Type specific
85 		 * information for the
86 		 * elementary stream
87 		 */
88 
89 	u32 bitrate;        /**< Bitrate in bits per second */
90 	u32 flags; /**< Flags describing properties of the elementary stream. */
91 
92 	u32 extradata_size;       /**< Size of the codec specific data */
93 	u32 extradata;           /**< Codec specific data */
94 };
95 
96 #endif /* MMAL_MSG_FORMAT_H */
97