00001 /***************************************************************************** 00002 * vlc_vout_window.h: vout_window_t definitions 00003 ***************************************************************************** 00004 * Copyright (C) 2008 Rémi Denis-Courmont 00005 * Copyright (C) 2009 Laurent Aimar 00006 * $Id: 3d7e92966bfa7b430578542eaff498b7d839dfa6 $ 00007 * 00008 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00023 *****************************************************************************/ 00024 00025 #ifndef VLC_VOUT_WINDOW_H 00026 #define VLC_VOUT_WINDOW_H 1 00027 00028 /** 00029 * \file 00030 * This file defines vout windows structures and functions in vlc 00031 */ 00032 00033 #include <vlc_common.h> 00034 00035 /* */ 00036 typedef struct vout_window_t vout_window_t; 00037 typedef struct vout_window_sys_t vout_window_sys_t; 00038 00039 00040 /** 00041 * Window handle type 00042 */ 00043 enum { 00044 VOUT_WINDOW_TYPE_XID, 00045 VOUT_WINDOW_TYPE_HWND, 00046 VOUT_WINDOW_TYPE_NSOBJECT, 00047 }; 00048 00049 /** 00050 * Control query for vout_window_t 00051 */ 00052 enum { 00053 VOUT_WINDOW_SET_STATE, /* unsigned state */ 00054 VOUT_WINDOW_SET_SIZE, /* unsigned i_width, unsigned i_height */ 00055 VOUT_WINDOW_SET_FULLSCREEN, /* int b_fullscreen */ 00056 }; 00057 00058 typedef struct { 00059 /* If true, a standalone window is requested */ 00060 bool is_standalone; 00061 00062 /* Window handle type */ 00063 int type; 00064 00065 /* Window position hint */ 00066 int x; 00067 int y; 00068 00069 /* Windows size hint */ 00070 unsigned width; 00071 unsigned height; 00072 00073 } vout_window_cfg_t; 00074 00075 /** 00076 * FIXME do we need an event system in the window too ? 00077 * or the window user will take care of it ? 00078 */ 00079 struct vout_window_t { 00080 VLC_COMMON_MEMBERS 00081 00082 /* Initial state (reserved). 00083 * Once the open function is called, it will be set to NULL 00084 */ 00085 const vout_window_cfg_t *cfg; 00086 00087 /* window handle (mandatory) 00088 * 00089 * It must be filled in the open function. 00090 */ 00091 union { 00092 void *hwnd; /* Win32 window handle */ 00093 uint32_t xid; /* X11 windows ID */ 00094 void *nsobject; /* Mac OSX view object */ 00095 } handle; 00096 00097 /* display server (mandatory) */ 00098 union { 00099 char *x11; /* X11 display (NULL = use default) */ 00100 } display; 00101 00102 /* Control on the module (mandatory) 00103 * 00104 * Do not use it directly; use vout_window_Control instead. 00105 */ 00106 int (*control)(vout_window_t *, int query, va_list); 00107 00108 /* Private place holder for the vout_window_t module (optional) 00109 * 00110 * A module is free to use it as it wishes. 00111 */ 00112 vout_window_sys_t *sys; 00113 }; 00114 00115 /** 00116 * It creates a new window. 00117 * 00118 * @note If you are inside a "vout display", you must use 00119 * vout_display_New/DeleteWindow when possible to allow window recycling. 00120 */ 00121 VLC_EXPORT( vout_window_t *, vout_window_New, (vlc_object_t *, const char *module, const vout_window_cfg_t *) ); 00122 00123 /** 00124 * It deletes a window created by vout_window_New(). 00125 * 00126 * @note See vout_window_New() about window recycling. 00127 */ 00128 VLC_EXPORT( void, vout_window_Delete, (vout_window_t *) ); 00129 00130 /** 00131 * It allows configuring a window. 00132 * 00133 * @warning The caller must own the window, as vout_window_t is not thread safe. 00134 * You should use it the vout_window_* wrappers instead of this function. 00135 */ 00136 VLC_EXPORT( int, vout_window_Control, (vout_window_t *, int query, ...) ); 00137 00138 /** 00139 * Configure the window management state of a windows. 00140 */ 00141 static inline int vout_window_SetState(vout_window_t *window, unsigned state) 00142 { 00143 return vout_window_Control(window, VOUT_WINDOW_SET_STATE, state); 00144 } 00145 00146 /** 00147 * Configure the windows display size. 00148 */ 00149 static inline int vout_window_SetSize(vout_window_t *window, 00150 unsigned width, unsigned height) 00151 { 00152 return vout_window_Control(window, VOUT_WINDOW_SET_SIZE, width, height); 00153 } 00154 00155 /** 00156 * Configure the windows fullscreen mode. 00157 */ 00158 static inline int vout_window_SetFullScreen(vout_window_t *window, bool full) 00159 { 00160 return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full); 00161 } 00162 00163 #endif /* VLC_VOUT_WINDOW_H */ 00164
1.5.6