Mercurial > mplayer.hg
annotate libvo/vo_quartz.c @ 12662:05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
author | alex |
---|---|
date | Fri, 25 Jun 2004 18:11:15 +0000 |
parents | 730fc470a30c |
children | 33f58bfc8a1b |
rev | line source |
---|---|
12296 | 1 /* |
2 vo_quartz.c | |
3 | |
4 by Nicolas Plourde <nicolasplourde@hotmail.com> | |
5 | |
6 Copyright (c) Nicolas Plourde - April 2004 | |
12414 | 7 |
8 YUV support Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org> | |
12296 | 9 |
10 MPlayer Mac OSX Quartz video out module. | |
11 | |
12432 | 12 todo: -'plist' resource |
12623 | 13 -RGB32 color space support |
12296 | 14 -rootwin |
12460 | 15 -screen overlay output |
12623 | 16 -while mouse button down event mplayer is locked, fix that |
12296 | 17 -(add sugestion here) |
12120 | 18 */ |
19 | |
20 //SYS | |
21 #include <stdio.h> | |
22 | |
23 //OSX | |
24 #include <Carbon/Carbon.h> | |
12414 | 25 #include <QuickTime/QuickTime.h> |
12120 | 26 |
27 //MPLAYER | |
28 #include "config.h" | |
12414 | 29 #include "fastmemcpy.h" |
12120 | 30 #include "video_out.h" |
31 #include "video_out_internal.h" | |
32 #include "aspect.h" | |
12414 | 33 #include "mp_msg.h" |
34 #include "m_option.h" | |
12120 | 35 |
36 #include "../input/input.h" | |
37 #include "../input/mouse.h" | |
38 | |
39 #include "vo_quartz.h" | |
40 | |
12296 | 41 static vo_info_t info = |
42 { | |
43 "Mac OSX (Quartz)", | |
44 "quartz", | |
12414 | 45 "Nicolas Plourde <nicolasplourde@hotmail.com>, Romain Dolbeau <romain@dolbeau.org>", |
12296 | 46 "" |
12120 | 47 }; |
48 | |
12296 | 49 LIBVO_EXTERN(quartz) |
12120 | 50 |
12414 | 51 static uint32_t image_depth; |
52 static uint32_t image_format; | |
53 static uint32_t image_size; | |
54 static uint32_t image_buffer_size; | |
12432 | 55 static char *image_data; |
12414 | 56 |
12432 | 57 static ImageSequence seqId; |
12414 | 58 static CodecType image_qtcodec; |
12487 | 59 static PlanarPixmapInfoYUV420 *P = NULL; |
12424 | 60 static struct |
61 { | |
62 ImageDescriptionHandle desc; | |
63 Handle extension_colr; | |
64 Handle extension_fiel; | |
65 Handle extension_clap; | |
66 Handle extension_pasp; | |
12414 | 67 } yuv_qt_stuff; |
12432 | 68 static MatrixRecord matrix; |
12414 | 69 static int EnterMoviesDone = 0; |
12487 | 70 static int get_image_done = 0; |
12120 | 71 |
12296 | 72 extern int vo_ontop; |
12487 | 73 extern int vo_fs; // user want fullscreen |
74 static int vo_quartz_fs; // we are in fullscreen | |
12120 | 75 |
12487 | 76 static int int_pause = 0; |
77 static float winAlpha = 1; | |
12296 | 78 |
12487 | 79 static int device_width; |
80 static int device_height; | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
81 static int device_id; |
12120 | 82 |
12487 | 83 static WindowRef theWindow = NULL; |
12296 | 84 |
12487 | 85 static Rect imgRect; // size of the original image (unscaled) |
86 static Rect dstRect; // size of the displayed image (after scaling) | |
87 static Rect winRect; // size of the window containg the displayed image (include padding) | |
88 static Rect oldWinRect; // size of the window containg the displayed image (include padding) when NOT in FS mode | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
89 static Rect deviceRect; // size of the display device |
12296 | 90 |
12120 | 91 #include "../osdep/keycodes.h" |
12296 | 92 extern void mplayer_put_key(int code); |
93 | |
94 extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); | |
12120 | 95 |
96 //PROTOTYPE///////////////////////////////////////////////////////////////// | |
12296 | 97 void window_resized(); |
98 void window_ontop(); | |
99 void window_fullscreen(); | |
12120 | 100 |
12460 | 101 static OSStatus MainEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); |
12296 | 102 |
103 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) | |
104 { | |
12424 | 105 switch (image_format) |
106 { | |
107 case IMGFMT_RGB32: | |
108 vo_draw_alpha_rgb32(w,h,src,srca,stride,image_data+4*(y0*imgRect.right+x0),4*imgRect.right); | |
109 break; | |
110 case IMGFMT_YV12: | |
111 case IMGFMT_IYUV: | |
112 case IMGFMT_I420: | |
12487 | 113 vo_draw_alpha_yv12(w,h,src,srca,stride, ((char*)P) + P->componentInfoY.offset + x0 + y0 * imgRect.right, imgRect.right); |
12424 | 114 break; |
115 case IMGFMT_UYVY: | |
12517 | 116 vo_draw_alpha_uyvy(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); |
12424 | 117 break; |
118 case IMGFMT_YUY2: | |
12487 | 119 vo_draw_alpha_yuy2(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); |
12424 | 120 break; |
12487 | 121 } |
12296 | 122 } |
12120 | 123 |
124 //default window event handler | |
12460 | 125 static OSStatus MainEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) |
12120 | 126 { |
12624 | 127 OSStatus result = noErr; |
12460 | 128 UInt32 class = GetEventClass (event); |
129 UInt32 kind = GetEventKind (event); | |
12624 | 130 |
131 result = CallNextEventHandler(nextHandler, event); | |
132 | |
12460 | 133 if(class == kEventClassWindow) |
134 { | |
135 WindowRef window; | |
136 Rect rectPort = {0,0,0,0}; | |
137 | |
138 GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window); | |
139 | |
140 if(window) | |
141 { | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
142 GetPortBounds(GetWindowPort(window), &rectPort); |
12460 | 143 } |
12296 | 144 |
12460 | 145 switch (kind) |
146 { | |
147 //close window | |
148 case kEventWindowClosed: | |
149 mplayer_put_key(KEY_ESC); | |
150 break; | |
151 | |
152 //resize window | |
153 case kEventWindowBoundsChanged: | |
154 window_resized(); | |
155 flip_page(); | |
156 break; | |
157 | |
12624 | 158 default:result = eventNotHandledErr;break; |
12460 | 159 } |
160 } | |
161 else if(class == kEventClassKeyboard) | |
162 { | |
163 char macCharCodes; | |
164 UInt32 macKeyCode; | |
165 UInt32 macKeyModifiers; | |
166 | |
167 GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(macCharCodes), NULL, &macCharCodes); | |
168 GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(macKeyCode), NULL, &macKeyCode); | |
169 GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(macKeyModifiers), NULL, &macKeyModifiers); | |
12296 | 170 |
12460 | 171 switch (kind) |
12296 | 172 { |
12460 | 173 case kEventRawKeyDown: |
174 { | |
175 switch(macKeyCode) | |
12624 | 176 { |
177 case QZ_IBOOK_ENTER: | |
12460 | 178 case QZ_RETURN: mplayer_put_key(KEY_ENTER);break; |
179 case QZ_ESCAPE: mplayer_put_key(KEY_ESC);break; | |
12624 | 180 case QZ_BACKSPACE: mplayer_put_key(KEY_BACKSPACE);break; |
181 case QZ_LALT: mplayer_put_key(KEY_BACKSPACE);break; | |
182 case QZ_LCTRL: mplayer_put_key(KEY_BACKSPACE);break; | |
183 case QZ_LSHIFT: mplayer_put_key(KEY_BACKSPACE);break; | |
12460 | 184 case QZ_F1: mplayer_put_key(KEY_F+1);break; |
185 case QZ_F2: mplayer_put_key(KEY_F+2);break; | |
186 case QZ_F3: mplayer_put_key(KEY_F+3);break; | |
187 case QZ_F4: mplayer_put_key(KEY_F+4);break; | |
188 case QZ_F5: mplayer_put_key(KEY_F+5);break; | |
189 case QZ_F6: mplayer_put_key(KEY_F+6);break; | |
190 case QZ_F7: mplayer_put_key(KEY_F+7);break; | |
191 case QZ_F8: mplayer_put_key(KEY_F+8);break; | |
192 case QZ_F9: mplayer_put_key(KEY_F+9);break; | |
193 case QZ_F10: mplayer_put_key(KEY_F+10);break; | |
194 case QZ_F11: mplayer_put_key(KEY_F+11);break; | |
195 case QZ_F12: mplayer_put_key(KEY_F+12);break; | |
12624 | 196 case QZ_INSERT: mplayer_put_key(KEY_INSERT);break; |
197 case QZ_DELETE: mplayer_put_key(KEY_DELETE);break; | |
198 case QZ_HOME: mplayer_put_key(KEY_HOME);break; | |
199 case QZ_END: mplayer_put_key(KEY_END);break; | |
12460 | 200 case QZ_KP_PLUS: mplayer_put_key('+');break; |
201 case QZ_KP_MINUS: mplayer_put_key('-');break; | |
12624 | 202 case QZ_TAB: mplayer_put_key(KEY_TAB);break; |
12460 | 203 case QZ_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; |
204 case QZ_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; | |
205 case QZ_UP: mplayer_put_key(KEY_UP);break; | |
206 case QZ_DOWN: mplayer_put_key(KEY_DOWN);break; | |
207 case QZ_LEFT: mplayer_put_key(KEY_LEFT);break; | |
208 case QZ_RIGHT: mplayer_put_key(KEY_RIGHT);break; | |
12624 | 209 case QZ_KP_MULTIPLY: mplayer_put_key('*');break; |
210 case QZ_KP_DIVIDE: mplayer_put_key('/');break; | |
211 case QZ_KP_ENTER: mplayer_put_key(KEY_BACKSPACE);break; | |
212 case QZ_KP_PERIOD: mplayer_put_key(KEY_KPDEC); break; | |
12460 | 213 case QZ_KP0: mplayer_put_key(KEY_KP0); break; |
214 case QZ_KP1: mplayer_put_key(KEY_KP1); break; | |
215 case QZ_KP2: mplayer_put_key(KEY_KP2); break; | |
216 case QZ_KP3: mplayer_put_key(KEY_KP3); break; | |
217 case QZ_KP4: mplayer_put_key(KEY_KP4); break; | |
218 case QZ_KP5: mplayer_put_key(KEY_KP5); break; | |
219 case QZ_KP6: mplayer_put_key(KEY_KP6); break; | |
220 case QZ_KP7: mplayer_put_key(KEY_KP7); break; | |
221 case QZ_KP8: mplayer_put_key(KEY_KP8); break; | |
222 case QZ_KP9: mplayer_put_key(KEY_KP9); break; | |
223 case QZ_LEFTBRACKET: SetWindowAlpha(theWindow, winAlpha-=0.05);break; | |
224 case QZ_RIGHTBRACKET: SetWindowAlpha(theWindow, winAlpha+=0.05);break; | |
12624 | 225 |
12460 | 226 default:mplayer_put_key(macCharCodes);break; |
227 } | |
228 } | |
229 | |
12624 | 230 default:result = eventNotHandledErr;break; |
12460 | 231 } |
232 } | |
233 else if(class == kEventClassMouse) | |
234 { | |
235 WindowPtr tmpWin; | |
236 Point mousePos; | |
237 | |
238 GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(Point), 0, &mousePos); | |
239 | |
240 switch (kind) | |
241 { | |
242 case kEventMouseDown: | |
12296 | 243 { |
12460 | 244 EventMouseButton button; |
245 GetEventParameter(event, kEventParamMouseButton, typeMouseButton, 0, sizeof(EventMouseButton), 0, &button); | |
246 | |
12296 | 247 short part = FindWindow(mousePos,&tmpWin); |
248 | |
249 if(part == inMenuBar) | |
250 { | |
251 MenuSelect(mousePos); | |
12460 | 252 HiliteMenu(0); |
12296 | 253 } |
12460 | 254 else if(part == inContent) |
255 { | |
256 switch(button) | |
257 { | |
258 case 1: mplayer_put_key(MOUSE_BTN0);break; | |
259 case 2: mplayer_put_key(MOUSE_BTN2);break; | |
260 case 3: mplayer_put_key(MOUSE_BTN1);break; | |
261 | |
12624 | 262 default:result = eventNotHandledErr;break; |
12460 | 263 } |
264 } | |
265 } | |
266 break; | |
267 | |
268 case kEventMouseWheelMoved: | |
269 { | |
270 int wheel; | |
271 GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(int), 0, &wheel); | |
272 | |
273 short part = FindWindow(mousePos,&tmpWin); | |
274 | |
275 if(part == inContent) | |
276 { | |
277 if(wheel > 0) | |
278 mplayer_put_key(MOUSE_BTN3); | |
279 else | |
280 mplayer_put_key(MOUSE_BTN4); | |
281 } | |
282 } | |
283 break; | |
284 | |
12624 | 285 default:result = eventNotHandledErr;break; |
12460 | 286 } |
287 } | |
288 | |
12624 | 289 return result; |
12296 | 290 } |
12120 | 291 |
12487 | 292 static void quartz_CreateWindow(uint32_t d_width, uint32_t d_height, WindowAttributes windowAttrs) |
293 { | |
294 CFStringRef titleKey; | |
295 CFStringRef windowTitle; | |
296 OSStatus result; | |
297 | |
298 SetRect(&winRect, 0, 0, d_width, d_height); | |
299 SetRect(&oldWinRect, 0, 0, d_width, d_height); | |
300 SetRect(&dstRect, 0, 0, d_width, d_height); | |
301 | |
302 CreateNewWindow(kDocumentWindowClass, windowAttrs, &winRect, &theWindow); | |
303 | |
304 //Set window title | |
305 titleKey = CFSTR("MPlayer"); | |
306 windowTitle = CFCopyLocalizedString(titleKey, NULL); | |
307 result = SetWindowTitleWithCFString(theWindow, windowTitle); | |
308 CFRelease(titleKey); | |
309 CFRelease(windowTitle); | |
310 | |
311 //Install event handler | |
312 const EventTypeSpec winEvents[] = { { kEventClassKeyboard, kEventRawKeyDown }, | |
313 { kEventClassMouse, kEventMouseDown }, | |
314 { kEventClassMouse, kEventMouseWheelMoved }, | |
315 { kEventClassWindow, kEventWindowClosed }, | |
316 { kEventClassWindow, kEventWindowBoundsChanged } }; | |
317 | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
318 InstallApplicationEventHandler (NewEventHandlerUPP (MainEventHandler), GetEventTypeCount(winEvents), winEvents, NULL, NULL); |
12487 | 319 } |
320 | |
12296 | 321 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) |
322 { | |
323 WindowAttributes windowAttrs; | |
324 GDHandle deviceHdl; | |
12414 | 325 OSErr qterr; |
12296 | 326 |
327 //Get Main device info/////////////////////////////////////////////////// | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
328 int i; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
329 |
12296 | 330 deviceHdl = GetMainDevice(); |
331 | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
332 for(i=0; i<device_id; i++) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
333 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
334 deviceHdl = GetNextDevice(deviceHdl); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
335 |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
336 if(deviceHdl == NULL) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
337 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
338 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Device ID %d do not exist, falling back to main device.\n", device_id); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
339 deviceHdl = GetMainDevice(); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
340 break; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
341 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
342 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
343 |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
344 deviceRect = (*deviceHdl)->gdRect; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
345 device_width = deviceRect.right-deviceRect.left; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
346 device_height = deviceRect.bottom-deviceRect.top; |
12296 | 347 |
348 //misc mplayer setup///////////////////////////////////////////////////// | |
12487 | 349 SetRect(&imgRect, 0, 0, width, height); |
12414 | 350 switch (image_format) |
351 { | |
352 case IMGFMT_RGB32: | |
12432 | 353 image_depth = 32; |
12414 | 354 break; |
355 case IMGFMT_YV12: | |
356 case IMGFMT_IYUV: | |
357 case IMGFMT_I420: | |
358 case IMGFMT_UYVY: | |
359 case IMGFMT_YUY2: | |
360 image_depth = 16; | |
361 break; | |
362 } | |
12487 | 363 image_size = ((imgRect.right*imgRect.bottom*image_depth)+7)/8; |
12296 | 364 |
365 vo_fs = flags & VOFLAG_FULLSCREEN; | |
366 | |
367 //get movie aspect | |
368 aspect_save_orig(width,height); | |
369 aspect_save_prescale(d_width,d_height); | |
370 aspect_save_screenres(device_width, device_height); | |
371 | |
372 aspect(&d_width,&d_height,A_NOZOOM); | |
373 | |
374 //Create player window////////////////////////////////////////////////// | |
375 windowAttrs = kWindowStandardDocumentAttributes | |
376 | kWindowStandardHandlerAttribute | |
377 | kWindowLiveResizeAttribute; | |
12425 | 378 |
12432 | 379 windowAttrs &= (~kWindowResizableAttribute); |
12296 | 380 |
12487 | 381 if (theWindow == NULL) |
382 { | |
383 quartz_CreateWindow(d_width, d_height, windowAttrs); | |
384 | |
385 if (theWindow == NULL) | |
386 { | |
387 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Couldn't create window !!!!!\n"); | |
388 return -1; | |
389 } | |
390 } | |
391 else | |
392 { | |
393 HideWindow(theWindow); | |
394 ChangeWindowAttributes(theWindow, ~windowAttrs, windowAttrs); | |
395 SetRect(&winRect, 0, 0, d_width, d_height); | |
396 SetRect(&oldWinRect, 0, 0, d_width, d_height); | |
397 SizeWindow (theWindow, d_width, d_height, 1); | |
398 } | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
399 |
12623 | 400 SetPort(GetWindowPort(theWindow)); |
12433 | 401 |
12432 | 402 switch (image_format) |
403 { | |
404 case IMGFMT_YV12: | |
405 case IMGFMT_IYUV: | |
406 case IMGFMT_I420: | |
407 case IMGFMT_UYVY: | |
408 case IMGFMT_YUY2: | |
12424 | 409 { |
12623 | 410 get_image_done = 0; |
411 | |
412 if (!EnterMoviesDone) | |
413 { | |
414 qterr = EnterMovies(); | |
415 EnterMoviesDone = 1; | |
416 } | |
417 else | |
418 qterr = 0; | |
419 | |
420 if (qterr) | |
421 { | |
422 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: EnterMovies (%d)\n", qterr); | |
423 return -1; | |
424 } | |
425 | |
426 | |
427 SetIdentityMatrix(&matrix); | |
428 | |
429 if ((d_width != width) || (d_height != height)) | |
430 { | |
431 ScaleMatrix(&matrix, FixDiv(Long2Fix(d_width),Long2Fix(width)), FixDiv(Long2Fix(d_height),Long2Fix(height)), 0, 0); | |
432 } | |
433 | |
12432 | 434 yuv_qt_stuff.desc = (ImageDescriptionHandle)NewHandleClear( sizeof(ImageDescription) ); |
12424 | 435 |
12432 | 436 yuv_qt_stuff.extension_colr = NewHandleClear(sizeof(NCLCColorInfoImageDescriptionExtension)); |
437 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->colorParamType = kVideoColorInfoImageDescriptionExtensionType; | |
438 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->primaries = 2; | |
439 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->transferFunction = 2; | |
440 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->matrix = 2; | |
441 | |
442 yuv_qt_stuff.extension_fiel = NewHandleClear(sizeof(FieldInfoImageDescriptionExtension)); | |
443 ((FieldInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_fiel))->fieldCount = 1; | |
444 ((FieldInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_fiel))->fieldOrderings = 0; | |
12424 | 445 |
12432 | 446 yuv_qt_stuff.extension_clap = NewHandleClear(sizeof(CleanApertureImageDescriptionExtension)); |
12487 | 447 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureWidthN = imgRect.right; |
12432 | 448 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureWidthD = 1; |
12487 | 449 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureHeightN = imgRect.bottom; |
12432 | 450 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureHeightD = 1; |
451 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->horizOffN = 0; | |
452 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->horizOffD = 1; | |
453 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->vertOffN = 0; | |
454 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->vertOffD = 1; | |
455 | |
456 yuv_qt_stuff.extension_pasp = NewHandleClear(sizeof(PixelAspectRatioImageDescriptionExtension)); | |
457 ((PixelAspectRatioImageDescriptionExtension*)(*yuv_qt_stuff.extension_pasp))->hSpacing = 1; | |
458 ((PixelAspectRatioImageDescriptionExtension*)(*yuv_qt_stuff.extension_pasp))->vSpacing = 1; | |
459 | |
460 (*yuv_qt_stuff.desc)->idSize = sizeof(ImageDescription); | |
461 (*yuv_qt_stuff.desc)->cType = image_qtcodec; | |
462 (*yuv_qt_stuff.desc)->version = 2; | |
463 (*yuv_qt_stuff.desc)->revisionLevel = 0; | |
464 (*yuv_qt_stuff.desc)->vendor = 'mpla'; | |
12487 | 465 (*yuv_qt_stuff.desc)->width = imgRect.right; |
466 (*yuv_qt_stuff.desc)->height = imgRect.bottom; | |
12432 | 467 (*yuv_qt_stuff.desc)->hRes = Long2Fix(72); |
468 (*yuv_qt_stuff.desc)->vRes = Long2Fix(72); | |
469 (*yuv_qt_stuff.desc)->temporalQuality = 0; | |
470 (*yuv_qt_stuff.desc)->spatialQuality = codecLosslessQuality; | |
471 (*yuv_qt_stuff.desc)->frameCount = 1; | |
472 (*yuv_qt_stuff.desc)->dataSize = 0; | |
473 (*yuv_qt_stuff.desc)->depth = 24; | |
474 (*yuv_qt_stuff.desc)->clutID = -1; | |
12424 | 475 |
12432 | 476 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_colr, kColorInfoImageDescriptionExtension); |
477 if (qterr) | |
478 { | |
12487 | 479 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [colr] (%d)\n", qterr); |
12432 | 480 } |
481 | |
482 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_fiel, kFieldInfoImageDescriptionExtension); | |
483 if (qterr) | |
484 { | |
12487 | 485 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [fiel] (%d)\n", qterr); |
12432 | 486 } |
487 | |
488 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_clap, kCleanApertureImageDescriptionExtension); | |
489 if (qterr) | |
490 { | |
12487 | 491 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [clap] (%d)\n", qterr); |
12432 | 492 } |
493 | |
494 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_pasp, kCleanApertureImageDescriptionExtension); | |
495 if (qterr) | |
496 { | |
12487 | 497 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [pasp] (%d)\n", qterr); |
12432 | 498 } |
12487 | 499 if (P != NULL) { // second or subsequent movie |
500 free(P); | |
501 } | |
12432 | 502 P = calloc(sizeof(PlanarPixmapInfoYUV420) + image_size, 1); |
503 switch (image_format) | |
504 { | |
505 case IMGFMT_YV12: | |
506 case IMGFMT_IYUV: | |
507 case IMGFMT_I420: | |
508 P->componentInfoY.offset = sizeof(PlanarPixmapInfoYUV420); | |
509 P->componentInfoCb.offset = P->componentInfoY.offset + image_size / 2; | |
510 P->componentInfoCr.offset = P->componentInfoCb.offset + image_size / 4; | |
12487 | 511 P->componentInfoY.rowBytes = imgRect.right; |
512 P->componentInfoCb.rowBytes = imgRect.right / 2; | |
513 P->componentInfoCr.rowBytes = imgRect.right / 2; | |
12432 | 514 image_buffer_size = image_size + sizeof(PlanarPixmapInfoYUV420); |
515 break; | |
516 case IMGFMT_UYVY: | |
517 case IMGFMT_YUY2: | |
518 image_buffer_size = image_size; | |
519 break; | |
520 } | |
12414 | 521 |
12432 | 522 qterr = DecompressSequenceBeginS(&seqId, |
12414 | 523 yuv_qt_stuff.desc, |
12432 | 524 (char *)P, |
12414 | 525 image_buffer_size, |
12623 | 526 GetWindowPort(theWindow), |
12432 | 527 NULL, |
528 NULL, | |
12414 | 529 ((d_width != width) || (d_height != height)) ? |
12432 | 530 &matrix : NULL, |
12414 | 531 srcCopy, |
12432 | 532 NULL, |
533 0, | |
12414 | 534 codecLosslessQuality, |
535 bestSpeedCodec); | |
12432 | 536 |
537 if (qterr) | |
538 { | |
539 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: DecompressSequenceBeginS (%d)\n", qterr); | |
12487 | 540 return -1; |
12432 | 541 } |
12424 | 542 } |
12432 | 543 break; |
12414 | 544 } |
545 | |
12424 | 546 //Show window |
547 RepositionWindow(theWindow, NULL, kWindowCascadeOnMainScreen); | |
12296 | 548 ShowWindow (theWindow); |
549 | |
550 if(vo_fs) | |
551 window_fullscreen(); | |
552 | |
553 if(vo_ontop) | |
554 window_ontop(); | |
555 | |
556 return 0; | |
12120 | 557 } |
558 | |
12296 | 559 static void check_events(void) |
12120 | 560 { |
12296 | 561 EventRef theEvent; |
562 EventTargetRef theTarget; | |
563 OSStatus theErr; | |
564 | |
565 //Get event | |
566 theTarget = GetEventDispatcherTarget(); | |
567 theErr = ReceiveNextEvent(0, 0, kEventDurationNoWait,true, &theEvent); | |
568 if(theErr == noErr && theEvent != NULL) | |
569 { | |
570 SendEventToEventTarget (theEvent, theTarget); | |
571 ReleaseEvent(theEvent); | |
572 } | |
12120 | 573 |
12296 | 574 //update activity every 30 seconds to prevent |
575 //screensaver from starting up. | |
576 DateTimeRec d; | |
577 unsigned long curTime; | |
578 static unsigned long lastTime = 0; | |
579 | |
580 GetTime(&d); | |
581 DateToSeconds( &d, &curTime); | |
582 | |
583 if( ( (curTime - lastTime) >= 30) || (lastTime == 0)) | |
584 { | |
585 UpdateSystemActivity(UsrActivity); | |
586 lastTime = curTime; | |
587 } | |
588 } | |
12120 | 589 |
12296 | 590 static void draw_osd(void) |
591 { | |
12487 | 592 vo_draw_text(imgRect.right,imgRect.bottom,draw_alpha); |
12296 | 593 } |
12120 | 594 |
12296 | 595 static void flip_page(void) |
596 { | |
12432 | 597 switch (image_format) |
598 { | |
12433 | 599 case IMGFMT_YV12: |
600 case IMGFMT_IYUV: | |
601 case IMGFMT_I420: | |
602 case IMGFMT_UYVY: | |
603 case IMGFMT_YUY2: | |
604 if (EnterMoviesDone) | |
605 { | |
606 OSErr qterr; | |
607 CodecFlags flags = 0; | |
608 qterr = DecompressSequenceFrameWhen(seqId, | |
609 (char *)P, | |
610 image_buffer_size, | |
611 0, //codecFlagUseImageBuffer, | |
612 &flags, | |
613 NULL, | |
614 NULL); | |
615 if (qterr) | |
616 { | |
12487 | 617 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: DecompressSequenceFrameWhen in flip_page (%d) flags:0x%08x\n", qterr, flags); |
12433 | 618 } |
619 } | |
620 break; | |
621 } | |
12296 | 622 } |
623 | |
624 static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) | |
625 { | |
12433 | 626 switch (image_format) |
627 { | |
12487 | 628 case IMGFMT_YV12: |
629 case IMGFMT_I420: | |
630 memcpy_pic(((char*)P) + P->componentInfoY.offset + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); | |
631 x=x/2;y=y/2;w=w/2;h=h/2; | |
632 | |
633 memcpy_pic(((char*)P) + P->componentInfoCb.offset + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); | |
634 memcpy_pic(((char*)P) + P->componentInfoCr.offset + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); | |
635 return 0; | |
636 | |
637 case IMGFMT_IYUV: | |
638 memcpy_pic(((char*)P) + P->componentInfoY.offset + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); | |
639 x=x/2;y=y/2;w=w/2;h=h/2; | |
640 | |
641 memcpy_pic(((char*)P) + P->componentInfoCr.offset + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); | |
642 memcpy_pic(((char*)P) + P->componentInfoCb.offset + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); | |
643 return 0; | |
12433 | 644 } |
12296 | 645 return -1; |
646 } | |
647 | |
648 static uint32_t draw_frame(uint8_t *src[]) | |
649 { | |
12433 | 650 switch (image_format) |
651 { | |
652 case IMGFMT_UYVY: | |
653 case IMGFMT_YUY2: | |
12487 | 654 memcpy_pic(((char*)P), src[0], imgRect.right * 2, imgRect.bottom, imgRect.right * 2, imgRect.right * 2); |
12433 | 655 return 0; |
656 } | |
657 return -1; | |
12296 | 658 } |
12120 | 659 |
12296 | 660 static uint32_t query_format(uint32_t format) |
661 { | |
662 image_format = format; | |
12432 | 663 image_qtcodec = 0; |
664 | |
12424 | 665 if ((format == IMGFMT_YV12) || (format == IMGFMT_IYUV) || (format == IMGFMT_I420)) |
666 { | |
667 image_qtcodec = kMpegYUV420CodecType; //kYUV420CodecType ?; | |
12487 | 668 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; |
12414 | 669 } |
670 | |
12424 | 671 if (format == IMGFMT_YUY2) |
672 { | |
673 image_qtcodec = kComponentVideoUnsigned; | |
12487 | 674 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
12414 | 675 } |
676 | |
12424 | 677 if (format == IMGFMT_UYVY) |
678 { | |
679 image_qtcodec = k422YpCbCr8CodecType; | |
12487 | 680 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
12424 | 681 } |
12414 | 682 |
12296 | 683 return 0; |
684 } | |
12120 | 685 |
12296 | 686 static void uninit(void) |
687 { | |
12432 | 688 OSErr qterr; |
12424 | 689 |
12432 | 690 if (EnterMoviesDone) |
691 { | |
692 qterr = CDSequenceEnd(seqId); | |
693 if (qterr) | |
694 { | |
12487 | 695 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: CDSequenceEnd (%d)\n", qterr); |
12424 | 696 } |
12414 | 697 } |
12432 | 698 |
12296 | 699 ShowMenuBar(); |
700 } | |
12120 | 701 |
12296 | 702 static uint32_t preinit(const char *arg) |
703 { | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
704 int parse_err = 0; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
705 |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
706 if(arg) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
707 { |
12623 | 708 char *parse_pos = (char *)&arg[0]; |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
709 while (parse_pos[0] && !parse_err) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
710 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
711 if (strncmp (parse_pos, "device_id=", 10) == 0) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
712 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
713 parse_pos = &parse_pos[10]; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
714 device_id = strtol(parse_pos, &parse_pos, 0); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
715 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
716 if (parse_pos[0] == ':') parse_pos = &parse_pos[1]; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
717 else if (parse_pos[0]) parse_err = 1; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
718 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
719 } |
12296 | 720 return 0; |
12120 | 721 } |
722 | |
12424 | 723 static uint32_t draw_yuv_image(mp_image_t *mpi) |
724 { | |
725 // ATM we're only called for planar IMGFMT | |
726 // drawing is done directly in P | |
727 // and displaying is in flip_page. | |
12487 | 728 return get_image_done ? VO_TRUE : VO_FALSE; |
12414 | 729 } |
730 | |
12424 | 731 static uint32_t get_yuv_image(mp_image_t *mpi) |
732 { | |
733 if(mpi->type!=MP_IMGTYPE_EXPORT) return VO_FALSE; | |
12414 | 734 |
12424 | 735 if(mpi->imgfmt!=image_format) return VO_FALSE; |
12414 | 736 |
12424 | 737 if(mpi->flags&MP_IMGFLAG_PLANAR) |
738 { | |
739 if (mpi->num_planes != 3) | |
740 { | |
741 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: only 3 planes allowed in get_yuv_image for planar (%d) \n", mpi->num_planes); | |
742 return VO_FALSE; | |
743 } | |
12414 | 744 |
12424 | 745 mpi->planes[0]=((char*)P) + P->componentInfoY.offset; |
12487 | 746 mpi->stride[0]=imgRect.right; |
747 mpi->width=imgRect.right; | |
12414 | 748 |
12424 | 749 if(mpi->flags&MP_IMGFLAG_SWAPPED) |
750 { | |
751 // I420 | |
752 mpi->planes[1]=((char*)P) + P->componentInfoCb.offset; | |
753 mpi->planes[2]=((char*)P) + P->componentInfoCr.offset; | |
12487 | 754 mpi->stride[1]=imgRect.right/2; |
755 mpi->stride[2]=imgRect.right/2; | |
12424 | 756 } |
757 else | |
758 { | |
759 // YV12 | |
760 mpi->planes[1]=((char*)P) + P->componentInfoCr.offset; | |
761 mpi->planes[2]=((char*)P) + P->componentInfoCb.offset; | |
12487 | 762 mpi->stride[1]=imgRect.right/2; |
763 mpi->stride[2]=imgRect.right/2; | |
12424 | 764 } |
765 | |
766 mpi->flags|=MP_IMGFLAG_DIRECT; | |
12487 | 767 get_image_done = 1; |
12424 | 768 return VO_TRUE; |
769 } | |
770 else | |
12433 | 771 { |
772 // doesn't work yet | |
12424 | 773 if (mpi->num_planes != 1) |
774 { | |
775 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: only 1 plane allowed in get_yuv_image for packed (%d) \n", mpi->num_planes); | |
776 return VO_FALSE; | |
777 } | |
12414 | 778 |
12424 | 779 mpi->planes[0] = (char*)P; |
12487 | 780 mpi->stride[0] = imgRect.right * 2; |
781 mpi->width=imgRect.right; | |
12424 | 782 mpi->flags|=MP_IMGFLAG_DIRECT; |
12487 | 783 get_image_done = 1; |
12424 | 784 return VO_TRUE; |
785 } | |
786 return VO_FALSE; | |
12414 | 787 } |
788 | |
12296 | 789 static uint32_t control(uint32_t request, void *data, ...) |
12120 | 790 { |
12424 | 791 switch (request) |
792 { | |
793 case VOCTRL_PAUSE: return (int_pause=1); | |
794 case VOCTRL_RESUME: return (int_pause=0); | |
12460 | 795 case VOCTRL_FULLSCREEN: vo_fs = (!(vo_fs)); window_fullscreen(); return VO_TRUE; |
796 case VOCTRL_ONTOP: vo_ontop = (!(vo_ontop)); window_ontop(); return VO_TRUE; | |
12424 | 797 case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); |
798 case VOCTRL_GET_IMAGE: | |
799 switch (image_format) | |
800 { | |
801 case IMGFMT_YV12: | |
802 case IMGFMT_IYUV: | |
803 case IMGFMT_I420: | |
12487 | 804 case IMGFMT_UYVY: |
805 case IMGFMT_YUY2: | |
12424 | 806 return get_yuv_image(data); |
807 break; | |
12487 | 808 default: |
809 break; | |
12424 | 810 } |
811 case VOCTRL_DRAW_IMAGE: | |
812 switch (image_format) | |
813 { | |
814 case IMGFMT_YV12: | |
815 case IMGFMT_IYUV: | |
816 case IMGFMT_I420: | |
12487 | 817 case IMGFMT_UYVY: |
818 case IMGFMT_YUY2: | |
12424 | 819 return draw_yuv_image(data); |
820 break; | |
12487 | 821 default: |
822 break; | |
12424 | 823 } |
824 } | |
825 return VO_NOTIMPL; | |
12120 | 826 } |
827 | |
12296 | 828 void window_resized() |
12120 | 829 { |
12296 | 830 float aspectX; |
831 float aspectY; | |
832 | |
833 int padding; | |
834 | |
835 uint32_t d_width; | |
836 uint32_t d_height; | |
837 | |
12623 | 838 GetPortBounds( GetWindowPort(theWindow), &winRect ); |
12120 | 839 |
12296 | 840 aspect( &d_width, &d_height, A_NOZOOM); |
841 | |
842 aspectX = (float)((float)winRect.right/(float)d_width); | |
843 aspectY = (float)((float)winRect.bottom/(float)d_height); | |
844 | |
845 if((d_height*aspectX)>winRect.bottom) | |
846 { | |
847 padding = (winRect.right - d_width*aspectY)/2; | |
848 SetRect(&dstRect, padding, 0, d_width*aspectY+padding, d_height*aspectY); | |
849 } | |
850 else | |
851 { | |
852 padding = (winRect.bottom - d_height*aspectX)/2; | |
853 SetRect(&dstRect, 0, padding, (d_width*aspectX), d_height*aspectX+padding); | |
854 } | |
12120 | 855 |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
856 //Clear Background |
12623 | 857 SetGWorld( GetWindowPort(theWindow), NULL ); |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
858 RGBColor blackC = { 0x0000, 0x0000, 0x0000 }; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
859 RGBForeColor( &blackC ); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
860 PaintRect( &winRect ); |
12414 | 861 |
12487 | 862 long scale_X = FixDiv(Long2Fix(dstRect.right - dstRect.left),Long2Fix(imgRect.right)); |
863 long scale_Y = FixDiv(Long2Fix(dstRect.bottom - dstRect.top),Long2Fix(imgRect.bottom)); | |
12414 | 864 |
12432 | 865 SetIdentityMatrix(&matrix); |
12487 | 866 if (((dstRect.right - dstRect.left) != imgRect.right) || ((dstRect.bottom - dstRect.right) != imgRect.bottom)) |
12432 | 867 { |
868 ScaleMatrix(&matrix, scale_X, scale_Y, 0, 0); | |
12414 | 869 |
12432 | 870 if (padding > 0) |
871 { | |
872 TranslateMatrix(&matrix, Long2Fix(dstRect.left), Long2Fix(dstRect.top)); | |
873 } | |
874 } | |
12424 | 875 |
12432 | 876 SetDSequenceMatrix(seqId, &matrix); |
12120 | 877 } |
878 | |
12296 | 879 void window_ontop() |
12460 | 880 { |
12432 | 881 if(vo_ontop) |
12296 | 882 SetWindowClass( theWindow, kUtilityWindowClass); |
883 else | |
884 SetWindowClass( theWindow, kDocumentWindowClass); | |
12120 | 885 } |
886 | |
12296 | 887 void window_fullscreen() |
12120 | 888 { |
12296 | 889 //go fullscreen |
12432 | 890 if(vo_fs) |
12296 | 891 { |
892 HideMenuBar(); | |
12120 | 893 |
12296 | 894 //save old window size |
12487 | 895 if (!vo_quartz_fs) |
896 GetWindowPortBounds(theWindow, &oldWinRect); | |
12296 | 897 |
898 //hide mouse cursor | |
899 HideCursor(); | |
900 | |
901 //go fullscreen | |
12432 | 902 //ChangeWindowAttributes(theWindow, 0, kWindowResizableAttribute); |
12425 | 903 |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
904 MoveWindow (theWindow, deviceRect.left, deviceRect.top, 1); |
12296 | 905 SizeWindow(theWindow, device_width, device_height,1); |
12487 | 906 |
907 vo_quartz_fs = 1; | |
12296 | 908 } |
909 else //go back to windowed mode | |
910 { | |
911 ShowMenuBar(); | |
12120 | 912 |
12296 | 913 //show mouse cursor |
914 ShowCursor(); | |
915 | |
916 //revert window to previous setting | |
12432 | 917 //ChangeWindowAttributes(theWindow, kWindowResizableAttribute, 0); |
12425 | 918 |
12487 | 919 SizeWindow(theWindow, oldWinRect.right, oldWinRect.bottom,1); |
12296 | 920 RepositionWindow(theWindow, NULL, kWindowCascadeOnMainScreen); |
12487 | 921 |
922 vo_quartz_fs = 0; | |
12296 | 923 } |
924 | |
925 window_resized(); | |
12120 | 926 } |