00001 /***************************************************************************** 00002 * xcommon.h: Defines common to the X11 and XVideo plugins 00003 ***************************************************************************** 00004 * Copyright (C) 1998-2001 the VideoLAN team 00005 * $Id: xcommon.h 11664 2005-07-09 06:17:09Z courmisch $ 00006 * 00007 * Authors: Vincent Seguin <[email protected]> 00008 * Samuel Hocevar <[email protected]> 00009 * David Kennedy <[email protected]> 00010 * Gildas Bazin <[email protected]> 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Defines 00029 *****************************************************************************/ 00030 #ifdef MODULE_NAME_IS_xvideo 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 /* There is nothing like XvDestroyImage */ 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 /***************************************************************************** 00055 * x11_window_t: X11 window descriptor 00056 ***************************************************************************** 00057 * This structure contains all the data necessary to describe an X11 window. 00058 *****************************************************************************/ 00059 typedef struct x11_window_t 00060 { 00061 Window owner_window; /* owner window (if any) */ 00062 Window base_window; /* base window */ 00063 Window video_window; /* sub-window for displaying video */ 00064 GC gc; /* graphic context instance handler */ 00065 00066 unsigned int i_width; /* window width */ 00067 unsigned int i_height; /* window height */ 00068 int i_x; /* window x coordinate */ 00069 int i_y; /* window y coordinate */ 00070 00071 Atom wm_protocols; 00072 Atom wm_delete_window; 00073 00074 #ifdef HAVE_XINERAMA 00075 int i_screen; 00076 #endif 00077 00078 } x11_window_t; 00079 00080 /***************************************************************************** 00081 * vout_sys_t: video output method descriptor 00082 ***************************************************************************** 00083 * This structure is part of the video output thread descriptor. 00084 * It describes the X11 and XVideo specific properties of an output thread. 00085 *****************************************************************************/ 00086 struct vout_sys_t 00087 { 00088 /* Internal settings and properties */ 00089 Display * p_display; /* display pointer */ 00090 00091 Visual * p_visual; /* visual pointer */ 00092 int i_screen; /* screen number */ 00093 00094 vlc_mutex_t lock; 00095 00096 /* Our current window */ 00097 x11_window_t * p_win; 00098 00099 /* Our two windows */ 00100 x11_window_t original_window; 00101 x11_window_t fullscreen_window; 00102 00103 /* X11 generic properties */ 00104 vlc_bool_t b_altfullscreen; /* which fullscreen method */ 00105 #ifdef HAVE_SYS_SHM_H 00106 vlc_bool_t b_shm; /* shared memory extension flag */ 00107 #endif 00108 00109 #ifdef MODULE_NAME_IS_xvideo 00110 int i_xvport; 00111 #else 00112 Colormap colormap; /* colormap used (8bpp only) */ 00113 00114 unsigned int i_screen_depth; 00115 unsigned int i_bytes_per_pixel; 00116 unsigned int i_bytes_per_line; 00117 #endif 00118 00119 /* Screen saver properties */ 00120 unsigned int i_ss_timeout; /* timeout */ 00121 unsigned int i_ss_interval; /* interval between changes */ 00122 unsigned int i_ss_blanking; /* blanking mode */ 00123 unsigned int i_ss_exposure; /* exposure mode */ 00124 #ifdef DPMSINFO_IN_DPMS_H 00125 BOOL b_ss_dpms; /* DPMS mode */ 00126 #endif 00127 00128 /* Mouse pointer properties */ 00129 vlc_bool_t b_mouse_pointer_visible; 00130 mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/ 00131 Cursor blank_cursor; /* the hidden cursor */ 00132 mtime_t i_time_button_last_pressed; /* to track dbl-clicks */ 00133 Pixmap cursor_pixmap; 00134 00135 /* Window manager properties */ 00136 Atom net_wm_state; 00137 Atom net_wm_state_fullscreen; 00138 vlc_bool_t b_net_wm_state_fullscreen; 00139 Atom net_wm_state_above; 00140 vlc_bool_t b_net_wm_state_above; 00141 Atom net_wm_state_stays_on_top; 00142 vlc_bool_t b_net_wm_state_stays_on_top; 00143 Atom net_wm_state_below; 00144 vlc_bool_t b_net_wm_state_below; 00145 00146 #ifdef MODULE_NAME_IS_glx 00147 /* GLX properties */ 00148 int b_glx13; 00149 GLXContext gwctx; 00150 GLXWindow gwnd; 00151 #endif 00152 }; 00153 00154 /***************************************************************************** 00155 * picture_sys_t: direct buffer method descriptor 00156 ***************************************************************************** 00157 * This structure is part of the picture descriptor, it describes the 00158 * XVideo specific properties of a direct buffer. 00159 *****************************************************************************/ 00160 struct picture_sys_t 00161 { 00162 IMAGE_TYPE * p_image; 00163 00164 #ifdef HAVE_SYS_SHM_H 00165 XShmSegmentInfo shminfo; /* shared memory zone information */ 00166 #endif 00167 }; 00168 00169 /***************************************************************************** 00170 * mwmhints_t: window manager hints 00171 ***************************************************************************** 00172 * Fullscreen needs to be able to hide the wm decorations so we provide 00173 * this structure to make it easier. 00174 *****************************************************************************/ 00175 #define MWM_HINTS_DECORATIONS (1L << 1) 00176 #define PROP_MWM_HINTS_ELEMENTS 5 00177 typedef struct mwmhints_t 00178 { 00179 uint32_t flags; 00180 uint32_t functions; 00181 uint32_t decorations; 00182 int32_t input_mode; 00183 uint32_t status; 00184 00185 } mwmhints_t; 00186 00187 /***************************************************************************** 00188 * Chroma defines 00189 *****************************************************************************/ 00190 #ifdef MODULE_NAME_IS_xvideo 00191 # define MAX_DIRECTBUFFERS 10 00192 #else 00193 # define MAX_DIRECTBUFFERS 2 00194 #endif 00195