annotate libvo/vo_winvidix.c @ 13277:ffe4d98eed6b

Cumulative patch "X11 options do not affect SDL", "\-noencodedups", "mplayer -af help now lists all available audio filters", "pullup docs + new feature for slow cpus"
author gpoirier
date Tue, 07 Sep 2004 09:59:27 +0000
parents 88aba9a06162
children e047e70a9767
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
1 /*
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
2 VIDIX accelerated overlay in a WIN32 window
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
3
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
4 (C) Sascha Sommer
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
5
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
6
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
7 */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
8
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
9 #include <stdio.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
10 #include <stdlib.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
11 #include <string.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
12 #include <math.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
13 #include <errno.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
14
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
15 #include "config.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
16 #include "video_out.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
17 #include "video_out_internal.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
18
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
19 #include <windows.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
20 #include "../osdep/keycodes.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
21 #include "../input/input.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
22
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
23 #include "aspect.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
24 #include "mp_msg.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
25
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
26 #include "vosub_vidix.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
27 #include "../vidix/vidixlib.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
28
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
29 extern void mplayer_put_key(int code);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
30
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
31 static vo_info_t info =
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
32 {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
33 "WIN32 (VIDIX)",
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
34 "winvidix",
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
35 "Sascha Sommer",
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
36 ""
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
37 };
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
38
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
39 LIBVO_EXTERN(winvidix)
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
40
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
41 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
42
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
43 /* VIDIX related */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
44 static char *vidix_name;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
45
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
46 /* Image parameters */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
47 static uint32_t image_width;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
48 static uint32_t image_height;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
49 static uint32_t image_format;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
50 static HWND hWnd;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
51 /* Window parameters */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
52 static HWND hWnd=NULL,hWndFS=NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
53
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
54 static vidix_grkey_t gr_key;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
55
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
56
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
57 extern void set_video_eq( int cap );
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
58 extern int vo_config_count;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
59
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
60
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
61 static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
62 {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
63 switch (message){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
64 case WM_DESTROY:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
65 mp_input_queue_cmd(mp_input_parse_cmd("quit"));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
66 break;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
67 case WM_WINDOWPOSCHANGED:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
68 {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
69 /*calculate new window rect*/
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
70 if(!vo_fs){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
71 RECT rd;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
72 POINT point_window;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
73 if(!hWnd)hWnd=hwnd;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
74 ShowCursor(TRUE);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
75 point_window.x = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
76 point_window.y = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
77 ClientToScreen(hWnd,&point_window);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
78 GetClientRect(hWnd,&rd);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
79
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
80 vo_dwidth=rd.right - rd.left;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
81 vo_dheight=rd.bottom - rd.top;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
82 vo_dx =point_window.x;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
83 vo_dy =point_window.y;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
84 // aspect(&vo_dwidth, &vo_dheight, A_NOZOOM);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
85 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
86 else {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
87 if(ShowCursor(FALSE)>=0)while(ShowCursor(FALSE)>=0){}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
88 aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
89 vo_dx = (vo_screenwidth - vo_dwidth)/2;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
90 vo_dy = (vo_screenheight - vo_dheight)/2;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
91 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
92 /*update vidix*/
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
93 /* FIXME: implement runtime resize/move if possible, this way is very ugly! */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
94 vidix_stop();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
95 if(vidix_init(image_width, image_height, vo_dx, vo_dy, vo_dwidth, vo_dheight, image_format, vo_depthonscreen, vo_screenwidth, vo_screenheight) != 0)
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
96 mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
97 /*set colorkey*/
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
98 vidix_start();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
99 mp_msg(MSGT_VO, MSGL_V, "[winvidix] window properties: pos: %dx%d, size: %dx%d\n",vo_dx, vo_dy, vo_dwidth, vo_dheight);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
100 if(vidix_grkey_support()){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
101 vidix_grkey_get(&gr_key);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
102 gr_key.key_op = KEYS_PUT;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
103 gr_key.ckey.op = CKEY_TRUE;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
104 if(vo_fs)gr_key.ckey.red = gr_key.ckey.green = gr_key.ckey.blue = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
105 else {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
106 gr_key.ckey.red = gr_key.ckey.blue = 255;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
107 gr_key.ckey.green = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
108 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
109 vidix_grkey_set(&gr_key);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
110 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
111
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
112 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
113 break;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
114 case WM_SYSCOMMAND:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
115 switch (wParam){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
116 case SC_SCREENSAVE:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
117 case SC_MONITORPOWER:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
118 return 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
119 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
120 break;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
121 case WM_KEYDOWN:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
122 switch (wParam){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
123 case VK_LEFT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
124 {mplayer_put_key(KEY_LEFT);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
125 case VK_UP:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
126 {mplayer_put_key(KEY_UP);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
127 case VK_RIGHT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
128 {mplayer_put_key(KEY_RIGHT);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
129 case VK_DOWN:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
130 {mplayer_put_key(KEY_DOWN);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
131 case VK_TAB:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
132 {mplayer_put_key(KEY_TAB);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
133 case VK_CONTROL:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
134 {mplayer_put_key(KEY_CTRL);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
135 case VK_DELETE:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
136 {mplayer_put_key(KEY_DELETE);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
137 case VK_INSERT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
138 {mplayer_put_key(KEY_INSERT);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
139 case VK_HOME:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
140 {mplayer_put_key(KEY_HOME);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
141 case VK_END:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
142 {mplayer_put_key(KEY_END);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
143 case VK_PRIOR:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
144 {mplayer_put_key(KEY_PAGE_UP);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
145 case VK_NEXT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
146 {mplayer_put_key(KEY_PAGE_DOWN);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
147 case VK_ESCAPE:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
148 {mplayer_put_key(KEY_ESC);break;}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
149 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
150 break;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
151 case WM_CHAR:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
152 mplayer_put_key(wParam);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
153 break;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
154 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
155 return DefWindowProc(hwnd, message, wParam, lParam);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
156 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
157
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
158
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
159 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, uint32_t flags, char *title, uint32_t format){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
160 title = "MPlayer VIDIX WIN32 Overlay";
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
161
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
162 panscan_init();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
163
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
164 image_height = height;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
165 image_width = width;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
166 image_format = format;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
167 vo_screenwidth = GetSystemMetrics(SM_CXSCREEN);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
168 vo_screenheight = GetSystemMetrics(SM_CYSCREEN);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
169 vo_depthonscreen = GetDeviceCaps(GetDC(GetDesktopWindow()),BITSPIXEL);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
170
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
171
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
172 aspect_save_orig(width, height);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
173 aspect_save_prescale(d_width, d_height);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
174 aspect_save_screenres(vo_screenwidth, vo_screenheight);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
175
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
176 vo_dx = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
177 vo_dy = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
178
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
179 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
180 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
181
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
182 vo_fs = flags&0x01;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
183
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
184
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
185 aspect(&d_width, &d_height, A_NOZOOM);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
186 vo_dwidth=d_width; vo_dheight=d_height;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
187
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
188
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
189
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
190 if(!vo_config_count){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
191 HINSTANCE hInstance = GetModuleHandle(NULL);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
192 WNDCLASS wc;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
193 RECT rd;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
194 rd.left = vo_dx;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
195 rd.top = vo_dy;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
196 rd.right = rd.left + vo_dwidth;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
197 rd.bottom = rd.top + vo_dheight;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
198 AdjustWindowRect(&rd,WS_OVERLAPPEDWINDOW| WS_SIZEBOX,0);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
199 wc.style = CS_HREDRAW | CS_VREDRAW;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
200 wc.lpfnWndProc = WndProc;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
201 wc.cbClsExtra = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
202 wc.cbWndExtra = 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
203 wc.hInstance = hInstance;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
204 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
205 wc.hIcon =ExtractIcon(hInstance,"mplayer.exe",0);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
206 //LoadIcon(NULL,IDI_APPLICATION);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
207 wc.hbrBackground = CreateSolidBrush(RGB(255,0,255));
12858
cbcc205a740e embarassing typo and new name
diego
parents: 11462
diff changeset
208 wc.lpszClassName = "MPlayer - The Movie Player";
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
209 wc.lpszMenuName = NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
210 RegisterClass(&wc);
12861
88aba9a06162 name change
diego
parents: 12858
diff changeset
211 hWnd = CreateWindow("MPlayer - The Movie Player",
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
212 title,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
213 WS_OVERLAPPEDWINDOW| WS_SIZEBOX,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
214 rd.left,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
215 rd.top,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
216 rd.right - rd.left,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
217 rd.bottom - rd.top,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
218 NULL,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
219 NULL,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
220 hInstance,
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
221 NULL);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
222 wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
223 wc.lpszClassName = "MPlayer - Fullscreen";
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
224 RegisterClass(&wc);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
225 hWndFS = CreateWindow("MPlayer - Fullscreen","MPlayer VIDIX Fullscreen",WS_POPUP,0,0,vo_screenwidth,vo_screenheight,hWnd,NULL,hInstance,NULL);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
226
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
227
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
228
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
229
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
230
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
231 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
232 ShowWindow(hWnd,SW_SHOW);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
233 if(vo_fs)ShowWindow(hWndFS,SW_SHOW);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
234
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
235 return(0);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
236 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
237
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
238 static void check_events(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
239 MSG msg;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
240 while (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE))
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
241 {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
242 TranslateMessage(&msg);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
243 DispatchMessage(&msg);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
244 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
245 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
246
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
247 /* draw_osd, flip_page, draw_slice, draw_frame should be
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
248 overwritten with vidix functions (vosub_vidix.c) */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
249 static void draw_osd(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
250 mp_msg(MSGT_VO, MSGL_FATAL, "[winvidix] error: didn't use vidix draw_osd!\n");
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
251 return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
252 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
253
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
254 static void flip_page(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
255 mp_msg(MSGT_VO, MSGL_FATAL, "[winvidix] error: didn't use vidix flip_page!\n");
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
256 return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
257 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
258
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
259 static uint32_t draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
260 UNUSED(src);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
261 UNUSED(stride);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
262 UNUSED(w);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
263 UNUSED(h);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
264 UNUSED(x);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
265 UNUSED(y);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
266 mp_msg(MSGT_VO, MSGL_FATAL, "[winvidix] error: didn't use vidix draw_slice!\n");
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
267 return(-1);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
268 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
269
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
270 static uint32_t draw_frame(uint8_t *src[]){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
271 UNUSED(src);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
272 mp_msg(MSGT_VO, MSGL_FATAL, "[winvidix] error: didn't use vidix draw_frame!\n");
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
273 return(-1);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
274 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
275
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
276 static uint32_t query_format(uint32_t format){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
277 return(vidix_query_fourcc(format));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
278 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
279
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
280 static void uninit(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
281 DestroyWindow(hWndFS);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
282 DestroyWindow(hWnd);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
283 if ( !vo_config_count ) return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
284 vidix_term();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
285
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
286 if (vidix_name){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
287 free(vidix_name);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
288 vidix_name = NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
289 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
290 //
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
291 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
292
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
293 static uint32_t preinit(const char *arg){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
294 if (arg)
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
295 vidix_name = strdup(arg);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
296 else
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
297 {
11462
2e367138d4b5 message expanded with hint to use -v option
gabucino
parents: 10979
diff changeset
298 mp_msg(MSGT_VO, MSGL_INFO, "No vidix driver name provided, probing available ones (-v option for details)!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
299 vidix_name = NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
300 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
301
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
302 if (vidix_preinit(vidix_name, &video_out_winvidix) != 0)
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
303 return(1);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
304
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
305 return(0);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
306 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
307
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
308 static uint32_t control(uint32_t request, void *data, ...){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
309 switch (request) {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
310 case VOCTRL_FULLSCREEN:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
311 if(!vo_fs){vo_fs=1;ShowWindow(hWndFS,SW_SHOW);}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
312 else {vo_fs=0; ShowWindow(hWndFS,SW_HIDE);}
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
313 break;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
314 case VOCTRL_QUERY_FORMAT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
315 return query_format(*((uint32_t*)data));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
316 case VOCTRL_SET_EQUALIZER:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
317 {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
318 va_list ap;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
319 int value;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
320
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
321 va_start(ap, data);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
322 value = va_arg(ap, int);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
323 va_end(ap);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
324
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
325 return vidix_control(request, data, (int *)value);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
326 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
327 case VOCTRL_GET_EQUALIZER:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
328 {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
329 va_list ap;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
330 int *value;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
331
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
332 va_start(ap, data);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
333 value = va_arg(ap, int*);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
334 va_end(ap);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
335
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
336 return vidix_control(request, data, value);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
337 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
338 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
339 return vidix_control(request, data);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
340 // return VO_NOTIMPL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
341 }