]> git.sesse.net Git - vlc/blob - include/video_output.h
YUV en couleurs.
[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_convert_t: convertion function
29  *******************************************************************************
30  * This is the prototype common to all convertion functions. The type of p_pic
31  * will change depending of the screen depth treated.
32  * Parameters:
33  *      p_vout                  video output thread
34  *      p_pic                   picture address (start address in picture)
35  *      p_y, p_u, p_v           Y,U,V samples addresses
36  *      i_width                 Y samples width
37  *      i_height                Y samples height
38  *      i_eol                   number of Y samples to reach the next line 
39  *      i_pic_eol               number or pixels to reach the next line
40  *      i_scale                 if non 0, vertical scaling is 1 - 1/i_scale
41  *      i_matrix_coefficients   matrix coefficients
42  * Conditions:
43  *      start x + i_width                        <  picture width
44  *      start y + i_height * (scaling factor)    <  picture height
45  *      i_width % 16                             == 0
46  *******************************************************************************/
47 typedef void (vout_convert_t)( p_vout_thread_t p_vout, void *p_pic,
48                                yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
49                                int i_width, int i_height, int i_eol, int i_pic_eol,
50                                int i_scale, int i_matrix_coefficients );
51
52 /*******************************************************************************
53  * vout_scale_t: scaling function
54  *******************************************************************************
55  * When a picture can't be scaled unsing the fast i_y_scale parameter of a
56  * transformation, it is rendered in a temporary buffer then scaled using a
57  * totally accurate (but also very slow) method.
58  * This is the prototype common to all scaling functions. The types of p_buffer
59  * and p_pic will change depending of the screen depth treated.
60  * Parameters:
61  *      p_vout                  video output thread
62  *      p_pic                   picture address (start address in picture)
63  *      p_buffer                source picture
64  *      i_width                 buffer width
65  *      i_height                buffer height
66  *      i_eol                   number of pixels to reach next buffer line
67  *      i_pic_eol               number of pixels to reach next picture line
68  *      f_alpha, f_beta         horizontal and vertical scaling factors
69  *******************************************************************************/
70 typedef void (vout_scale_t)( p_vout_thread_t p_vout, void *p_pic, void *p_buffer, 
71                              int i_width, int i_height, int i_eol, int i_pic_eol,
72                              float f_alpha, float f_beta );
73
74 /*******************************************************************************
75  * vout_thread_t: video output thread descriptor
76  *******************************************************************************
77  * Any independant video output device, such as an X11 window or a GGI device,
78  * is represented by a video output thread, and described using following 
79  * structure.
80  *******************************************************************************/
81 typedef struct vout_thread_s
82 {
83     /* Thread properties and lock */
84     boolean_t           b_die;                                   /* `die' flag */
85     boolean_t           b_error;                               /* `error' flag */
86     boolean_t           b_active;                             /* `active' flag */
87     pthread_t           thread_id;                 /* id for pthread functions */
88     pthread_mutex_t     lock;                                   /* thread lock */
89     int *               pi_status;                    /* temporary status flag */
90     p_vout_sys_t        p_sys;                         /* system output method */
91
92     /* Current display properties */
93     boolean_t           b_info;              /* print additionnal informations */    
94     boolean_t           b_grayscale;             /* color or grayscale display */    
95     int                 i_width;                /* current output method width */
96     int                 i_height;              /* current output method height */
97     int                 i_bytes_per_line;/* bytes per line (including virtual) */    
98     int                 i_screen_depth;              /* bits per pixel - FIXED */
99     int                 i_bytes_per_pixel;        /* real screen depth - FIXED */
100     float               f_x_ratio;                 /* horizontal display ratio */
101     float               f_y_ratio;                   /* vertical display ratio */
102     float               f_gamma;                                      /* gamma */    
103
104     /* Changed properties values - some of them are treated directly by the
105      * thread, the over may be ignored or handled by vout_SysManage */
106     //?? info, grayscale, width, height, bytes per line, x ratio, y ratio, gamma
107     boolean_t           b_gamma_change;              /* gamma change indicator */    
108     int                 i_new_width;                              /* new width */    
109     int                 i_new_height;                            /* new height */    
110
111 #ifdef STATS    
112     /* Statistics - these numbers are not supposed to be accurate, but are a
113      * good indication of the thread status */
114     count_t             c_loops;                            /* number of loops */
115     count_t             c_idle_loops;                  /* number of idle loops */
116     count_t             c_fps_samples;                       /* picture counts */    
117     mtime_t             fps_sample[ VOUT_FPS_SAMPLES ];   /* FPS samples dates */
118 #endif
119
120 #ifdef DEBUG_VIDEO
121     /* Additionnal video debugging informations */
122     mtime_t             picture_render_time;    /* last picture rendering time */
123 #endif
124  
125     /* Video heap and translation tables */
126     picture_t           p_picture[VOUT_MAX_PICTURES];              /* pictures */
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     vout_scale_t *      p_Scale;                                     /* scaler */
132 } vout_thread_t;
133
134 /*******************************************************************************
135  * Prototypes
136  *******************************************************************************/
137 vout_thread_t * vout_CreateThread               ( 
138 #ifdef VIDEO_X11
139                                                   char *psz_display, Window root_window, 
140 #endif
141                                                   int i_width, int i_height, int *pi_status
142                                                 );
143
144 void            vout_DestroyThread              ( vout_thread_t *p_vout, int *pi_status );
145
146 picture_t *     vout_CreatePicture              ( vout_thread_t *p_vout, int i_type, 
147                                                   int i_width, int i_height );
148 void            vout_DestroyPicture             ( vout_thread_t *p_vout, picture_t *p_pic );
149 void            vout_DisplayPicture             ( vout_thread_t *p_vout, picture_t *p_pic );
150 void            vout_LinkPicture                ( vout_thread_t *p_vout, picture_t *p_pic );
151 void            vout_UnlinkPicture              ( vout_thread_t *p_vout, picture_t *p_pic );
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168