Mercurial > mplayer.hg
annotate libvo/w32_common.c @ 14564:f85875877de9
tries to sync to ADTS/ADIF header before initializing the decoder; implement SYNC
author | nicodvb |
---|---|
date | Fri, 21 Jan 2005 20:50:09 +0000 |
parents | f0c1ee83b216 |
children | d87cc822b343 |
rev | line source |
---|---|
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
1 #include <limits.h> |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
2 #include <windows.h> |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
3 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12936
diff
changeset
|
4 #include "osdep/keycodes.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12936
diff
changeset
|
5 #include "input/input.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12936
diff
changeset
|
6 #include "input/mouse.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
12936
diff
changeset
|
7 #include "mp_msg.h" |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
8 #include "video_out.h" |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
9 #include "aspect.h" |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
10 #include "w32_common.h" |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
11 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
12 extern void mplayer_put_key(int code); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
13 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
14 static const char* classname = "MPlayer - Media player for Win32"; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
15 int vo_vm = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
16 HDC vo_hdc = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
17 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
18 uint32_t o_dwidth; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
19 uint32_t o_dheight; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
20 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
21 static HINSTANCE hInstance; |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
22 HWND vo_window = 0; |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
23 static int cursor = 1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
24 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
25 static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
26 switch (message) { |
12004
494a93a19242
replace WM_DESTROY with WM_CLOSE to make it possible to play multiple files, patch by Reimar Doeffinger
faust3
parents:
11542
diff
changeset
|
27 case WM_CLOSE: |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
28 mp_input_queue_cmd(mp_input_parse_cmd("quit")); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
29 break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
30 case WM_SYSCOMMAND: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
31 switch (wParam) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
32 case SC_SCREENSAVE: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
33 case SC_MONITORPOWER: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
34 mp_msg(MSGT_VO, MSGL_V, "vo: win32: killing screensaver\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
35 break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
36 default: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
37 return DefWindowProc(hWnd, message, wParam, lParam); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
38 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
39 break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
40 case WM_KEYDOWN: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
41 switch (wParam) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
42 case VK_LEFT: mplayer_put_key(KEY_LEFT); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
43 case VK_UP: mplayer_put_key(KEY_UP); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
44 case VK_RIGHT: mplayer_put_key(KEY_RIGHT); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
45 case VK_DOWN: mplayer_put_key(KEY_DOWN); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
46 case VK_TAB: mplayer_put_key(KEY_TAB); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
47 case VK_CONTROL: mplayer_put_key(KEY_CTRL); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
48 case VK_DELETE: mplayer_put_key(KEY_DELETE); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
49 case VK_INSERT: mplayer_put_key(KEY_INSERT); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
50 case VK_HOME: mplayer_put_key(KEY_HOME); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
51 case VK_END: mplayer_put_key(KEY_END); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
52 case VK_PRIOR: mplayer_put_key(KEY_PAGE_UP); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
53 case VK_NEXT: mplayer_put_key(KEY_PAGE_DOWN); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
54 case VK_ESCAPE: mplayer_put_key(KEY_ESC); break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
55 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
56 break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
57 case WM_CHAR: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
58 mplayer_put_key(wParam); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
59 break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
60 case WM_LBUTTONDOWN: |
12927 | 61 if (!vo_nomouse_input && (vo_fs || (wParam & MK_CONTROL))) { |
62 mplayer_put_key(MOUSE_BTN0); | |
63 break; | |
64 } | |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
65 if (!vo_fs) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
66 ReleaseCapture(); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
67 SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
68 return 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
69 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
70 break; |
12927 | 71 case WM_MBUTTONDOWN: |
72 if (!vo_nomouse_input) | |
73 mplayer_put_key(MOUSE_BTN1); | |
74 break; | |
75 case WM_RBUTTONDOWN: | |
76 if (!vo_nomouse_input) | |
77 mplayer_put_key(MOUSE_BTN2); | |
78 break; | |
79 case WM_MOUSEWHEEL: | |
80 if (!vo_nomouse_input) { | |
81 int x = GET_WHEEL_DELTA_WPARAM(wParam); | |
82 if (x > 0) | |
83 mplayer_put_key(MOUSE_BTN3); | |
84 else | |
85 mplayer_put_key(MOUSE_BTN4); | |
86 break; | |
87 } | |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
88 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
89 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
90 return DefWindowProc(hWnd, message, wParam, lParam); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
91 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
92 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
93 int vo_w32_check_events(void) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
94 MSG msg; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
95 int r = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
96 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
97 TranslateMessage(&msg); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
98 DispatchMessage(&msg); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
99 switch (msg.message) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
100 case WM_ACTIVATE: |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
101 r |= VO_EVENT_EXPOSE; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
102 break; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
103 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
104 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
105 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
106 return r; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
107 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
108 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
109 static void changeMode(void) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
110 DEVMODE dm; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
111 dm.dmSize = sizeof dm; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
112 dm.dmDriverExtra = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
113 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
114 dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
115 dm.dmBitsPerPel = vo_depthonscreen; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
116 dm.dmPelsWidth = vo_screenwidth; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
117 dm.dmPelsHeight = vo_screenheight; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
118 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
119 if (vo_vm) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
120 int bestMode = -1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
121 int bestScore = INT_MAX; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
122 int i; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
123 for (i = 0; EnumDisplaySettings(0, i, &dm); ++i) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
124 if (dm.dmBitsPerPel != vo_depthonscreen) continue; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
125 if (dm.dmPelsWidth < o_dwidth) continue; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
126 if (dm.dmPelsHeight < o_dheight) continue; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
127 int score = (dm.dmPelsWidth - o_dwidth) * (dm.dmPelsHeight - o_dheight); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
128 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
129 if (score < bestScore) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
130 bestScore = score; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
131 bestMode = i; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
132 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
133 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
134 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
135 if (bestMode != -1) |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
136 EnumDisplaySettings(0, bestMode, &dm); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
137 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
138 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
139 vo_screenwidth = dm.dmPelsWidth; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
140 vo_screenheight = dm.dmPelsHeight; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
141 aspect_save_screenres(vo_screenwidth, vo_screenheight); |
11479
5d76d070b44b
change vo_w32_fullscreen to behave like vo_x11_fullscreen patch by Reimar Doeffinger <someone-guy at gmx.de>
faust3
parents:
10880
diff
changeset
|
142 vo_dwidth = vo_screenwidth; |
5d76d070b44b
change vo_w32_fullscreen to behave like vo_x11_fullscreen patch by Reimar Doeffinger <someone-guy at gmx.de>
faust3
parents:
10880
diff
changeset
|
143 vo_dheight = vo_screenheight; |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
144 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
145 if (vo_vm) |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
146 ChangeDisplaySettings(&dm, CDS_FULLSCREEN); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
147 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
148 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
149 static void resetMode(void) { |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
150 if (vo_vm) |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
151 ChangeDisplaySettings(0, 0); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
152 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
153 DEVMODE dm; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
154 dm.dmSize = sizeof dm; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
155 dm.dmDriverExtra = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
156 dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
157 if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
158 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
159 return; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
160 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
161 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
162 vo_screenwidth = dm.dmPelsWidth; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
163 vo_screenheight = dm.dmPelsHeight; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
164 vo_depthonscreen = dm.dmBitsPerPel; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
165 aspect_save_screenres(vo_screenwidth, vo_screenheight); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
166 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
167 vo_dwidth = o_dwidth; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
168 vo_dheight = o_dheight; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
169 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
170 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
171 int createRenderingContext(void) { |
11542 | 172 HWND layer = HWND_NOTOPMOST; |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
173 |
11542 | 174 if (vo_fs || vo_ontop) layer = HWND_TOPMOST; |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
175 if (vo_fs) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
176 changeMode(); |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
177 SetWindowPos(vo_window, layer, 0, 0, vo_screenwidth, vo_screenheight, SWP_SHOWWINDOW); |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
178 if (cursor) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
179 ShowCursor(0); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
180 cursor = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
181 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
182 } else { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
183 resetMode(); |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
184 SetWindowPos(vo_window, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW); |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
185 if (!cursor) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
186 ShowCursor(1); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
187 cursor = 1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
188 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
189 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
190 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
191 PIXELFORMATDESCRIPTOR pfd; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
192 memset(&pfd, 0, sizeof pfd); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
193 pfd.nSize = sizeof pfd; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
194 pfd.nVersion = 1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
195 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
196 pfd.iPixelType = PFD_TYPE_RGBA; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
197 pfd.cColorBits = 24; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
198 pfd.iLayerType = PFD_MAIN_PLANE; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
199 int pf = ChoosePixelFormat(vo_hdc, &pfd); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
200 if (!pf) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
201 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
202 return 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
203 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
204 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
205 SetPixelFormat(vo_hdc, pf, &pfd); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
206 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
207 mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
208 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
209 return 1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
210 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
211 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
212 void destroyRenderingContext(void) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
213 resetMode(); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
214 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
215 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
216 int vo_init(void) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
217 HICON mplayerIcon = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
218 char exedir[MAX_PATH]; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
219 DEVMODE dm; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
220 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
221 if (vo_window) |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
222 return 1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
223 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
224 hInstance = GetModuleHandle(0); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
225 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
226 if (GetModuleFileName(0, exedir, MAX_PATH)) |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
227 mplayerIcon = ExtractIcon(hInstance, exedir, 0); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
228 if (!mplayerIcon) |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
229 mplayerIcon = LoadIcon(0, IDI_APPLICATION); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
230 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
231 WNDCLASSEX wcex = { sizeof wcex, CS_OWNDC, WndProc, 0, 0, hInstance, mplayerIcon, LoadCursor(0, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), 0, classname, mplayerIcon }; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
232 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
233 if (!RegisterClassEx(&wcex)) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
234 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to register window class!\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
235 return 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
236 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
237 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
238 vo_window = CreateWindowEx(0, classname, classname, WS_POPUP, CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0); |
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
239 if (!vo_window) { |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
240 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
241 return 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
242 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
243 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
244 vo_hdc = GetDC(vo_window); |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
245 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
246 dm.dmSize = sizeof dm; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
247 dm.dmDriverExtra = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
248 dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
249 if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
250 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
251 return 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
252 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
253 vo_screenwidth = dm.dmPelsWidth; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
254 vo_screenheight = dm.dmPelsHeight; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
255 vo_depthonscreen = dm.dmBitsPerPel; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
256 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
257 return 1; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
258 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
259 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
260 void vo_w32_fullscreen(void) { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
261 vo_fs = !vo_fs; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
262 |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
263 destroyRenderingContext(); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
264 createRenderingContext(); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
265 } |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
266 |
11542 | 267 void vo_w32_ontop( void ) |
268 { | |
269 vo_ontop = !vo_ontop; | |
270 if (!vo_fs) { | |
271 HWND layer = HWND_NOTOPMOST; | |
272 if (vo_ontop) layer = HWND_TOPMOST; | |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
273 SetWindowPos(vo_window, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW); |
11542 | 274 } |
275 } | |
276 | |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
277 void vo_w32_uninit() { |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
278 mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n"); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
279 resetMode(); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
280 ShowCursor(1); |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
281 vo_depthonscreen = 0; |
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
282 destroyRenderingContext(); |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
283 DestroyWindow(vo_window); |
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
13787
diff
changeset
|
284 vo_window = 0; |
11479
5d76d070b44b
change vo_w32_fullscreen to behave like vo_x11_fullscreen patch by Reimar Doeffinger <someone-guy at gmx.de>
faust3
parents:
10880
diff
changeset
|
285 UnregisterClass(classname, 0); |
10880
ba9557e864c0
vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff
changeset
|
286 } |