vout.h
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:10k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * vout.h: Windows video output header file
  3.  *****************************************************************************
  4.  * Copyright (C) 2001-2009 the VideoLAN team
  5.  * $Id: ab76e2b110c73c5ac1a0f6245305c475a2f52efd $
  6.  *
  7.  * Authors: Gildas Bazin <gbazin@videolan.org>
  8.  *          Damien Fouilleul <damienf@videolan.org>
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2 of the License, or
  13.  * (at your option) any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with this program; if not, write to the Free Software
  22.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23.  *****************************************************************************/
  24. /*****************************************************************************
  25.  * event_thread_t: event thread
  26.  *****************************************************************************/
  27. typedef struct event_thread_t
  28. {
  29.     VLC_COMMON_MEMBERS
  30.     vout_thread_t * p_vout;
  31.     HANDLE window_ready;
  32. } event_thread_t;
  33. #ifdef MODULE_NAME_IS_wingapi
  34.     typedef struct GXDisplayProperties {
  35.         DWORD cxWidth;
  36.         DWORD cyHeight;
  37.         long cbxPitch;
  38.         long cbyPitch;
  39.         long cBPP;
  40.         DWORD ffFormat;
  41.     } GXDisplayProperties;
  42.     typedef struct GXScreenRect {
  43.         DWORD dwTop;
  44.         DWORD dwLeft;
  45.         DWORD dwWidth;
  46.         DWORD dwHeight;
  47.     } GXScreenRect;
  48. #   define GX_FULLSCREEN    0x01
  49. #   define GX_NORMALKEYS    0x02
  50. #   define GX_LANDSCAPEKEYS 0x03
  51. #   ifndef kfLandscape
  52. #       define kfLandscape      0x8
  53. #       define kfPalette        0x10
  54. #       define kfDirect         0x20
  55. #       define kfDirect555      0x40
  56. #       define kfDirect565      0x80
  57. #       define kfDirect888      0x100
  58. #       define kfDirect444      0x200
  59. #       define kfDirectInverted 0x400
  60. #   endif
  61. #endif
  62. struct vout_window_t;
  63. /*****************************************************************************
  64.  * vout_sys_t: video output method descriptor
  65.  *****************************************************************************
  66.  * This structure is part of the video output thread descriptor.
  67.  * It describes the module specific properties of an output thread.
  68.  *****************************************************************************/
  69. struct vout_sys_t
  70. {
  71.     HWND                 hwnd;                  /* Handle of the main window */
  72.     HWND                 hvideownd;        /* Handle of the video sub-window */
  73.     struct vout_window_t *parent_window;         /* Parent window VLC object */
  74.     HWND                 hparent;             /* Handle of the parent window */
  75.     HWND                 hfswnd;          /* Handle of the fullscreen window */
  76.     WNDPROC              pf_wndproc;             /* Window handling callback */
  77.     /* Multi-monitor support */
  78.     HMONITOR             hmonitor;          /* handle of the current monitor */
  79.     GUID                 *p_display_driver;
  80.     HMONITOR             (WINAPI* MonitorFromWindow)( HWND, DWORD );
  81.     BOOL                 (WINAPI* GetMonitorInfo)( HMONITOR, LPMONITORINFO );
  82.     /* size of the display */
  83.     RECT         rect_display;
  84.     int          i_display_depth;
  85.     /* size of the overall window (including black bands) */
  86.     RECT         rect_parent;
  87.     /* Window position and size */
  88.     int          i_window_x;
  89.     int          i_window_y;
  90.     int          i_window_width;
  91.     int          i_window_height;
  92.     int          i_window_style;
  93.     volatile uint16_t i_changes;        /* changes made to the video display */
  94.     /* Mouse */
  95.     volatile bool b_cursor_hidden;
  96.     volatile mtime_t    i_lastmoved;
  97.     mtime_t             i_mouse_hide_timeout;
  98.     /* Misc */
  99.     bool      b_on_top_change;
  100. #ifndef UNDER_CE
  101.     /* screensaver system settings to be restored when vout is closed */
  102.     UINT i_spi_lowpowertimeout;
  103.     UINT i_spi_powerofftimeout;
  104.     UINT i_spi_screensavetimeout;
  105. #endif
  106.     /* Coordinates of src and dest images (used when blitting to display) */
  107.     RECT         rect_src;
  108.     RECT         rect_src_clipped;
  109.     RECT         rect_dest;
  110.     RECT         rect_dest_clipped;
  111.     bool   b_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
  112. #ifdef MODULE_NAME_IS_vout_directx
  113.     /* Overlay alignment restrictions */
  114.     int          i_align_src_boundary;
  115.     int          i_align_src_size;
  116.     int          i_align_dest_boundary;
  117.     int          i_align_dest_size;
  118.     bool      b_wallpaper;    /* show as desktop wallpaper ? */
  119.     bool   b_using_overlay;         /* Are we using an overlay surface */
  120.     bool   b_use_sysmem;   /* Should we use system memory for surfaces */
  121.     bool   b_3buf_overlay;   /* Should we use triple buffered overlays */
  122.     /* DDraw capabilities */
  123.     int          b_caps_overlay_clipping;
  124.     int          i_rgb_colorkey;      /* colorkey in RGB used by the overlay */
  125.     int          i_colorkey;                 /* colorkey used by the overlay */
  126.     COLORREF        color_bkg;
  127.     COLORREF        color_bkgtxt;
  128.     LPDIRECTDRAW2        p_ddobject;                    /* DirectDraw object */
  129.     LPDIRECTDRAWSURFACE2 p_display;                        /* Display device */
  130.     LPDIRECTDRAWSURFACE2 p_current_surface;   /* surface currently displayed */
  131.     LPDIRECTDRAWCLIPPER  p_clipper;             /* clipper used for blitting */
  132.     HINSTANCE            hddraw_dll;       /* handle of the opened ddraw dll */
  133. #endif
  134. #ifdef MODULE_NAME_IS_glwin32
  135.     HDC hGLDC;
  136.     HGLRC hGLRC;
  137. #endif
  138. #ifdef MODULE_NAME_IS_direct3d
  139.     // core objects
  140.     HINSTANCE               hd3d9_dll;       /* handle of the opened d3d9 dll */
  141.     LPDIRECT3D9             p_d3dobj;
  142.     LPDIRECT3DDEVICE9       p_d3ddev;
  143.     D3DPRESENT_PARAMETERS   d3dpp;
  144.     // scene objects
  145.     LPDIRECT3DTEXTURE9      p_d3dtex;
  146.     LPDIRECT3DVERTEXBUFFER9 p_d3dvtc;
  147. #endif
  148. #ifdef MODULE_NAME_IS_wingdi
  149.     int  i_depth;
  150.     /* Our offscreen bitmap and its framebuffer */
  151.     HDC        off_dc;
  152.     HBITMAP    off_bitmap;
  153.     uint8_t *  p_pic_buffer;
  154.     int        i_pic_pitch;
  155.     int        i_pic_pixel_pitch;
  156.     BITMAPINFO bitmapinfo;
  157.     RGBQUAD    red;
  158.     RGBQUAD    green;
  159.     RGBQUAD    blue;
  160. #endif
  161. #ifdef MODULE_NAME_IS_wingapi
  162.     int        i_depth;
  163.     int        render_width;
  164.     int        render_height;
  165.     /* Our offscreen bitmap and its framebuffer */
  166.     HDC        off_dc;
  167.     HBITMAP    off_bitmap;
  168.     uint8_t *  p_pic_buffer;
  169.     int        i_pic_pitch;
  170.     int        i_pic_pixel_pitch;
  171.     BITMAPINFO bitmapinfo;
  172.     RGBQUAD    red;
  173.     RGBQUAD    green;
  174.     RGBQUAD    blue;
  175.     bool b_focus;
  176.     bool b_parent_focus;
  177.     HINSTANCE  gapi_dll;                   /* handle of the opened gapi dll */
  178.     /* GAPI functions */
  179.     int (*GXOpenDisplay)( HWND hWnd, DWORD dwFlags );
  180.     int (*GXCloseDisplay)();
  181.     void *(*GXBeginDraw)();
  182.     int (*GXEndDraw)();
  183.     GXDisplayProperties (*GXGetDisplayProperties)();
  184.     int (*GXSuspend)();
  185.     int (*GXResume)();
  186. #endif
  187. #ifndef UNDER_CE
  188.     /* suspend display */
  189.     bool   b_suspend_display;
  190. #endif
  191.     event_thread_t *p_event;
  192.     vlc_mutex_t    lock;
  193. };
  194. #ifdef MODULE_NAME_IS_wingapi
  195. #   define GXOpenDisplay p_vout->p_sys->GXOpenDisplay
  196. #   define GXCloseDisplay p_vout->p_sys->GXCloseDisplay
  197. #   define GXBeginDraw p_vout->p_sys->GXBeginDraw
  198. #   define GXEndDraw p_vout->p_sys->GXEndDraw
  199. #   define GXGetDisplayProperties p_vout->p_sys->GXGetDisplayProperties
  200. #   define GXSuspend p_vout->p_sys->GXSuspend
  201. #   define GXResume p_vout->p_sys->GXResume
  202. #endif
  203. /*****************************************************************************
  204.  * Prototypes from directx.c
  205.  *****************************************************************************/
  206. int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
  207. /*****************************************************************************
  208.  * Prototypes from events.c
  209.  *****************************************************************************/
  210. void* EventThread ( vlc_object_t *p_this );
  211. void UpdateRects ( vout_thread_t *p_vout, bool b_force );
  212. void Win32ToggleFullscreen ( vout_thread_t *p_vout );
  213. /*****************************************************************************
  214.  * Constants
  215.  *****************************************************************************/
  216. #define WM_VLC_HIDE_MOUSE WM_APP
  217. #define WM_VLC_SHOW_MOUSE WM_APP + 1
  218. #define WM_VLC_CHANGE_TEXT WM_APP + 2
  219. #define IDM_TOGGLE_ON_TOP WM_USER + 1
  220. #define DX_POSITION_CHANGE 0x1000
  221. #define DX_WALLPAPER_CHANGE 0x2000
  222. /*****************************************************************************
  223.  * WinCE helpers
  224.  *****************************************************************************/
  225. #ifdef UNDER_CE
  226. #define AdjustWindowRect(a,b,c) AdjustWindowRectEx(a,b,c,0)
  227. #ifndef GCL_HBRBACKGROUND
  228. #   define GCL_HBRBACKGROUND (-10)
  229. #endif
  230. //#define FindWindowEx(a,b,c,d) 0
  231. #define GetWindowPlacement(a,b)
  232. #define SetWindowPlacement(a,b)
  233. /*typedef struct _WINDOWPLACEMENT {
  234.     UINT length;
  235.     UINT flags;
  236.     UINT showCmd;
  237.     POINT ptMinPosition;
  238.     POINT ptMaxPosition;
  239.     RECT rcNormalPosition;
  240. } WINDOWPLACEMENT;*/
  241. #ifndef WM_NCMOUSEMOVE
  242. #   define WM_NCMOUSEMOVE 160
  243. #endif
  244. #ifndef CS_OWNDC
  245. #   define CS_OWNDC 32
  246. #endif
  247. #ifndef SC_SCREENSAVE
  248. #   define SC_SCREENSAVE 0xF140
  249. #endif
  250. #ifndef SC_MONITORPOWER
  251. #   define SC_MONITORPOWER 0xF170
  252. #endif
  253. #ifndef WM_NCPAINT
  254. #   define WM_NCPAINT 133
  255. #endif
  256. #ifndef WS_OVERLAPPEDWINDOW
  257. #   define WS_OVERLAPPEDWINDOW 0xcf0000
  258. #endif
  259. #ifndef WS_EX_NOPARENTNOTIFY
  260. #   define WS_EX_NOPARENTNOTIFY 4
  261. #endif
  262. #ifndef WS_EX_APPWINDOW
  263. #define WS_EX_APPWINDOW 0x40000
  264. #endif
  265. //#define SetWindowLongPtr SetWindowLong
  266. //#define GetWindowLongPtr GetWindowLong
  267. //#define GWLP_USERDATA GWL_USERDATA
  268. #endif //UNDER_CE