]> git.sesse.net Git - vlc/blob - include/video_output.h
Temporaire (�a segfaulte si on le chatouille un peu).
[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_yuv_convert_t: YUV convertion function
12  *******************************************************************************
13  * This is the prototype common to all convertion functions. The type of p_pic
14  * will change depending of the screen depth treated.
15  * Parameters:
16  *      p_vout                          video output thread
17  *      p_pic                           picture address 
18  *      p_y, p_u, p_v                   Y,U,V samples addresses
19  *      i_width, i_height               Y samples extension
20  *      i_pic_width, i_pic_height       picture extension
21  *      i_pic_line_width                picture total line width
22  *      i_matrix_coefficients           matrix coefficients
23  *******************************************************************************/
24 typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
25                                    yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
26                                    int i_width, int i_height,
27                                    int i_pic_width, int i_pic_height, int i_pic_skip,
28                                    int i_matrix_coefficients );
29
30 /*******************************************************************************
31  * vout_yuv_t: pre-calculated YUV convertion tables
32  *******************************************************************************
33  * These tables are used by convertion and scaling functions.
34  *******************************************************************************/
35 typedef struct vout_yuv_s
36 {
37     /* Convertion functions */
38     vout_yuv_convert_t *        p_Convert420;           /* YUV 4:2:0 converter */
39     vout_yuv_convert_t *        p_Convert422;           /* YUV 4:2:2 converter */
40     vout_yuv_convert_t *        p_Convert444;           /* YUV 4:4:4 converter */
41
42     /* Pre-calculated convertion tables */
43     void *              p_base;             /* base for all translation tables */    
44     union 
45     {        
46         struct { u16 *p_red, *p_green, *p_blue; } rgb16;   /* color 15, 16 bpp */
47         struct { u32 *p_red, *p_green, *p_blue; } rgb32;   /* color 24, 32 bpp */
48         struct { u16 *p_gray; }                   gray16;   /* gray 15, 16 bpp */
49         struct { u32 *p_gray; }                   gray32;   /* gray 24, 32 bpp */
50     } yuv;
51     union
52     {
53         u16 *           p_rgb16;
54         u32 *           p_rgb32;        
55     } yuv2;//??    
56
57     /* Temporary convertion buffer - this buffer may be used by convertion
58      * functions and should be 2 screen lines width */
59     void *              p_buffer;                         /* convertion buffer */    
60 } vout_yuv_t;
61
62 /*******************************************************************************
63  * vout_buffer_t: rendering buffer
64  *******************************************************************************
65  * This structure store informations about a buffer. Buffers are not completely
66  * cleared between displays, and modified areas needs to be stored.
67  *******************************************************************************/
68 typedef struct vout_buffer_s
69 {     
70     /* Picture area */
71     int         i_pic_x, i_pic_y;                         /* picture position  */
72     int         i_pic_width, i_pic_height;                /* picture extension */
73     
74     /* Other areas - only vertical extensions of areas are stored */
75     int         i_areas;                                    /* number of areas */    
76     int         pi_area_begin[VOUT_MAX_AREAS];            /* beginning of area */ 
77     int         pi_area_end[VOUT_MAX_AREAS];                    /* end of area */
78     
79     /* Picture data */
80     byte_t *    p_data;                                      /* memory address */
81 } vout_buffer_t;
82
83 /*******************************************************************************
84  * vout_thread_t: video output thread descriptor
85  *******************************************************************************
86  * Any independant video output device, such as an X11 window or a GGI device,
87  * is represented by a video output thread, and described using following 
88  * structure.
89  *******************************************************************************/
90 typedef struct vout_thread_s
91 {
92     /* Thread properties and lock */
93     boolean_t           b_die;                                   /* `die' flag */
94     boolean_t           b_error;                               /* `error' flag */
95     boolean_t           b_active;                             /* `active' flag */
96     vlc_thread_t        thread_id;                 /* id for pthread functions */
97     vlc_mutex_t         picture_lock;                     /* picture heap lock */
98     vlc_mutex_t         subpicture_lock;               /* subpicture heap lock */   
99     vlc_mutex_t         change_lock;                     /* thread change lock */    
100     int *               pi_status;                    /* temporary status flag */
101     p_vout_sys_t        p_sys;                         /* system output method */
102
103     /* Current display properties */    
104     u16                 i_changes;               /* changes made to the thread */    
105     int                 i_width;                /* current output method width */
106     int                 i_height;              /* current output method height */
107     int                 i_bytes_per_line;/* bytes per line (including virtual) */
108     int                 i_screen_depth;                      /* bits per pixel */
109     int                 i_bytes_per_pixel;                /* real screen depth */
110     float               f_gamma;                                      /* gamma */
111
112     /* Pictures and rendering properties */
113     boolean_t           b_grayscale;             /* color or grayscale display */   
114     boolean_t           b_info;              /* print additionnal informations */
115     boolean_t           b_interface;                       /* render interface */    
116     boolean_t           b_scale;                      /* allow picture scaling */    
117
118     /* Idle screens management */
119     mtime_t             last_display_date;       /* last non idle display date */
120     mtime_t             last_idle_date;              /* last idle display date */
121
122 #ifdef STATS    
123     /* Statistics - these numbers are not supposed to be accurate, but are a
124      * good indication of the thread status */
125     mtime_t             render_time;               /* last picture render time */
126     count_t             c_fps_samples;                       /* picture counts */    
127     mtime_t             p_fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */
128 #endif
129
130     /* Rendering buffers */
131     int                 i_buffer_index;                        /* buffer index */
132     vout_buffer_t       p_buffer[2];                     /* buffers properties */
133
134     /* Videos heap and translation tables */
135     picture_t           p_picture[VOUT_MAX_PICTURES];              /* pictures */
136     subpicture_t        p_subpicture[VOUT_MAX_PICTURES];        /* subpictures */    
137     vout_yuv_t          yuv;                             /* translation tables */
138
139     /* Bitmap fonts */
140     p_vout_font_t       p_default_font;                        /* default font */    
141     p_vout_font_t       p_large_font;                            /* large font */    
142 } vout_thread_t;
143
144 /* Flags for changes - these flags are set in the i_changes field when another
145  * thread changed a variable */
146 #define VOUT_INFO_CHANGE        0x0001                       /* b_info changed */
147 #define VOUT_GRAYSCALE_CHANGE   0x0002                  /* b_grayscale changed */
148 #define VOUT_INTF_CHANGE        0x0004                  /* b_interface changed */
149 #define VOUT_SCALE_CHANGE       0x0008                      /* b_scale changed */
150 #define VOUT_SIZE_CHANGE        0x0200                         /* size changed */
151 #define VOUT_DEPTH_CHANGE       0x0400                        /* depth changed */
152 #define VOUT_GAMMA_CHANGE       0x0010                        /* gamma changed */
153 #define VOUT_YUV_CHANGE         0x0800                    /* change yuv tables */
154 #define VOUT_NODISPLAY_CHANGE   0xff00      /* changes which forbidden display */
155
156 /*******************************************************************************
157  * Prototypes
158  *******************************************************************************/
159 vout_thread_t * vout_CreateThread       ( char *psz_display, int i_root_window, 
160                                           int i_width, int i_height, int *pi_status );
161 void            vout_DestroyThread      ( vout_thread_t *p_vout, int *pi_status );
162 picture_t *     vout_CreatePicture      ( vout_thread_t *p_vout, int i_type, 
163                                           int i_width, int i_height );
164 void            vout_DestroyPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
165 void            vout_DisplayPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
166 void            vout_DatePicture        ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
167 void            vout_LinkPicture        ( vout_thread_t *p_vout, picture_t *p_pic );
168 void            vout_UnlinkPicture      ( vout_thread_t *p_vout, picture_t *p_pic );
169 subpicture_t *  vout_CreateSubPicture   ( vout_thread_t *p_vout, int i_type, int i_size );
170 void            vout_DestroySubPicture  ( vout_thread_t *p_vout, subpicture_t *p_subpic );
171 void            vout_DisplaySubPicture  ( vout_thread_t *p_vout, subpicture_t *p_subpic );
172
173 void            vout_SetBuffers         ( vout_thread_t *p_vout, void *p_buf1, void *p_buf2 );