My Project
mmal_buffer.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_BUFFER_H
29 #define MMAL_BUFFER_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
41 /* @{ */
42 
44 typedef struct {
45  uint32_t planes;
46  uint32_t offset[4];
48  uint32_t pitch[4];
50  uint32_t flags;
52  /* TBD stereoscopic support */
54 
56 typedef union
57 {
60 
62 
69 typedef struct MMAL_BUFFER_HEADER_T
70 {
75  uint32_t cmd;
78  uint8_t *data;
80  uint32_t alloc_size;
81  uint32_t length;
83  uint32_t offset;
85  uint32_t flags;
88  int64_t pts;
90  int64_t dts;
96 
97  void *user_data;
100 
104 /* @{ */
106 #define MMAL_BUFFER_HEADER_FLAG_EOS (1<<0)
107 
108 #define MMAL_BUFFER_HEADER_FLAG_FRAME_START (1<<1)
109 
110 #define MMAL_BUFFER_HEADER_FLAG_FRAME_END (1<<2)
111 
112 #define MMAL_BUFFER_HEADER_FLAG_FRAME (MMAL_BUFFER_HEADER_FLAG_FRAME_START|MMAL_BUFFER_HEADER_FLAG_FRAME_END)
113 
114 #define MMAL_BUFFER_HEADER_FLAG_KEYFRAME (1<<3)
115 
117 #define MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY (1<<4)
118 
120 #define MMAL_BUFFER_HEADER_FLAG_CONFIG (1<<5)
121 
122 #define MMAL_BUFFER_HEADER_FLAG_ENCRYPTED (1<<6)
123 
124 #define MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO (1<<7)
125 
126 #define MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT (1<<8)
127 
128 #define MMAL_BUFFER_HEADER_FLAG_CORRUPTED (1<<9)
129 
130 #define MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED (1<<10)
131 
132 #define MMAL_BUFFER_HEADER_FLAG_DECODEONLY (1<<11)
133 
134 #define MMAL_BUFFER_HEADER_FLAG_NAL_END (1<<12)
135 
136 #define MMAL_BUFFER_HEADER_FLAG_USER0 (1<<28)
137 #define MMAL_BUFFER_HEADER_FLAG_USER1 (1<<29)
138 #define MMAL_BUFFER_HEADER_FLAG_USER2 (1<<30)
139 #define MMAL_BUFFER_HEADER_FLAG_USER3 (1<<31)
140 /* @} */
141 
148 #define MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START_BIT 16
149 #define MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START (1<<MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START_BIT)
150 /* @{ */
152 #define MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<0)
153 
154 #define MMAL_BUFFER_HEADER_VIDEO_FLAG_TOP_FIELD_FIRST (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<1)
155 
156 #define MMAL_BUFFER_HEADER_VIDEO_FLAG_DISPLAY_EXTERNAL (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<3)
157 
158 #define MMAL_BUFFER_HEADER_VIDEO_FLAG_PROTECTED (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<4)
159 
162 #define MMAL_BUFFER_HEADER_VIDEO_FLAG_COLUMN_LOG2_SHIFT (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START_BIT+8)
163 #define MMAL_BUFFER_HEADER_VIDEO_FLAG_COLUMN_LOG2_MASK (0xF<<MMAL_BUFFER_HEADER_VIDEO_FLAG_COLUMN_LOG2_SHIFT)
164 /* @} */
165 
175 
182 
195 
203 
217 typedef MMAL_BOOL_T (*MMAL_BH_PRE_RELEASE_CB_T)(MMAL_BUFFER_HEADER_T *header, void *userdata);
218 
228 
239 
247 
255 
256 /* @} */
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #endif /* MMAL_BUFFER_H */
void mmal_buffer_header_release_continue(MMAL_BUFFER_HEADER_T *header)
MMAL_STATUS_T mmal_buffer_header_replicate(MMAL_BUFFER_HEADER_T *dest, MMAL_BUFFER_HEADER_T *src)
MMAL_STATUS_T mmal_buffer_header_mem_lock(MMAL_BUFFER_HEADER_T *header)
struct MMAL_BUFFER_HEADER_T MMAL_BUFFER_HEADER_T
struct MMAL_BUFFER_HEADER_T * next
Definition: mmal_buffer.h:71
void mmal_buffer_header_release(MMAL_BUFFER_HEADER_T *header)
void mmal_buffer_header_reset(MMAL_BUFFER_HEADER_T *header)
MMAL_BUFFER_HEADER_TYPE_SPECIFIC_T * type
Definition: mmal_buffer.h:95
MMAL_BOOL_T(* MMAL_BH_PRE_RELEASE_CB_T)(MMAL_BUFFER_HEADER_T *header, void *userdata)
Definition: mmal_buffer.h:217
void mmal_buffer_header_mem_unlock(MMAL_BUFFER_HEADER_T *header)
MMAL_BUFFER_HEADER_VIDEO_SPECIFIC_T video
Definition: mmal_buffer.h:59
void mmal_buffer_header_acquire(MMAL_BUFFER_HEADER_T *header)
int32_t MMAL_BOOL_T
Definition: mmal_common.h:60
MMAL_STATUS_T
Definition: mmal_types.h:46
void mmal_buffer_header_pre_release_cb_set(MMAL_BUFFER_HEADER_T *header, MMAL_BH_PRE_RELEASE_CB_T cb, void *userdata)
struct MMAL_BUFFER_HEADER_PRIVATE_T * priv
Definition: mmal_buffer.h:73