My Project
mmal_format.h
Go to the documentation of this file.
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_FORMAT_H
29 #define MMAL_FORMAT_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
37 /* @{ */
38 
39 #include "mmal_types.h"
40 #include "mmal_encodings.h"
41 
44 typedef enum {
51 
54 typedef struct
55 {
56  uint32_t width;
57  uint32_t height;
68 
71 typedef struct MMAL_AUDIO_FORMAT_T
72 {
73  uint32_t channels;
74  uint32_t sample_rate;
76  uint32_t bits_per_sample;
77  uint32_t block_align;
82 
85 typedef struct
86 {
87  uint32_t x_offset;
88  uint32_t y_offset;
93 
96 typedef union
97 {
102 
106 /* @{ */
107 #define MMAL_ES_FORMAT_FLAG_FRAMED 0x1
108 /* @} */
109 
113 /* @{ */
114 #define MMAL_ENCODING_UNKNOWN 0
115 /* @} */
116 
120 /* @{ */
121 #define MMAL_ENCODING_VARIANT_DEFAULT 0
122 /* @} */
123 
125 typedef struct MMAL_ES_FORMAT_T
126 {
140  uint32_t bitrate;
141  uint32_t flags;
145  uint32_t extradata_size;
146  uint8_t *extradata;
149 
155 
160 void mmal_format_free(MMAL_ES_FORMAT_T *format);
161 
171 
178 void mmal_format_copy(MMAL_ES_FORMAT_T *format_dest, MMAL_ES_FORMAT_T *format_src);
179 
187 
191 /* @{ */
192 #define MMAL_ES_FORMAT_COMPARE_FLAG_TYPE 0x01
193 #define MMAL_ES_FORMAT_COMPARE_FLAG_ENCODING 0x02
194 #define MMAL_ES_FORMAT_COMPARE_FLAG_BITRATE 0x04
195 #define MMAL_ES_FORMAT_COMPARE_FLAG_FLAGS 0x08
196 #define MMAL_ES_FORMAT_COMPARE_FLAG_EXTRADATA 0x10
198 #define MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_RESOLUTION 0x0100
199 #define MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_CROPPING 0x0200
200 #define MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_FRAME_RATE 0x0400
201 #define MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_ASPECT_RATIO 0x0800
202 #define MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_COLOR_SPACE 0x1000
204 #define MMAL_ES_FORMAT_COMPARE_FLAG_ES_OTHER 0x10000000
205 /* @} */
206 
215 uint32_t mmal_format_compare(MMAL_ES_FORMAT_T *format_1, MMAL_ES_FORMAT_T *format_2);
216 
217 /* @} */
218 
219 #ifdef __cplusplus
220 }
221 #endif
222 
223 #endif /* MMAL_FORMAT_H */
struct MMAL_AUDIO_FORMAT_T MMAL_AUDIO_FORMAT_T
uint32_t mmal_format_compare(MMAL_ES_FORMAT_T *format_1, MMAL_ES_FORMAT_T *format_2)
MMAL_ES_TYPE_T type
Definition: mmal_format.h:127
MMAL_RATIONAL_T frame_rate
Definition: mmal_format.h:59
uint32_t bitrate
Definition: mmal_format.h:140
void mmal_format_free(MMAL_ES_FORMAT_T *format)
MMAL_STATUS_T mmal_format_extradata_alloc(MMAL_ES_FORMAT_T *format, unsigned int size)
uint32_t extradata_size
Definition: mmal_format.h:145
MMAL_AUDIO_FORMAT_T audio
Definition: mmal_format.h:98
uint32_t bits_per_sample
Definition: mmal_format.h:76
uint32_t sample_rate
Definition: mmal_format.h:74
struct MMAL_ES_FORMAT_T MMAL_ES_FORMAT_T
void mmal_format_copy(MMAL_ES_FORMAT_T *format_dest, MMAL_ES_FORMAT_T *format_src)
MMAL_ES_FORMAT_T * mmal_format_alloc(void)
MMAL_FOURCC_T encoding
Definition: mmal_format.h:129
uint32_t MMAL_FOURCC_T
Definition: mmal_types.h:92
MMAL_ES_SPECIFIC_FORMAT_T * es
Definition: mmal_format.h:138
MMAL_FOURCC_T encoding_variant
Definition: mmal_format.h:133
MMAL_RECT_T crop
Definition: mmal_format.h:58
MMAL_RATIONAL_T par
Definition: mmal_format.h:60
MMAL_FOURCC_T color_space
Definition: mmal_format.h:62
MMAL_STATUS_T mmal_format_full_copy(MMAL_ES_FORMAT_T *format_dest, MMAL_ES_FORMAT_T *format_src)
MMAL_ES_TYPE_T
Definition: mmal_format.h:44
MMAL_VIDEO_FORMAT_T video
Definition: mmal_format.h:99
uint32_t block_align
Definition: mmal_format.h:77
MMAL_STATUS_T
Definition: mmal_types.h:46
uint8_t * extradata
Definition: mmal_format.h:146
MMAL_SUBPICTURE_FORMAT_T subpicture
Definition: mmal_format.h:100