00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #if defined(MODULE_NAME_IS_xvmc)
00031 # define IMAGE_TYPE XvImage
00032 # define EXTRA_ARGS int i_xvport, int i_chroma, int i_bits_per_pixel
00033 # define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm
00034 # define DATA_SIZE(p) (p)->data_size
00035 # define IMAGE_FREE XFree
00036 #else
00037 # define IMAGE_TYPE XImage
00038 # define EXTRA_ARGS Visual *p_visual, int i_depth, int i_bytes_per_pixel
00039 # define EXTRA_ARGS_SHM Visual *p_visual, int i_depth, XShmSegmentInfo *p_shm
00040 # define DATA_SIZE(p) ((p)->bytes_per_line * (p)->height)
00041 # define IMAGE_FREE XDestroyImage
00042 #endif
00043
00044 #define X11_FOURCC( a, b, c, d ) \
00045 ( ((uint32_t)a) | ( ((uint32_t)b) << 8 ) \
00046 | ( ((uint32_t)c) << 16 ) | ( ((uint32_t)d) << 24 ) )
00047 #define VLC2X11_FOURCC( i ) \
00048 X11_FOURCC( ((char *)&i)[0], ((char *)&i)[1], ((char *)&i)[2], \
00049 ((char *)&i)[3] )
00050 #define X112VLC_FOURCC( i ) \
00051 VLC_FOURCC( i & 0xff, (i >> 8) & 0xff, (i >> 16) & 0xff, \
00052 (i >> 24) & 0xff )
00053
00054 struct vout_window_t;
00055
00056
00057
00058
00059
00060
00061 typedef struct x11_window_t
00062 {
00063 struct vout_window_t*owner_window;
00064 Window base_window;
00065 Window video_window;
00066 GC gc;
00067
00068 unsigned int i_width;
00069 unsigned int i_height;
00070 int i_x;
00071 int i_y;
00072
00073 Atom wm_protocols;
00074 Atom wm_delete_window;
00075 } x11_window_t;
00076
00077
00078
00079
00080
00081 #ifdef MODULE_NAME_IS_xvmc
00082
00083 typedef struct
00084 {
00085 uint8_t cb;
00086 uint8_t cr;
00087 uint8_t y;
00088 uint8_t foo;
00089 } clut_t;
00090
00091 #define XX44_PALETTE_SIZE 32
00092 #define OVL_PALETTE_SIZE 256
00093 #define XVMC_MAX_SURFACES 16
00094 #define XVMC_MAX_SUBPICTURES 4
00095 #define FOURCC_IA44 0x34344149
00096 #define FOURCC_AI44 0x34344941
00097
00098 typedef struct
00099 {
00100 unsigned size;
00101 unsigned max_used;
00102 uint32_t cluts[XX44_PALETTE_SIZE];
00103
00104 int lookup_cache[OVL_PALETTE_SIZE*2];
00105 } xx44_palette_t;
00106
00107
00108
00109
00110
00111 void clear_xx44_palette( xx44_palette_t *p );
00112
00113
00114
00115
00116
00117 void xx44_to_xvmc_palette( const xx44_palette_t *p,unsigned char *xvmc_palette,
00118 unsigned first_xx44_entry, unsigned num_xx44_entries,
00119 unsigned num_xvmc_components, char *xvmc_components );
00120
00121 typedef struct
00122 {
00123 vlc_macroblocks_t vlc_mc;
00124 XvMCBlockArray blocks;
00125 int num_blocks;
00126 XvMCMacroBlock *macroblockptr;
00127 XvMCMacroBlock *macroblockbaseptr;
00128 XvMCMacroBlockArray macro_blocks;
00129 int slices;
00130 } xvmc_macroblocks_t;
00131
00132 typedef struct
00133 {
00134 unsigned int mpeg_flags;
00135 unsigned int accel_flags;
00136 unsigned int max_width;
00137 unsigned int max_height;
00138 unsigned int sub_max_width;
00139 unsigned int sub_max_height;
00140 int type_id;
00141 XvImageFormatValues subPicType;
00142 int flags;
00143 } xvmc_capabilities_t;
00144
00145 typedef struct xvmc_surface_handler_s
00146 {
00147 XvMCSurface surfaces[XVMC_MAX_SURFACES];
00148 int surfInUse[XVMC_MAX_SURFACES];
00149 int surfValid[XVMC_MAX_SURFACES];
00150 XvMCSubpicture subpictures[XVMC_MAX_SUBPICTURES];
00151 int subInUse[XVMC_MAX_SUBPICTURES];
00152 int subValid[XVMC_MAX_SUBPICTURES];
00153 pthread_mutex_t mutex;
00154 } xvmc_surface_handler_t;
00155
00156 typedef struct context_lock_s
00157 {
00158 pthread_mutex_t mutex;
00159 pthread_cond_t cond;
00160 int num_readers;
00161 } context_lock_t;
00162
00163 #define XVMCLOCKDISPLAY(display) XLockDisplay(display);
00164 #define XVMCUNLOCKDISPLAY(display) XUnlockDisplay(display);
00165
00166 void xvmc_context_reader_unlock( context_lock_t *c );
00167 void xvmc_context_reader_lock( context_lock_t *c );
00168 void xvmc_context_writer_lock( context_lock_t *c );
00169 void xvmc_context_writer_unlock( context_lock_t *c );
00170 void free_context_lock( context_lock_t *c );
00171 void xxmc_dispose_context( vout_thread_t *p_vout );
00172
00173 int xxmc_xvmc_surface_valid( vout_thread_t *p_vout, XvMCSurface *surf );
00174 void xxmc_xvmc_free_surface( vout_thread_t *p_vout, XvMCSurface *surf );
00175
00176 void xvmc_vld_slice( picture_t *picture );
00177 void xvmc_vld_frame( picture_t *picture );
00178
00179 void xxmc_do_update_frame( picture_t *picture, uint32_t width, uint32_t height,
00180 double ratio, int format, int flags);
00181
00182 int checkXvMCCap( vout_thread_t *p_vout);
00183
00184 XvMCSubpicture *xxmc_xvmc_alloc_subpicture( vout_thread_t *p_vout,
00185 XvMCContext *context, unsigned short width, unsigned short height,
00186 int xvimage_id );
00187
00188 void xxmc_xvmc_free_subpicture( vout_thread_t *p_vout, XvMCSubpicture *sub );
00189 void blend_xx44( uint8_t *dst_img, subpicture_t *sub_img, int dst_width,
00190 int dst_height, int dst_pitch, xx44_palette_t *palette,int ia44);
00191
00192 #endif
00193
00194
00195
00196
00197
00198
00199
00200 struct vout_sys_t
00201 {
00202
00203 Display * p_display;
00204
00205 int i_screen;
00206
00207
00208 x11_window_t window;
00209
00210
00211 #ifdef HAVE_SYS_SHM_H
00212 int i_shm_opcode;
00213 #endif
00214
00215 #if defined(MODULE_NAME_IS_xvmc)
00216 int i_xvport;
00217 bool b_paint_colourkey;
00218 int i_colourkey;
00219 #endif
00220
00221
00222 int i_ss_timeout;
00223 int i_ss_interval;
00224 int i_ss_blanking;
00225 int i_ss_exposure;
00226 #ifdef DPMSINFO_IN_DPMS_H
00227 BOOL b_ss_dpms;
00228 #endif
00229
00230
00231 bool b_mouse_pointer_visible;
00232 mtime_t i_time_mouse_last_moved;
00233 mtime_t i_mouse_hide_timeout;
00234 Cursor blank_cursor;
00235 mtime_t i_time_button_last_pressed;
00236 Pixmap cursor_pixmap;
00237
00238 #ifdef MODULE_NAME_IS_glx
00239
00240 int b_glx13;
00241 GLXContext gwctx;
00242 GLXWindow gwnd;
00243 #endif
00244
00245 #ifdef MODULE_NAME_IS_xvmc
00246
00247 xvmc_macroblocks_t macroblocks;
00248 xvmc_capabilities_t *xvmc_cap;
00249 unsigned int xvmc_num_cap;
00250 unsigned int xvmc_max_subpic_x;
00251 unsigned int xvmc_max_subpic_y;
00252 int xvmc_eventbase;
00253 int xvmc_errbase;
00254 int hwSubpictures;
00255 XvMCSubpicture *old_subpic;
00256 XvMCSubpicture *new_subpic;
00257 xx44_palette_t palette;
00258 int first_overlay;
00259 float cpu_saver;
00260 int cpu_save_enabled;
00261 int reverse_nvidia_palette;
00262 int context_flags;
00263
00264
00265
00266
00267 unsigned xvmc_cur_cap;
00268 int xvmc_backend_subpic;
00269 XvMCContext context;
00270 int contextActive;
00271 xvmc_surface_handler_t xvmc_surf_handler;
00272 unsigned xvmc_mpeg;
00273 unsigned xvmc_accel;
00274 unsigned last_accel_request;
00275 unsigned xvmc_width;
00276 unsigned xvmc_height;
00277 int have_xvmc_autopaint;
00278 int xvmc_xoverlay_type;
00279 int unsigned_intra;
00280
00281
00282
00283
00284 char *xvmc_palette;
00285 XvImage *subImage;
00286 XShmSegmentInfo subShmInfo;
00287
00288
00289
00290
00291
00292 context_lock_t xvmc_lock;
00293 subpicture_t * p_last_subtitle_save;
00294 int xvmc_deinterlace_method;
00295 int xvmc_crop_style;
00296 mtime_t last_date;
00297
00298
00299 #endif
00300
00301 #ifdef HAVE_XSP
00302 int i_hw_scale;
00303 #endif
00304 };
00305
00306
00307
00308
00309
00310
00311
00312 struct picture_sys_t
00313 {
00314 IMAGE_TYPE * p_image;
00315
00316 #ifdef HAVE_SYS_SHM_H
00317 XShmSegmentInfo shminfo;
00318 #endif
00319
00320 #ifdef MODULE_NAME_IS_xvmc
00321 XvMCSurface *xvmc_surf;
00322 vlc_xxmc_t xxmc_data;
00323 int last_sw_format;
00324 vout_thread_t *p_vout;
00325 int nb_display;
00326 #endif
00327 };
00328
00329
00330
00331
00332
00333
00334
00335 #define MWM_HINTS_DECORATIONS (1L << 1)
00336 #define PROP_MWM_HINTS_ELEMENTS 5
00337
00338 typedef struct mwmhints_t
00339 {
00340 unsigned long flags;
00341 unsigned long functions;
00342 unsigned long decorations;
00343 signed long input_mode;
00344 unsigned long status;
00345 } mwmhints_t;
00346
00347
00348
00349
00350 #if defined(MODULE_NAME_IS_xvmc)
00351 # define MAX_DIRECTBUFFERS (VOUT_MAX_PICTURES+2)
00352 #else
00353 # define MAX_DIRECTBUFFERS 2
00354 #endif
00355
00356 #ifndef MODULE_NAME_IS_glx
00357 IMAGE_TYPE *CreateImage ( vout_thread_t *,
00358 Display *, EXTRA_ARGS, int, int );
00359 #ifdef HAVE_SYS_SHM_H
00360 IMAGE_TYPE *CreateShmImage ( vout_thread_t *,
00361 Display *, EXTRA_ARGS_SHM, int, int );
00362 #endif
00363 #endif
00364