Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

vlc_video.h

00001 /*****************************************************************************
00002  * vlc_video.h: common video definitions
00003  * This header is required by all modules which have to handle pictures. It
00004  * includes all common video types and constants.
00005  *****************************************************************************
00006  * Copyright (C) 1999 - 2005 the VideoLAN team
00007  * $Id: vlc_video.h 12412 2005-08-27 16:40:23Z jpsaman $
00008  *
00009  * Authors: Vincent Seguin <[email protected]>
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00024  *****************************************************************************/
00025 #ifndef _VLC_VIDEO_H
00026 #define _VLC_VIDEO_H 1
00027 
00028 #include "vlc_es.h"
00029 
00033 typedef struct plane_t
00034 {
00035     uint8_t *p_pixels;                        
00037     /* Variables used for fast memcpy operations */
00038     int i_lines;           
00039     int i_pitch;           
00042     int i_pixel_pitch;
00043 
00044     /* Variables used for pictures with margins */
00045     int i_visible_lines;            
00046     int i_visible_pitch;            
00048 } plane_t;
00049 
00058 struct picture_t
00059 {
00063     video_frame_format_t format;
00064 
00068     uint8_t        *p_data;
00069     void           *p_data_orig;                
00070     plane_t         p[ VOUT_MAX_PLANES ];     
00071     int             i_planes;                
00076     int             i_status;                             
00077     int             i_type;                
00078     vlc_bool_t      b_slow;                 
00079     int             i_matrix_coefficients;   
00086     int             i_refcount;                  
00087     mtime_t         date;                                  
00088     vlc_bool_t      b_force;
00095     vlc_bool_t      b_progressive;          
00096     unsigned int    i_nb_fields;                  
00097     vlc_bool_t      b_top_field_first;             
00101     picture_heap_t* p_heap;
00102 
00103     /* Some vouts require the picture to be locked before it can be modified */
00104     int (* pf_lock) ( vout_thread_t *, picture_t * );
00105     int (* pf_unlock) ( vout_thread_t *, picture_t * );
00106 
00109     picture_sys_t * p_sys;
00110 
00112     void (*pf_release)( picture_t * );
00113 
00115     struct picture_t *p_next;
00116 };
00117 
00122 struct picture_heap_t
00123 {
00124     int i_pictures;                                   
00126     /* \name Picture static properties
00127      * Those properties are fixed at initialization and should NOT be modified
00128      * @{
00129      */
00130     unsigned int i_width;                                 
00131     unsigned int i_height;                               
00132     vlc_fourcc_t i_chroma;                               
00133     unsigned int i_aspect;                                 
00136     /* Real pictures */
00137     picture_t*      pp_picture[VOUT_MAX_PICTURES];             
00138     int             i_last_used_pic;              
00139     vlc_bool_t      b_allow_modify_pics;
00140 
00141     /* Stuff used for truecolor RGB planes */
00142     int i_rmask, i_rrshift, i_lrshift;
00143     int i_gmask, i_rgshift, i_lgshift;
00144     int i_bmask, i_rbshift, i_lbshift;
00145 
00147     void (* pf_setpalette) ( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * );
00148 };
00149 
00150 /*****************************************************************************
00151  * Flags used to describe the status of a picture
00152  *****************************************************************************/
00153 
00154 /* Picture type */
00155 #define EMPTY_PICTURE           0                            /* empty buffer */
00156 #define MEMORY_PICTURE          100                 /* heap-allocated buffer */
00157 #define DIRECT_PICTURE          200                         /* direct buffer */
00158 
00159 /* Picture status */
00160 #define FREE_PICTURE            0                  /* free and not allocated */
00161 #define RESERVED_PICTURE        1                  /* allocated and reserved */
00162 #define RESERVED_DATED_PICTURE  2              /* waiting for DisplayPicture */
00163 #define RESERVED_DISP_PICTURE   3               /* waiting for a DatePicture */
00164 #define READY_PICTURE           4                       /* ready for display */
00165 #define DISPLAYED_PICTURE       5            /* been displayed but is linked */
00166 #define DESTROYED_PICTURE       6              /* allocated but no more used */
00167 
00168 /*****************************************************************************
00169  * Shortcuts to access image components
00170  *****************************************************************************/
00171 
00172 /* Plane indices */
00173 #define Y_PLANE      0
00174 #define U_PLANE      1
00175 #define V_PLANE      2
00176 #define A_PLANE      3
00177 
00178 /* Shortcuts */
00179 #define Y_PIXELS     p[Y_PLANE].p_pixels
00180 #define Y_PITCH      p[Y_PLANE].i_pitch
00181 #define U_PIXELS     p[U_PLANE].p_pixels
00182 #define U_PITCH      p[U_PLANE].i_pitch
00183 #define V_PIXELS     p[V_PLANE].p_pixels
00184 #define V_PITCH      p[V_PLANE].i_pitch
00185 #define A_PIXELS     p[A_PLANE].p_pixels
00186 #define A_PITCH      p[A_PLANE].i_pitch
00187 
00203 struct subpicture_region_t
00204 {
00205     video_format_t  fmt;                          
00206     picture_t       picture;             
00208     int             i_x;                             
00209     int             i_y;                             
00211     char            *psz_text;       
00212     int             i_text_color;     
00213     int             i_text_alpha;                     
00214     int             i_text_size;                              
00215     int             i_text_align;         
00217     subpicture_region_t *p_next;                
00218     subpicture_region_t *p_cache;       
00219 };
00220 
00229 struct subpicture_t
00230 {
00233     int             i_channel;                    
00239     int             i_type;                                        
00240     int             i_status;                                     
00241     subpicture_t *  p_next;               
00246     mtime_t         i_start;                  
00247     mtime_t         i_stop;                         
00248     vlc_bool_t      b_ephemer;    
00250     vlc_bool_t      b_fade;                               
00253     subpicture_region_t *p_region;  
00260     int          i_x;                    
00261     int          i_y;                    
00262     int          i_width;                                 
00263     int          i_height;                               
00264     int          i_alpha;                                  
00265     int          i_original_picture_width;  
00266     int          i_original_picture_height;
00267     vlc_bool_t   b_absolute;                       
00268     int          i_flags;                                
00272     void ( *pf_render )  ( vout_thread_t *, picture_t *, const subpicture_t * );
00274     void ( *pf_destroy ) ( subpicture_t * );
00275 
00277     subpicture_region_t * ( *pf_create_region ) ( vlc_object_t *,
00278                                                   video_format_t * );
00279     subpicture_region_t * ( *pf_make_region ) ( vlc_object_t *,
00280                                                 video_format_t *, picture_t * );
00281     void ( *pf_destroy_region ) ( vlc_object_t *, subpicture_region_t * );
00282 
00285     subpicture_sys_t *p_sys;                              /* subpicture data */
00286 };
00287 
00288 /* Subpicture type */
00289 #define EMPTY_SUBPICTURE       0     /* subtitle slot is empty and available */
00290 #define MEMORY_SUBPICTURE      100            /* subpicture stored in memory */
00291 
00292 /* Default subpicture channel ID */
00293 #define DEFAULT_CHAN           1
00294 
00295 /* Subpicture status */
00296 #define FREE_SUBPICTURE        0                   /* free and not allocated */
00297 #define RESERVED_SUBPICTURE    1                   /* allocated and reserved */
00298 #define READY_SUBPICTURE       2                        /* ready for display */
00299 
00300 /* Subpicture position flags */
00301 #define SUBPICTURE_ALIGN_LEFT 0x1
00302 #define SUBPICTURE_ALIGN_RIGHT 0x2
00303 #define SUBPICTURE_ALIGN_TOP 0x4
00304 #define SUBPICTURE_ALIGN_BOTTOM 0x8
00305 
00306 /*****************************************************************************
00307  * Prototypes
00308  *****************************************************************************/
00317 #define vout_CopyPicture(a,b,c) __vout_CopyPicture(VLC_OBJECT(a),b,c)
00318 VLC_EXPORT( void, __vout_CopyPicture, ( vlc_object_t *p_this, picture_t *p_dst, picture_t *p_src ) );
00319 
00331 #define vout_InitPicture(a,b,c,d,e,f) \
00332         __vout_InitPicture(VLC_OBJECT(a),b,c,d,e,f)
00333 VLC_EXPORT( int, __vout_InitPicture, ( vlc_object_t *p_this, picture_t *p_pic, uint32_t i_chroma, int i_width, int i_height, int i_aspect ) );
00334 
00346 #define vout_AllocatePicture(a,b,c,d,e,f) \
00347         __vout_AllocatePicture(VLC_OBJECT(a),b,c,d,e,f)
00348 VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic, uint32_t i_chroma, int i_width, int i_height, int i_aspect ) );
00349 
00363 VLC_EXPORT( int, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
00364 
00381 VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
00382 
00392 VLC_EXPORT( void,  __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) );
00393 
00397 #if defined(HAVE_VARIADIC_MACROS)
00398 #    define vout_OSDMessage( obj, chan, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), chan, fmt, ## args )
00399 #else
00400 #    define vout_OSDMessage __vout_OSDMessage
00401 #endif
00402 
00413 VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
00414 
00424 VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) );
00425 
00428 #endif /* _VLC_VIDEO_H */

Generated on Tue Dec 20 10:14:20 2005 for vlc-0.8.4a by  doxygen 1.4.2