QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vlc_picture.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_picture.h: picture definitions
3  *****************************************************************************
4  * Copyright (C) 1999 - 2009 VLC authors and VideoLAN
5  * $Id: c99f54d7212b39689a8027c64cc92b40442cf080 $
6  *
7  * Authors: Vincent Seguin <seguin@via.ecp.fr>
8  * Samuel Hocevar <sam@via.ecp.fr>
9  * Olivier Aubert <oaubert 47 videolan d07 org>
10  *
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25 
26 #ifndef VLC_PICTURE_H
27 #define VLC_PICTURE_H 1
28 
34 #include <vlc_es.h>
35 #include <vlc_atomic.h>
36 
38 typedef struct plane_t
39 {
40  uint8_t *p_pixels;
42  /* Variables used for fast memcpy operations */
43  int i_lines;
44  int i_pitch;
48 
49  /* Variables used for pictures with margins */
53 } plane_t;
54 
58 #define PICTURE_PLANE_MAX (VOUT_MAX_PLANES)
59 
60 
65 
69 struct picture_t
70 {
75 
77  int i_planes;
84  bool b_force;
93  unsigned int i_nb_fields;
98  picture_sys_t * p_sys;
99 
101  struct
102  {
103  vlc_atomic_t refcount;
104  void (*pf_destroy)( picture_t * );
106  } gc;
107 
109  struct picture_t *p_next;
110 };
111 
118 VLC_API picture_t * picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den ) VLC_USED;
119 
126 VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USED;
127 
131 typedef struct
132 {
133  picture_sys_t *p_sys;
134 
135  /* Plane resources
136  * XXX all fields MUST be set to the right value.
137  */
138  struct
139  {
140  uint8_t *p_pixels;
141  int i_lines;
142  int i_pitch;
143  } p[PICTURE_PLANE_MAX];
144 
146 
152 VLC_API picture_t * picture_NewFromResource( const video_format_t *, const picture_resource_t * ) VLC_USED;
153 
160 VLC_API picture_t *picture_Hold( picture_t *p_picture );
161 
166 VLC_API void picture_Release( picture_t *p_picture );
167 
174 VLC_API bool picture_IsReferenced( picture_t *p_picture );
175 
179 VLC_API void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src );
180 
185 VLC_API void picture_Reset( picture_t * );
186 
192 VLC_API void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src );
193 VLC_API void plane_CopyPixels( plane_t *p_dst, const plane_t *p_src );
194 
204 VLC_API void picture_Copy( picture_t *p_dst, const picture_t *p_src );
205 
222 VLC_API int picture_Export( vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height );
223 
235 VLC_API int picture_Setup( picture_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den );
236 
237 
247 VLC_API void picture_BlendSubpicture( picture_t *, filter_t *p_blend, subpicture_t * );
248 
249 
250 /*****************************************************************************
251  * Shortcuts to access image components
252  *****************************************************************************/
253 
254 /* Plane indices */
255 enum
256 {
257  Y_PLANE = 0,
258  U_PLANE = 1,
259  V_PLANE = 2,
260  A_PLANE = 3,
261 };
262 
263 /* Shortcuts */
264 #define Y_PIXELS p[Y_PLANE].p_pixels
265 #define Y_PITCH p[Y_PLANE].i_pitch
266 #define U_PIXELS p[U_PLANE].p_pixels
267 #define U_PITCH p[U_PLANE].i_pitch
268 #define V_PIXELS p[V_PLANE].p_pixels
269 #define V_PITCH p[V_PLANE].i_pitch
270 #define A_PIXELS p[A_PLANE].p_pixels
271 #define A_PITCH p[A_PLANE].i_pitch
272 
275 #endif /* VLC_PICTURE_H */
int i_visible_lines
Definition: vlc_picture.h:50
bool b_progressive
Definition: vlc_picture.h:91
VLC_API int picture_Setup(picture_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den)
VLC_API void picture_CopyProperties(picture_t *p_dst, const picture_t *p_src)
Definition: vlc_picture.h:69
video_frame_format_t format
Definition: vlc_picture.h:74
mtime_t date
Definition: vlc_picture.h:83
VLC_API void picture_CopyPixels(picture_t *p_dst, const picture_t *p_src)
VLC_API void picture_Copy(picture_t *p_dst, const picture_t *p_src)
uint8_t * p_pixels
Definition: vlc_picture.h:140
int i_pitch
Definition: vlc_picture.h:44
VLC_API bool picture_IsReferenced(picture_t *p_picture)
Definition: vlc_picture.h:131
int i_visible_pitch
Definition: vlc_picture.h:51
Definition: vlc_subpicture.h:136
int i_lines
Definition: vlc_picture.h:141
int i_planes
Definition: vlc_picture.h:77
#define PICTURE_PLANE_MAX
Definition: vlc_picture.h:58
uint8_t * p_pixels
Definition: vlc_picture.h:40
int i_pitch
Definition: vlc_picture.h:142
struct picture_t::@57 gc
VLC_API void picture_BlendSubpicture(picture_t *, filter_t *p_blend, subpicture_t *)
int i_pixel_pitch
Definition: vlc_picture.h:47
VLC_API int picture_Export(vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height)
struct picture_t * p_next
Definition: vlc_picture.h:109
Definition: vlc_es.h:180
int i_lines
Definition: vlc_picture.h:43
VLC_API picture_t * picture_NewFromResource(const video_format_t *, const picture_resource_t *) VLC_USED
Definition: vlc_picture.h:38
bool b_top_field_first
Definition: vlc_picture.h:92
int64_t mtime_t
Definition: vlc_common.h:153
struct plane_t plane_t
Definition: vlc_filter.h:45
uint32_t vlc_fourcc_t
Definition: vlc_common.h:160
picture_sys_t * p_sys
Definition: vlc_picture.h:98
Definition: vlc_block.h:102
plane_t p[PICTURE_PLANE_MAX]
Definition: vlc_picture.h:76
Definition: vlc_atomic.h:313
VLC_API picture_t * picture_NewFromFormat(const video_format_t *p_fmt) VLC_USED
Definition: vlc_objects.h:42
VLC_API picture_t * picture_Hold(picture_t *p_picture)
VLC_API void picture_Release(picture_t *p_picture)
struct picture_gc_sys_t picture_gc_sys_t
Definition: vlc_picture.h:64
VLC_API picture_t * picture_New(vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den) VLC_USED
VLC_API void picture_Reset(picture_t *)
unsigned int i_nb_fields
Definition: vlc_picture.h:93