common.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * common.h: Windows video output header file
00003  *****************************************************************************
00004  * Copyright (C) 2001-2009 the VideoLAN team
00005  * $Id: 291d8e04bf98dd32271a3bece07e7413e46dd5db $
00006  *
00007  * Authors: Gildas Bazin <gbazin@videolan.org>
00008  *          Damien Fouilleul <damienf@videolan.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 /*****************************************************************************
00026  * event_thread_t: event thread
00027  *****************************************************************************/
00028 #include <vlc_picture_pool.h>
00029 #include "events.h"
00030 
00031 #ifdef MODULE_NAME_IS_wingapi
00032     typedef struct GXDisplayProperties {
00033         DWORD cxWidth;
00034         DWORD cyHeight;
00035         long cbxPitch;
00036         long cbyPitch;
00037         long cBPP;
00038         DWORD ffFormat;
00039     } GXDisplayProperties;
00040 
00041     typedef struct GXScreenRect {
00042         DWORD dwTop;
00043         DWORD dwLeft;
00044         DWORD dwWidth;
00045         DWORD dwHeight;
00046     } GXScreenRect;
00047 
00048 #   define GX_FULLSCREEN    0x01
00049 #   define GX_NORMALKEYS    0x02
00050 #   define GX_LANDSCAPEKEYS 0x03
00051 
00052 #   ifndef kfLandscape
00053 #       define kfLandscape      0x8
00054 #       define kfPalette        0x10
00055 #       define kfDirect         0x20
00056 #       define kfDirect555      0x40
00057 #       define kfDirect565      0x80
00058 #       define kfDirect888      0x100
00059 #       define kfDirect444      0x200
00060 #       define kfDirectInverted 0x400
00061 #   endif
00062 
00063 #endif
00064 
00065 /*****************************************************************************
00066  * vout_sys_t: video output method descriptor
00067  *****************************************************************************
00068  * This structure is part of the video output thread descriptor.
00069  * It describes the module specific properties of an output thread.
00070  *****************************************************************************/
00071 struct vout_display_sys_t
00072 {
00073     /* */
00074     event_thread_t *event;
00075 
00076     /* */
00077     HWND                 hwnd;                  /* Handle of the main window */
00078     HWND                 hvideownd;        /* Handle of the video sub-window */
00079     struct vout_window_t *parent_window;         /* Parent window VLC object */
00080     HWND                 hparent;             /* Handle of the parent window */
00081     HWND                 hfswnd;          /* Handle of the fullscreen window */
00082 
00083     /* size of the display */
00084     RECT         rect_display;
00085     int          display_depth;
00086 
00087     /* size of the overall window (including black bands) */
00088     RECT         rect_parent;
00089 
00090     unsigned changes;        /* changes made to the video display */
00091 
00092     /* Misc */
00093     bool is_first_display;
00094     bool is_on_top;
00095 
00096 #ifndef UNDER_CE
00097 
00098     /* screensaver system settings to be restored when vout is closed */
00099     UINT i_spi_lowpowertimeout;
00100     UINT i_spi_powerofftimeout;
00101     UINT i_spi_screensavetimeout;
00102 
00103 #endif
00104 
00105     /* Coordinates of src and dest images (used when blitting to display) */
00106     RECT         rect_src;
00107     RECT         rect_src_clipped;
00108     RECT         rect_dest;
00109     RECT         rect_dest_clipped;
00110 
00111     picture_pool_t *pool;
00112 
00113 #ifdef MODULE_NAME_IS_directx
00114     /* Multi-monitor support */
00115     HMONITOR             hmonitor;          /* handle of the current monitor */
00116     GUID                 *display_driver;
00117     HMONITOR             (WINAPI* MonitorFromWindow)(HWND, DWORD);
00118     BOOL                 (WINAPI* GetMonitorInfo)(HMONITOR, LPMONITORINFO);
00119 
00120     /* Overlay alignment restrictions */
00121     int          i_align_src_boundary;
00122     int          i_align_src_size;
00123     int          i_align_dest_boundary;
00124     int          i_align_dest_size;
00125 
00126     bool   use_wallpaper;   /* show as desktop wallpaper ? */
00127 
00128     bool   use_overlay;     /* Are we using an overlay surface */
00129 
00130     /* DDraw capabilities */
00131     bool            can_blit_fourcc;
00132 
00133     uint32_t        i_rgb_colorkey;      /* colorkey in RGB used by the overlay */
00134     uint32_t        i_colorkey;                 /* colorkey used by the overlay */
00135 
00136     COLORREF        color_bkg;
00137     COLORREF        color_bkgtxt;
00138 
00139     LPDIRECTDRAW2        ddobject;                    /* DirectDraw object */
00140     LPDIRECTDRAWSURFACE2 display;                        /* Display device */
00141     LPDIRECTDRAWCLIPPER  clipper;             /* clipper used for blitting */
00142     HINSTANCE            hddraw_dll;       /* handle of the opened ddraw dll */
00143 
00144     picture_resource_t   resource;
00145 
00146     /* It protects the following variables */
00147     vlc_mutex_t    lock;
00148     bool           ch_wallpaper;
00149     bool           wallpaper_requested;
00150 #endif
00151 
00152 #ifdef MODULE_NAME_IS_glwin32
00153     HDC                   hGLDC;
00154     HGLRC                 hGLRC;
00155     vout_opengl_t         gl;
00156     vout_display_opengl_t vgl;
00157 #endif
00158 
00159 #ifdef MODULE_NAME_IS_direct3d
00160     bool allow_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
00161     /* show video on desktop window ? */
00162     bool use_desktop;
00163     struct {
00164         bool is_fullscreen;
00165         bool is_on_top;
00166         RECT win;
00167     } desktop_save;
00168     vout_display_cfg_t cfg_saved; /* configuration used before going into desktop mode */
00169 
00170     // core objects
00171     HINSTANCE               hd3d9_dll;       /* handle of the opened d3d9 dll */
00172     LPDIRECT3D9             d3dobj;
00173     LPDIRECT3DDEVICE9       d3ddev;
00174     D3DPRESENT_PARAMETERS   d3dpp;
00175     // scene objects
00176     LPDIRECT3DTEXTURE9      d3dtex;
00177     LPDIRECT3DVERTEXBUFFER9 d3dvtc;
00178 
00179     picture_resource_t      resource;
00180 
00181     /* */
00182     bool                    reset_device;
00183     bool                    reopen_device;
00184 
00185     /* It protects the following variables */
00186     vlc_mutex_t    lock;
00187     bool           ch_desktop;
00188     bool           desktop_requested;
00189 #endif
00190 
00191 #if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
00192     int  i_depth;
00193 
00194     /* Our offscreen bitmap and its framebuffer */
00195     HDC        off_dc;
00196     HBITMAP    off_bitmap;
00197 
00198     struct
00199     {
00200         BITMAPINFO bitmapinfo;
00201         RGBQUAD    red;
00202         RGBQUAD    green;
00203         RGBQUAD    blue;
00204     };
00205 
00206 #   ifdef MODULE_NAME_IS_wingapi
00207     HINSTANCE  gapi_dll;                   /* handle of the opened gapi dll */
00208 
00209     /* GAPI functions */
00210     int (*GXOpenDisplay)(HWND hWnd, DWORD dwFlags);
00211     int (*GXCloseDisplay)();
00212     void *(*GXBeginDraw)();
00213     int (*GXEndDraw)();
00214     GXDisplayProperties (*GXGetDisplayProperties)();
00215     int (*GXSuspend)();
00216     int (*GXResume)();
00217 #   endif
00218 #endif
00219 };
00220 
00221 #ifdef MODULE_NAME_IS_wingapi
00222 #   define GXOpenDisplay          vd->sys->GXOpenDisplay
00223 #   define GXCloseDisplay         vd->sys->GXCloseDisplay
00224 #   define GXBeginDraw            vd->sys->GXBeginDraw
00225 #   define GXEndDraw              vd->sys->GXEndDraw
00226 #   define GXGetDisplayProperties vd->sys->GXGetDisplayProperties
00227 #   define GXSuspend              vd->sys->GXSuspend
00228 #   define GXResume               vd->sys->GXResume
00229 #endif
00230 
00231 /*****************************************************************************
00232  * Prototypes from common.c
00233  *****************************************************************************/
00234 int  CommonInit(vout_display_t *);
00235 void CommonClean(vout_display_t *);
00236 void CommonManage(vout_display_t *);
00237 int  CommonControl(vout_display_t *, int , va_list );
00238 void CommonDisplay(vout_display_t *);
00239 
00240 void UpdateRects (vout_display_t *,
00241                   const vout_display_cfg_t *,
00242                   const video_format_t *,
00243                   bool is_forced);
00244 void AlignRect(RECT *, int align_boundary, int align_size);
00245 
00246 /*****************************************************************************
00247  * Constants
00248  *****************************************************************************/
00249 #define IDM_TOGGLE_ON_TOP WM_USER + 1
00250 #define DX_POSITION_CHANGE 0x1000
00251 #define DX_WALLPAPER_CHANGE 0x2000
00252 #define DX_DESKTOP_CHANGE 0x4000
00253 
00254 /*****************************************************************************
00255  * WinCE helpers
00256  *****************************************************************************/
00257 #ifdef UNDER_CE
00258 
00259 #define AdjustWindowRect(a,b,c) AdjustWindowRectEx(a,b,c,0)
00260 
00261 #ifndef GCL_HBRBACKGROUND
00262 #   define GCL_HBRBACKGROUND (-10)
00263 #endif
00264 
00265 //#define FindWindowEx(a,b,c,d) 0
00266 
00267 #define GetWindowPlacement(a,b)
00268 #define SetWindowPlacement(a,b)
00269 /*typedef struct _WINDOWPLACEMENT {
00270     UINT length;
00271     UINT flags;
00272     UINT showCmd;
00273     POINT ptMinPosition;
00274     POINT ptMaxPosition;
00275     RECT rcNormalPosition;
00276 } WINDOWPLACEMENT;*/
00277 
00278 #ifndef WM_NCMOUSEMOVE
00279 #   define WM_NCMOUSEMOVE 160
00280 #endif
00281 #ifndef CS_OWNDC
00282 #   define CS_OWNDC 32
00283 #endif
00284 #ifndef SC_SCREENSAVE
00285 #   define SC_SCREENSAVE 0xF140
00286 #endif
00287 #ifndef SC_MONITORPOWER
00288 #   define SC_MONITORPOWER 0xF170
00289 #endif
00290 #ifndef WM_NCPAINT
00291 #   define WM_NCPAINT 133
00292 #endif
00293 #ifndef WS_OVERLAPPEDWINDOW
00294 #   define WS_OVERLAPPEDWINDOW 0xcf0000
00295 #endif
00296 #ifndef WS_EX_NOPARENTNOTIFY
00297 #   define WS_EX_NOPARENTNOTIFY 4
00298 #endif
00299 #ifndef WS_EX_APPWINDOW
00300 #define WS_EX_APPWINDOW 0x40000
00301 #endif
00302 
00303 //#define SetWindowLongPtr SetWindowLong
00304 //#define GetWindowLongPtr GetWindowLong
00305 //#define GWLP_USERDATA GWL_USERDATA
00306 
00307 #endif //UNDER_CE

Generated on Tue May 25 08:04:52 2010 for VLC by  doxygen 1.5.6