Merge tag 'v5.15.57' into rpi-5.15.y
[platform/kernel/linux-rpi.git] / drivers / staging / vc04_services / vchiq-mmal / mmal-msg-format.h
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 @ 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 "mmal-msg-common.h"
18
19 /* MMAL_ES_FORMAT_T */
20
21 struct mmal_audio_format {
22         u32 channels;           /* Number of audio channels */
23         u32 sample_rate;        /* Sample rate */
24
25         u32 bits_per_sample;    /* Bits per sample */
26         u32 block_align;        /* Size of a block of data */
27 };
28
29 struct mmal_video_format {
30         u32 width;              /* Width of frame in pixels */
31         u32 height;             /* Height of frame in rows of pixels */
32         struct mmal_rect crop;  /* Visible region of the frame */
33         struct mmal_rational frame_rate;        /* Frame rate */
34         struct mmal_rational par;               /* Pixel aspect ratio */
35
36         /*
37          * FourCC specifying the color space of the video stream. See the
38          * MmalColorSpace "pre-defined color spaces" for some examples.
39          */
40         u32 color_space;
41 };
42
43 struct mmal_subpicture_format {
44         u32 x_offset;
45         u32 y_offset;
46 };
47
48 union mmal_es_specific_format {
49         struct mmal_audio_format audio;
50         struct mmal_video_format video;
51         struct mmal_subpicture_format subpicture;
52 };
53
54 /* The elementary stream will already be framed */
55 #define MMAL_ES_FORMAT_FLAG_FRAMED                              BIT(0)
56 /*
57  * For column formats we ideally want to pass in the column stride. This hasn't
58  * been the past behaviour, so require a new flag to be set should
59  * es->video.width be the column stride (in lines) instead of an ignored width
60  * value.
61  */
62 #define MMAL_ES_FORMAT_FLAG_COL_FMTS_WIDTH_IS_COL_STRIDE        BIT(1)
63
64 /* Definition of an elementary stream format (MMAL_ES_FORMAT_T) */
65 struct mmal_es_format_local {
66         u32 type;       /* enum mmal_es_type */
67
68         u32 encoding;   /* FourCC specifying encoding of the elementary
69                          * stream.
70                          */
71         u32 encoding_variant;   /* FourCC specifying the specific
72                                  * encoding variant of the elementary
73                                  * stream.
74                                  */
75
76         union mmal_es_specific_format *es;      /* Type specific
77                                                  * information for the
78                                                  * elementary stream
79                                                  */
80
81         u32 bitrate;    /* Bitrate in bits per second */
82         u32 flags;      /* Flags describing properties of the elementary
83                          * stream.
84                          */
85
86         u32 extradata_size;     /* Size of the codec specific data */
87         u8  *extradata;         /* Codec specific data */
88 };
89
90 /* Remote definition of an elementary stream format (MMAL_ES_FORMAT_T) */
91 struct mmal_es_format {
92         u32 type;       /* enum mmal_es_type */
93
94         u32 encoding;   /* FourCC specifying encoding of the elementary
95                          * stream.
96                          */
97         u32 encoding_variant;   /* FourCC specifying the specific
98                                  * encoding variant of the elementary
99                                  * stream.
100                                  */
101
102         u32 es; /* Type specific
103                  * information for the
104                  * elementary stream
105                  */
106
107         u32 bitrate;    /* Bitrate in bits per second */
108         u32 flags;      /* Flags describing properties of the elementary
109                          * stream.
110                          */
111
112         u32 extradata_size;     /* Size of the codec specific data */
113         u32 extradata;          /* Codec specific data */
114 };
115
116 #endif /* MMAL_MSG_FORMAT_H */