]> git.sesse.net Git - vlc/blob - include/video_output.h
Nouvelle interface, effacement des zones modifi�es d'une image sur 2,
[vlc] / include / video_output.h
1 /*******************************************************************************
2  * video_output.h : video output thread
3  * (c)1999 VideoLAN
4  *******************************************************************************
5  * This module describes the programming interface for video output threads.
6  * It includes functions allowing to open a new thread, send pictures to a
7  * thread, and destroy a previously oppenned video output thread.
8  *******************************************************************************/
9
10 /*******************************************************************************
11  * vout_tables_t: pre-calculated convertion tables
12  *******************************************************************************
13  * These tables are used by convertion and scaling functions.
14  *******************************************************************************/
15 typedef struct vout_tables_s
16 {
17     void *              p_base;             /* base for all translation tables */    
18     union 
19     {        
20         struct { u16 *p_red, *p_green, *p_blue; } rgb16;   /* color 15, 16 bpp */
21         struct { u32 *p_red, *p_green, *p_blue; } rgb32;   /* color 24, 32 bpp */
22         struct { u16 *p_gray; }                   gray16;   /* gray 15, 16 bpp */
23         struct { u32 *p_gray; }                   gray32;   /* gray 24, 32 bpp */
24     } yuv;    
25 } vout_tables_t;
26
27 /*******************************************************************************
28  * vout_buffer_t: rendering buffer
29  *******************************************************************************
30  * This structure store informations about a buffer. Buffers are not completely
31  * cleared between displays, and modified areas needs to be stored.
32  *******************************************************************************/
33 typedef struct vout_buffer_s
34 {     
35     /* Picture area */
36     int         i_pic_x, i_pic_y;                         /* picture position  */
37     int         i_pic_width, i_pic_height;                /* picture extension */
38     
39     /* Other areas - only vertical extensions of areas are stored */
40     int         i_areas;                                    /* number of areas */    
41     int         pi_area_begin[VOUT_MAX_AREAS];            /* beginning of area */ 
42     int         pi_area_end[VOUT_MAX_AREAS];                    /* end of area */
43     
44     /* Picture data */
45     byte_t *    p_data;                                      /* memory address */
46 } vout_buffer_t;
47
48 /*******************************************************************************
49  * vout_convert_t: convertion function
50  *******************************************************************************
51  * This is the prototype common to all convertion functions. The type of p_pic
52  * will change depending of the screen depth treated.
53  * Parameters:
54  *      p_vout                  video output thread
55  *      p_pic                   picture address (start address in picture)
56  *      p_y, p_u, p_v           Y,U,V samples addresses
57  *      i_width                 Y samples width
58  *      i_height                Y samples height
59  *      i_eol                   number of Y samples to reach the next line 
60  *      i_pic_eol               number or pixels to reach the next line
61  *      i_scale                 if non 0, vertical scaling is 1 - 1/i_scale
62  *      i_matrix_coefficients   matrix coefficients
63  * Conditions:
64  *      start x + i_width                        <  picture width
65  *      start y + i_height * (scaling factor)    <  picture height
66  *      i_width % 16                             == 0
67  *******************************************************************************/
68 typedef void (vout_convert_t)( p_vout_thread_t p_vout, void *p_pic,
69                                yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
70                                int i_width, int i_height, int i_eol, int i_pic_eol,
71                                int i_scale, int i_matrix_coefficients );
72
73 /*******************************************************************************
74  * vout_thread_t: video output thread descriptor
75  *******************************************************************************
76  * Any independant video output device, such as an X11 window or a GGI device,
77  * is represented by a video output thread, and described using following 
78  * structure.
79  *******************************************************************************/
80 typedef struct vout_thread_s
81 {
82     /* Thread properties and lock */
83     boolean_t           b_die;                                   /* `die' flag */
84     boolean_t           b_error;                               /* `error' flag */
85     boolean_t           b_active;                             /* `active' flag */
86     vlc_thread_t        thread_id;                 /* id for pthread functions */
87     vlc_mutex_t         picture_lock;                     /* picture heap lock */
88     vlc_mutex_t         subtitle_lock;                   /* subtitle heap lock */   
89     vlc_mutex_t         change_lock;                     /* thread change lock */    
90     int *               pi_status;                    /* temporary status flag */
91     p_vout_sys_t        p_sys;                         /* system output method */
92
93     /* Current display properties */    
94     int                 i_width;                /* current output method width */
95     int                 i_height;              /* current output method height */
96     int                 i_bytes_per_line;/* bytes per line (including virtual) */
97     int                 i_screen_depth;                      /* bits per pixel */
98     int                 i_bytes_per_pixel;                /* real screen depth */
99     float               f_gamma;                                      /* gamma */
100
101     /* Pictures and rendering properties */
102     boolean_t           b_grayscale;             /* color or grayscale display */   
103     boolean_t           b_info;              /* print additionnal informations */
104     boolean_t           b_interface;                       /* render interface */    
105     boolean_t           b_scale;                      /* allow picture scaling */    
106
107 #ifdef STATS    
108     /* Statistics - these numbers are not supposed to be accurate, but are a
109      * good indication of the thread status */
110     mtime_t             render_time;               /* last picture render time */
111     count_t             c_fps_samples;                       /* picture counts */    
112     mtime_t             p_fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */
113 #endif
114
115     /* Running properties */
116     u16                 i_changes;               /* changes made to the thread */    
117     mtime_t             last_picture_date;        /* last picture display date */
118     mtime_t             last_display_date;         /* last screen display date */    
119
120     /* Rendering buffers */
121     int                 i_buffer_index;                        /* buffer index */
122     vout_buffer_t       p_buffer[2];                     /* buffers properties */
123
124     /* Videos heap and translation tables */
125     picture_t           p_picture[VOUT_MAX_PICTURES];              /* pictures */
126     subtitle_t          p_subtitle[VOUT_MAX_PICTURES];            /* subtitles */    
127     vout_tables_t       tables;                          /* translation tables */
128     vout_convert_t *    p_ConvertYUV420;                /* YUV 4:2:0 converter */
129     vout_convert_t *    p_ConvertYUV422;                /* YUV 4:2:2 converter */
130     vout_convert_t *    p_ConvertYUV444;                /* YUV 4:4:4 converter */
131
132     /* Bitmap fonts */
133     p_vout_font_t       p_default_font;                        /* default font */    
134     p_vout_font_t       p_large_font;                            /* large font */    
135 } vout_thread_t;
136
137 /* Flags for changes - these flags are set in the i_changes field when another
138  * thread changed a variable */
139 #define VOUT_INFO_CHANGE        0x0001                       /* b_info changed */
140 #define VOUT_GRAYSCALE_CHANGE   0x0002                  /* b_grayscale changed */
141 #define VOUT_INTF_CHANGE        0x0004                  /* b_interface changed */
142 #define VOUT_SCALE_CHANGE       0x0008                      /* b_scale changed */
143 #define VOUT_SIZE_CHANGE        0x0200                         /* size changed */
144 #define VOUT_DEPTH_CHANGE       0x0400                        /* depth changed */
145 #define VOUT_GAMMA_CHANGE       0x0010                        /* gamma changed */
146 #define VOUT_NODISPLAY_CHANGE   0xff00      /* changes which forbidden display */
147
148 /*******************************************************************************
149  * Prototypes
150  *******************************************************************************/
151 vout_thread_t * vout_CreateThread       ( char *psz_display, int i_root_window, 
152                                           int i_width, int i_height, int *pi_status );
153 void            vout_DestroyThread      ( vout_thread_t *p_vout, int *pi_status );
154 picture_t *     vout_CreatePicture      ( vout_thread_t *p_vout, int i_type, 
155                                           int i_width, int i_height );
156 void            vout_DestroyPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
157 void            vout_DisplayPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
158 void            vout_DatePicture        ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
159 void            vout_LinkPicture        ( vout_thread_t *p_vout, picture_t *p_pic );
160 void            vout_UnlinkPicture      ( vout_thread_t *p_vout, picture_t *p_pic );
161 subtitle_t *    vout_CreateSubtitle     ( vout_thread_t *p_vout, int i_type, int i_size );
162 void            vout_DestroySubtitle    ( vout_thread_t *p_vout, subtitle_t *p_sub );
163 void            vout_DisplaySubtitle    ( vout_thread_t *p_vout, subtitle_t *p_sub );
164 void            vout_ClearBuffer        ( vout_thread_t *p_vout, vout_buffer_t *p_buffer );
165
166
167
168
169
170
171
172