1 /*******************************************************************************
2 * video_output.h : video output thread
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 *******************************************************************************/
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
17 void * p_base; /* base for all translation tables */
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 */
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.
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
43 * start x + i_width < picture width
44 * start y + i_height * (scaling factor) < picture height
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 );
52 /*******************************************************************************
53 * vout_thread_t: video output thread descriptor
54 *******************************************************************************
55 * Any independant video output device, such as an X11 window or a GGI device,
56 * is represented by a video output thread, and described using following
58 *******************************************************************************/
59 typedef struct vout_thread_s
61 /* Thread properties and lock */
62 boolean_t b_die; /* `die' flag */
63 boolean_t b_error; /* `error' flag */
64 boolean_t b_active; /* `active' flag */
65 vlc_thread_t thread_id; /* id for pthread functions */
66 vlc_mutex_t picture_lock; /* picture heap lock */
67 vlc_mutex_t subtitle_lock; /* subtitle heap lock */
68 vlc_mutex_t change_lock; /* thread change lock */
69 int * pi_status; /* temporary status flag */
70 p_vout_sys_t p_sys; /* system output method */
72 /* Current display properties */
73 boolean_t b_grayscale; /* color or grayscale display */
74 int i_width; /* current output method width */
75 int i_height; /* current output method height */
76 int i_bytes_per_line;/* bytes per line (including virtual) */
77 int i_screen_depth; /* bits per pixel */
78 int i_bytes_per_pixel; /* real screen depth */
79 float f_gamma; /* gamma */
81 /* Pictures and rendering properties */
82 boolean_t b_info; /* print additionnal informations */
85 /* Statistics - these numbers are not supposed to be accurate, but are a
86 * good indication of the thread status */
87 mtime_t render_time; /* last picture render time */
88 count_t c_fps_samples; /* picture counts */
89 mtime_t fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */
92 /* Running properties */
93 u16 i_changes; /* changes made to the thread */
94 mtime_t last_picture_date; /* last picture display date */
95 mtime_t last_display_date; /* last screen display date */
97 /* Videos heap and translation tables */
98 picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
99 subtitle_t p_subtitle[VOUT_MAX_PICTURES]; /* subtitles */
100 vout_tables_t tables; /* translation tables */
101 vout_convert_t * p_ConvertYUV420; /* YUV 4:2:0 converter */
102 vout_convert_t * p_ConvertYUV422; /* YUV 4:2:2 converter */
103 vout_convert_t * p_ConvertYUV444; /* YUV 4:4:4 converter */
106 /* Flags for changes - these flags are set in the i_changes field when another
107 * thread changed a variable */
108 #define VOUT_INFO_CHANGE 0x0001 /* b_info changed */
109 #define VOUT_GRAYSCALE_CHANGE 0x0002 /* b_grayscale changed */
110 #define VOUT_SIZE_CHANGE 0x0008 /* size changed */
111 #define VOUT_DEPTH_CHANGE 0x0010 /* depth changed */
112 #define VOUT_GAMMA_CHANGE 0x0080 /* gamma changed */
113 #define VOUT_NODISPLAY_CHANGE 0xffff /* changes which forbidden display */
115 /*******************************************************************************
117 *******************************************************************************/
118 vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
119 int i_width, int i_height, int *pi_status );
120 void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
121 picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
122 int i_width, int i_height );
123 void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
124 void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
125 void vout_DatePicture ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
126 void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
127 void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
128 subtitle_t * vout_CreateSubtitle ( vout_thread_t *p_vout, int i_type, int i_size );
129 void vout_DestroySubtitle ( vout_thread_t *p_vout, subtitle_t *p_sub );
130 void vout_DisplaySubtitle ( vout_thread_t *p_vout, subtitle_t *p_sub );