2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 \author Nicolas Plourde <nicolasplourde@gmail.com>
22 Copyright (c) Nicolas Plourde - April 2004
24 YUV support Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
26 \brief MPlayer Mac OSX Quartz video out module.
28 \todo: -screen overlay output
29 -fit osd in black bar when available
38 #include <Carbon/Carbon.h>
39 #include <QuickTime/QuickTime.h>
43 #include "fastmemcpy.h"
44 #include "video_out.h"
45 #include "video_out_internal.h"
53 #include "input/input.h"
54 #include "input/mouse.h"
56 #include "vo_quartz.h"
58 static const vo_info_t info
=
62 "Nicolas Plourde <nicolasplourde@hotmail.com>, Romain Dolbeau <romain@dolbeau.org>",
66 const LIBVO_EXTERN(quartz
)
68 static uint32_t image_depth
;
69 static uint32_t image_format
;
70 static uint32_t image_size
;
71 static uint32_t image_buffer_size
;
72 static char *image_data
;
74 static ImageSequence seqId
;
75 static CodecType image_qtcodec
;
76 static PlanarPixmapInfoYUV420
*P
= NULL
;
79 ImageDescriptionHandle desc
;
80 Handle extension_colr
;
81 Handle extension_fiel
;
82 Handle extension_clap
;
83 Handle extension_pasp
;
85 static MatrixRecord matrix
;
86 static int EnterMoviesDone
= 0;
87 static int get_image_done
= 0;
89 static int vo_quartz_fs
; // we are in fullscreen
90 static float old_movie_aspect
;
92 static int winLevel
= 1;
95 kCGDesktopWindowLevelKey
,
96 kCGNormalWindowLevelKey
,
97 kCGScreenSaverWindowLevelKey
100 static int int_pause
= 0;
101 static float winAlpha
= 1;
102 static int mouseHide
= FALSE
;
104 static int device_id
= 0;
106 static short fs_res_x
= 0;
107 static short fs_res_y
= 0;
109 static WindowRef theWindow
= NULL
;
110 static WindowGroupRef winGroup
= NULL
;
111 static CGRect bounds
;
112 static CGDirectDisplayID displayId
= 0;
113 static CFDictionaryRef originalMode
= NULL
;
115 static CGDataProviderRef dataProviderRef
= NULL
;
116 static CGImageRef image
= NULL
;
118 static Rect imgRect
; // size of the original image (unscaled)
119 static Rect dstRect
; // size of the displayed image (after scaling)
120 static Rect winRect
; // size of the window containg the displayed image (include padding)
121 static Rect oldWinRect
; // size of the window containg the displayed image (include padding) when NOT in FS mode
122 static CGRect displayRect
; // size of the display device
123 static Rect oldWinBounds
;
125 static MenuRef windMenu
;
126 static MenuRef movMenu
;
127 static MenuRef aspectMenu
;
129 static int lastScreensaverUpdate
= 0;
130 static int lastMouseHide
= 0;
136 kNormalScreenCmd
= 3,
137 kDoubleScreenCmd
= 4,
146 #include "osdep/keycodes.h"
148 //PROTOTYPE/////////////////////////////////////////////////////////////////
149 static OSStatus
KeyEventHandler(EventHandlerCallRef nextHandler
, EventRef event
, void *userData
);
150 static OSStatus
MouseEventHandler(EventHandlerCallRef nextHandler
, EventRef event
, void *userData
);
151 static OSStatus
WindowEventHandler(EventHandlerCallRef nextHandler
, EventRef event
, void *userData
);
152 void window_resized();
154 void window_fullscreen();
155 void window_panscan();
157 static inline int convert_key(UInt32 key
, UInt32 charcode
)
162 case QZ_RETURN
: return KEY_ENTER
;
163 case QZ_ESCAPE
: return KEY_ESC
;
164 case QZ_BACKSPACE
: return KEY_BACKSPACE
;
165 case QZ_LALT
: return KEY_BACKSPACE
;
166 case QZ_LCTRL
: return KEY_BACKSPACE
;
167 case QZ_LSHIFT
: return KEY_BACKSPACE
;
168 case QZ_F1
: return KEY_F
+ 1;
169 case QZ_F2
: return KEY_F
+ 2;
170 case QZ_F3
: return KEY_F
+ 3;
171 case QZ_F4
: return KEY_F
+ 4;
172 case QZ_F5
: return KEY_F
+ 5;
173 case QZ_F6
: return KEY_F
+ 6;
174 case QZ_F7
: return KEY_F
+ 7;
175 case QZ_F8
: return KEY_F
+ 8;
176 case QZ_F9
: return KEY_F
+ 9;
177 case QZ_F10
: return KEY_F
+ 10;
178 case QZ_F11
: return KEY_F
+ 11;
179 case QZ_F12
: return KEY_F
+ 12;
180 case QZ_INSERT
: return KEY_INSERT
;
181 case QZ_DELETE
: return KEY_DELETE
;
182 case QZ_HOME
: return KEY_HOME
;
183 case QZ_END
: return KEY_END
;
184 case QZ_KP_PLUS
: return '+';
185 case QZ_KP_MINUS
: return '-';
186 case QZ_TAB
: return KEY_TAB
;
187 case QZ_PAGEUP
: return KEY_PAGE_UP
;
188 case QZ_PAGEDOWN
: return KEY_PAGE_DOWN
;
189 case QZ_UP
: return KEY_UP
;
190 case QZ_DOWN
: return KEY_DOWN
;
191 case QZ_LEFT
: return KEY_LEFT
;
192 case QZ_RIGHT
: return KEY_RIGHT
;
193 case QZ_KP_MULTIPLY
: return '*';
194 case QZ_KP_DIVIDE
: return '/';
195 case QZ_KP_ENTER
: return KEY_KPENTER
;
196 case QZ_KP_PERIOD
: return KEY_KPDEC
;
197 case QZ_KP0
: return KEY_KP0
;
198 case QZ_KP1
: return KEY_KP1
;
199 case QZ_KP2
: return KEY_KP2
;
200 case QZ_KP3
: return KEY_KP3
;
201 case QZ_KP4
: return KEY_KP4
;
202 case QZ_KP5
: return KEY_KP5
;
203 case QZ_KP6
: return KEY_KP6
;
204 case QZ_KP7
: return KEY_KP7
;
205 case QZ_KP8
: return KEY_KP8
;
206 case QZ_KP9
: return KEY_KP9
;
207 default: return charcode
;
211 static void draw_alpha(int x0
, int y0
, int w
, int h
, unsigned char *src
, unsigned char *srca
, int stride
)
213 switch (image_format
)
216 vo_draw_alpha_rgb32(w
, h
, src
, srca
, stride
, image_data
+ 4 * (y0
* imgRect
.right
+ x0
), 4 * imgRect
.right
);
221 vo_draw_alpha_yv12(w
, h
, src
, srca
, stride
, ((char *)P
) + be2me_32(P
->componentInfoY
.offset
) + x0
+ y0
* imgRect
.right
, imgRect
.right
);
224 vo_draw_alpha_uyvy(w
, h
, src
, srca
, stride
, ((char *)P
) + (x0
+ y0
* imgRect
.right
) * 2, imgRect
.right
* 2);
227 vo_draw_alpha_yuy2(w
, h
, src
, srca
, stride
, ((char *)P
) + (x0
+ y0
* imgRect
.right
) * 2, imgRect
.right
* 2);
232 //default keyboard event handler
233 static OSStatus
KeyEventHandler(EventHandlerCallRef nextHandler
, EventRef event
, void *userData
)
235 OSStatus result
= noErr
;
236 UInt32
class = GetEventClass(event
);
237 UInt32 kind
= GetEventKind(event
);
239 result
= CallNextEventHandler(nextHandler
, event
);
241 if (class == kEventClassKeyboard
)
245 UInt32 macKeyModifiers
;
247 GetEventParameter(event
, kEventParamKeyMacCharCodes
, typeChar
, NULL
, sizeof(macCharCodes
), NULL
, &macCharCodes
);
248 GetEventParameter(event
, kEventParamKeyCode
, typeUInt32
, NULL
, sizeof(macKeyCode
), NULL
, &macKeyCode
);
249 GetEventParameter(event
, kEventParamKeyModifiers
, typeUInt32
, NULL
, sizeof(macKeyModifiers
), NULL
, &macKeyModifiers
);
251 if (macKeyModifiers
!= 256)
253 if (kind
== kEventRawKeyRepeat
|| kind
== kEventRawKeyDown
)
255 int key
= convert_key(macKeyCode
, macCharCodes
);
258 mplayer_put_key(key
);
261 else if (macKeyModifiers
== 256)
263 switch (macCharCodes
)
265 case '[': SetWindowAlpha(theWindow
, winAlpha
-= 0.05); break;
266 case ']': SetWindowAlpha(theWindow
, winAlpha
+= 0.05); break;
270 result
= eventNotHandledErr
;
276 //default mouse event handler
277 static OSStatus
MouseEventHandler(EventHandlerCallRef nextHandler
, EventRef event
, void *userData
)
279 OSStatus result
= noErr
;
280 UInt32
class = GetEventClass(event
);
281 UInt32 kind
= GetEventKind(event
);
283 result
= CallNextEventHandler(nextHandler
, event
);
285 if (class == kEventClassMouse
)
291 GetEventParameter(event
, kEventParamMouseLocation
, typeQDPoint
, 0, sizeof(Point
), 0, &mousePos
);
292 GetEventParameter(event
, kEventParamWindowMouseLocation
, typeQDPoint
, 0, sizeof(Point
), 0, &winMousePos
);
296 case kEventMouseMoved
:
300 CGDisplayShowCursor(displayId
);
306 case kEventMouseWheelMoved
:
311 GetEventParameter(event
, kEventParamMouseWheelDelta
, typeSInt32
, 0, sizeof(int), 0, &wheel
);
313 part
= FindWindow(mousePos
, &tmpWin
);
315 if (part
== inContent
)
318 mplayer_put_key(MOUSE_BTN3
);
320 mplayer_put_key(MOUSE_BTN4
);
325 case kEventMouseDown
:
328 EventMouseButton button
;
332 GetWindowPortBounds(theWindow
, &bounds
);
333 GetEventParameter(event
, kEventParamMouseButton
, typeMouseButton
, 0, sizeof(EventMouseButton
), 0, &button
);
335 part
= FindWindow(mousePos
, &tmpWin
);
336 if (kind
== kEventMouseUp
)
338 if (part
!= inContent
)
342 case kEventMouseButtonPrimary
:
343 mplayer_put_key(MOUSE_BTN0
);
345 case kEventMouseButtonSecondary
:
346 mplayer_put_key(MOUSE_BTN2
);
348 case kEventMouseButtonTertiary
:
349 mplayer_put_key(MOUSE_BTN1
);
353 result
= eventNotHandledErr
;
358 if ((winMousePos
.h
> (bounds
.right
- 15)) && (winMousePos
.v
> (bounds
.bottom
)))
364 ResizeWindow(theWindow
, mousePos
, NULL
, &newSize
);
367 else if (part
== inMenuBar
)
369 MenuSelect(mousePos
);
372 else if (part
== inContent
)
376 case kEventMouseButtonPrimary
:
377 mplayer_put_key(MOUSE_BTN0
| MP_KEY_DOWN
);
379 case kEventMouseButtonSecondary
:
380 mplayer_put_key(MOUSE_BTN2
| MP_KEY_DOWN
);
382 case kEventMouseButtonTertiary
:
383 mplayer_put_key(MOUSE_BTN1
| MP_KEY_DOWN
);
387 result
= eventNotHandledErr
;
394 case kEventMouseDragged
:
398 result
= eventNotHandledErr
;
406 //default window event handler
407 static OSStatus
WindowEventHandler(EventHandlerCallRef nextHandler
, EventRef event
, void *userData
)
409 OSStatus result
= noErr
;
412 UInt32
class = GetEventClass(event
);
413 UInt32 kind
= GetEventKind(event
);
415 result
= CallNextEventHandler(nextHandler
, event
);
417 aspect(&d_width
, &d_height
, A_NOZOOM
);
419 if (class == kEventClassCommand
)
421 HICommand theHICommand
;
423 GetEventParameter(event
, kEventParamDirectObject
, typeHICommand
, NULL
, sizeof(HICommand
), NULL
, &theHICommand
);
425 switch (theHICommand
.commandID
)
428 mplayer_put_key(KEY_CLOSE_WIN
);
438 SizeWindow(theWindow
, (d_width
/ 2), ((d_width
/ movie_aspect
) / 2), 1);
442 case kNormalScreenCmd
:
449 SizeWindow(theWindow
, d_width
, (d_width
/ movie_aspect
), 1);
453 case kDoubleScreenCmd
:
460 SizeWindow(theWindow
, (d_width
* 2), ((d_width
/ movie_aspect
) * 2), 1);
470 vo_keepaspect
= (!(vo_keepaspect
));
471 CheckMenuItem(aspectMenu
, 1, vo_keepaspect
);
476 movie_aspect
= old_movie_aspect
;
479 SizeWindow(theWindow
, dstRect
.right
, (dstRect
.right
/ movie_aspect
), 1);
485 movie_aspect
= 4.0f
/ 3.0f
;
488 SizeWindow(theWindow
, dstRect
.right
, (dstRect
.right
/ movie_aspect
), 1);
494 movie_aspect
= 16.0f
/ 9.0f
;
497 SizeWindow(theWindow
, dstRect
.right
, (dstRect
.right
/ movie_aspect
), 1);
503 vo_panscan
= (!(vo_panscan
));
504 CheckMenuItem(aspectMenu
, 2, vo_panscan
);
510 result
= eventNotHandledErr
;
514 else if (class == kEventClassWindow
)
517 Rect rectWindow
= { 0, 0, 0, 0 };
519 GetEventParameter(event
, kEventParamDirectObject
, typeWindowRef
, NULL
, sizeof(WindowRef
), NULL
, &window
);
523 GetWindowBounds(window
, kWindowGlobalPortRgn
, &rectWindow
);
528 case kEventWindowClosed
:
530 mplayer_put_key(KEY_CLOSE_WIN
);
534 case kEventWindowZoomed
:
535 case kEventWindowBoundsChanged
:
542 result
= eventNotHandledErr
;
550 static void quartz_CreateWindow(uint32_t d_width
, uint32_t d_height
, WindowAttributes windowAttrs
)
552 CFStringRef titleKey
;
553 CFStringRef windowTitle
;
557 CFStringRef movMenuTitle
;
558 CFStringRef aspMenuTitle
;
560 const EventTypeSpec win_events
[] = {
561 {kEventClassWindow
, kEventWindowClosed
},
562 {kEventClassWindow
, kEventWindowBoundsChanged
},
563 {kEventClassCommand
, kEventCommandProcess
}
566 const EventTypeSpec key_events
[] = {
567 {kEventClassKeyboard
, kEventRawKeyDown
},
568 {kEventClassKeyboard
, kEventRawKeyRepeat
}
571 const EventTypeSpec mouse_events
[] = {
572 {kEventClassMouse
, kEventMouseMoved
},
573 {kEventClassMouse
, kEventMouseWheelMoved
},
574 {kEventClassMouse
, kEventMouseDown
},
575 {kEventClassMouse
, kEventMouseUp
},
576 {kEventClassMouse
, kEventMouseDragged
}
579 SetRect(&winRect
, 0, 0, d_width
, d_height
);
580 SetRect(&oldWinRect
, 0, 0, d_width
, d_height
);
581 SetRect(&dstRect
, 0, 0, d_width
, d_height
);
586 // Create Window Menu
587 CreateStandardWindowMenu(0, &windMenu
);
588 InsertMenu(windMenu
, 0);
591 CreateNewMenu(1004, 0, &movMenu
);
592 movMenuTitle
= CFSTR("Movie");
593 SetMenuTitleWithCFString(movMenu
, movMenuTitle
);
595 AppendMenuItemTextWithCFString(movMenu
, CFSTR("Half Size"), 0, kHalfScreenCmd
, &index
);
596 SetMenuItemCommandKey(movMenu
, index
, 0, '0');
598 AppendMenuItemTextWithCFString(movMenu
, CFSTR("Normal Size"), 0, kNormalScreenCmd
, &index
);
599 SetMenuItemCommandKey(movMenu
, index
, 0, '1');
601 AppendMenuItemTextWithCFString(movMenu
, CFSTR("Double Size"), 0, kDoubleScreenCmd
, &index
);
602 SetMenuItemCommandKey(movMenu
, index
, 0, '2');
604 AppendMenuItemTextWithCFString(movMenu
, CFSTR("Full Size"), 0, kFullScreenCmd
, &index
);
605 SetMenuItemCommandKey(movMenu
, index
, 0, 'F');
607 AppendMenuItemTextWithCFString(movMenu
, NULL
, kMenuItemAttrSeparator
, 0, &index
);
609 AppendMenuItemTextWithCFString(movMenu
, CFSTR("Aspect Ratio"), 0, 0, &index
);
611 //// Create Aspect Ratio Sub Menu
612 CreateNewMenu(0, 0, &aspectMenu
);
613 aspMenuTitle
= CFSTR("Aspect Ratio");
614 SetMenuTitleWithCFString(aspectMenu
, aspMenuTitle
);
615 SetMenuItemHierarchicalMenu(movMenu
, 6, aspectMenu
);
617 AppendMenuItemTextWithCFString(aspectMenu
, CFSTR("Keep"), 0, kKeepAspectCmd
, &index
);
618 CheckMenuItem(aspectMenu
, 1, vo_keepaspect
);
619 AppendMenuItemTextWithCFString(aspectMenu
, CFSTR("Pan-Scan"), 0, kPanScanCmd
, &index
);
620 CheckMenuItem(aspectMenu
, 2, vo_panscan
);
621 AppendMenuItemTextWithCFString(aspectMenu
, NULL
, kMenuItemAttrSeparator
, 0, &index
);
622 AppendMenuItemTextWithCFString(aspectMenu
, CFSTR("Original"), 0, kAspectOrgCmd
, &index
);
623 AppendMenuItemTextWithCFString(aspectMenu
, CFSTR("4:3"), 0, kAspectFullCmd
, &index
);
624 AppendMenuItemTextWithCFString(aspectMenu
, CFSTR("16:9"), 0, kAspectWideCmd
, &index
);
626 InsertMenu(movMenu
, GetMenuID(windMenu
)); //insert before Window menu
631 CreateNewWindow(kDocumentWindowClass
, windowAttrs
, &winRect
, &theWindow
);
633 CreateWindowGroup(0, &winGroup
);
634 SetWindowGroup(theWindow
, winGroup
);
637 titleKey
= CFSTR("MPlayer - The Movie Player");
638 windowTitle
= CFCopyLocalizedString(titleKey
, NULL
);
639 result
= SetWindowTitleWithCFString(theWindow
, windowTitle
);
641 CFRelease(windowTitle
);
643 // Install event handler
644 InstallApplicationEventHandler(NewEventHandlerUPP(KeyEventHandler
), GetEventTypeCount(key_events
), key_events
, NULL
, NULL
);
645 InstallApplicationEventHandler(NewEventHandlerUPP(MouseEventHandler
), GetEventTypeCount(mouse_events
), mouse_events
, NULL
, NULL
);
646 InstallWindowEventHandler(theWindow
, NewEventHandlerUPP(WindowEventHandler
), GetEventTypeCount(win_events
), win_events
, theWindow
, NULL
);
649 static int config(uint32_t width
, uint32_t height
, uint32_t d_width
, uint32_t d_height
, uint32_t flags
, char *title
, uint32_t format
)
651 WindowAttributes windowAttrs
;
654 CGDisplayCount displayCount
;
655 CGDirectDisplayID
*displays
;
657 // Get Main device info///////////////////////////////////////////////////
659 // Display IDs might not be consecutive, get the list of all devices up to # device_id
660 displayCount
= device_id
+ 1;
661 displays
= malloc(sizeof(CGDirectDisplayID
) * displayCount
);
662 if (kCGErrorSuccess
!= CGGetActiveDisplayList(displayCount
, displays
, &displayCount
) || displayCount
< device_id
+ 1) {
663 mp_msg(MSGT_VO
, MSGL_FATAL
, "Quartz error: Device ID %d do not exist, falling back to main device.\n", device_id
);
664 displayId
= kCGDirectMainDisplay
;
669 displayId
= displays
[device_id
];
673 displayRect
= CGDisplayBounds(displayId
);
675 monitor_aspect
= (float)displayRect
.size
.width
/ (float)displayRect
.size
.height
;
677 // misc mplayer setup/////////////////////////////////////////////////////
678 SetRect(&imgRect
, 0, 0, width
, height
);
679 switch (image_format
)
692 image_size
= ((imgRect
.right
* imgRect
.bottom
* image_depth
) + 7) / 8;
694 vo_fs
= flags
& VOFLAG_FULLSCREEN
;
698 aspect_save_orig(width
, height
);
699 aspect_save_prescale(d_width
, d_height
);
700 aspect_save_screenres(displayRect
.size
.width
, displayRect
.size
.height
);
702 aspect(&d_width
, &d_height
, A_NOZOOM
);
704 movie_aspect
= (float)d_width
/ (float)d_height
;
705 old_movie_aspect
= movie_aspect
;
710 image_data
= malloc(image_size
);
712 // Create player window//////////////////////////////////////////////////
713 windowAttrs
= kWindowStandardDocumentAttributes
714 | kWindowStandardHandlerAttribute
715 | kWindowLiveResizeAttribute
;
717 windowAttrs
&= (~kWindowResizableAttribute
);
719 if (theWindow
== NULL
)
721 CGContextRef context
;
723 quartz_CreateWindow(d_width
, d_height
, windowAttrs
);
725 if (theWindow
== NULL
)
727 mp_msg(MSGT_VO
, MSGL_FATAL
, "Quartz error: Couldn't create window !!!!!\n");
730 tmpBounds
= CGRectMake(0, 0, winRect
.right
, winRect
.bottom
);
731 QDBeginCGContext(GetWindowPort(theWindow
), &context
);
732 CGContextFillRect(context
, tmpBounds
);
733 QDEndCGContext(GetWindowPort(theWindow
), &context
);
737 HideWindow(theWindow
);
738 ChangeWindowAttributes(theWindow
, ~windowAttrs
, windowAttrs
);
739 SetRect(&winRect
, 0, 0, d_width
, d_height
);
740 SetRect(&oldWinRect
, 0, 0, d_width
, d_height
);
741 SizeWindow(theWindow
, d_width
, d_height
, 1);
744 switch (image_format
)
748 CGContextRef context
;
750 QDBeginCGContext(GetWindowPort(theWindow
), &context
);
752 dataProviderRef
= CGDataProviderCreateWithData(0, image_data
, imgRect
.right
* imgRect
.bottom
* 4, 0);
754 image
= CGImageCreate(imgRect
.right
,
758 ((imgRect
.right
* 32) + 7) / 8,
759 CGColorSpaceCreateDeviceRGB(),
760 kCGImageAlphaNoneSkipFirst
,
761 dataProviderRef
, 0, 1, kCGRenderingIntentDefault
);
763 QDEndCGContext(GetWindowPort(theWindow
), &context
);
775 if (!EnterMoviesDone
)
777 qterr
= EnterMovies();
785 mp_msg(MSGT_VO
, MSGL_FATAL
, "Quartz error: EnterMovies (%d)\n", qterr
);
790 SetIdentityMatrix(&matrix
);
792 if ((d_width
!= width
) || (d_height
!= height
))
794 ScaleMatrix(&matrix
, FixDiv(Long2Fix(d_width
), Long2Fix(width
)), FixDiv(Long2Fix(d_height
), Long2Fix(height
)), 0, 0);
797 yuv_qt_stuff
.desc
= (ImageDescriptionHandle
) NewHandleClear(sizeof(ImageDescription
));
799 yuv_qt_stuff
.extension_colr
= NewHandleClear(sizeof(NCLCColorInfoImageDescriptionExtension
));
800 ((NCLCColorInfoImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_colr
))->colorParamType
= kVideoColorInfoImageDescriptionExtensionType
;
801 ((NCLCColorInfoImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_colr
))->primaries
= 2;
802 ((NCLCColorInfoImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_colr
))->transferFunction
= 2;
803 ((NCLCColorInfoImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_colr
))->matrix
= 2;
805 yuv_qt_stuff
.extension_fiel
= NewHandleClear(sizeof(FieldInfoImageDescriptionExtension
));
806 ((FieldInfoImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_fiel
))->fieldCount
= 1;
807 ((FieldInfoImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_fiel
))->fieldOrderings
= 0;
809 yuv_qt_stuff
.extension_clap
= NewHandleClear(sizeof(CleanApertureImageDescriptionExtension
));
810 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->cleanApertureWidthN
= imgRect
.right
;
811 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->cleanApertureWidthD
= 1;
812 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->cleanApertureHeightN
= imgRect
.bottom
;
813 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->cleanApertureHeightD
= 1;
814 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->horizOffN
= 0;
815 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->horizOffD
= 1;
816 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->vertOffN
= 0;
817 ((CleanApertureImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_clap
))->vertOffD
= 1;
819 yuv_qt_stuff
.extension_pasp
= NewHandleClear(sizeof(PixelAspectRatioImageDescriptionExtension
));
820 ((PixelAspectRatioImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_pasp
))->hSpacing
= 1;
821 ((PixelAspectRatioImageDescriptionExtension
*) (*yuv_qt_stuff
.extension_pasp
))->vSpacing
= 1;
823 (*yuv_qt_stuff
.desc
)->idSize
= sizeof(ImageDescription
);
824 (*yuv_qt_stuff
.desc
)->cType
= image_qtcodec
;
825 (*yuv_qt_stuff
.desc
)->version
= 2;
826 (*yuv_qt_stuff
.desc
)->revisionLevel
= 0;
827 (*yuv_qt_stuff
.desc
)->vendor
= 'mpla';
828 (*yuv_qt_stuff
.desc
)->width
= imgRect
.right
;
829 (*yuv_qt_stuff
.desc
)->height
= imgRect
.bottom
;
830 (*yuv_qt_stuff
.desc
)->hRes
= Long2Fix(72);
831 (*yuv_qt_stuff
.desc
)->vRes
= Long2Fix(72);
832 (*yuv_qt_stuff
.desc
)->temporalQuality
= 0;
833 (*yuv_qt_stuff
.desc
)->spatialQuality
= codecLosslessQuality
;
834 (*yuv_qt_stuff
.desc
)->frameCount
= 1;
835 (*yuv_qt_stuff
.desc
)->dataSize
= 0;
836 (*yuv_qt_stuff
.desc
)->depth
= 24;
837 (*yuv_qt_stuff
.desc
)->clutID
= -1;
839 qterr
= AddImageDescriptionExtension(yuv_qt_stuff
.desc
, yuv_qt_stuff
.extension_colr
, kColorInfoImageDescriptionExtension
);
842 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: AddImageDescriptionExtension [colr] (%d)\n", qterr
);
845 qterr
= AddImageDescriptionExtension(yuv_qt_stuff
.desc
, yuv_qt_stuff
.extension_fiel
, kFieldInfoImageDescriptionExtension
);
848 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: AddImageDescriptionExtension [fiel] (%d)\n", qterr
);
851 qterr
= AddImageDescriptionExtension(yuv_qt_stuff
.desc
, yuv_qt_stuff
.extension_clap
, kCleanApertureImageDescriptionExtension
);
854 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: AddImageDescriptionExtension [clap] (%d)\n", qterr
);
857 qterr
= AddImageDescriptionExtension(yuv_qt_stuff
.desc
, yuv_qt_stuff
.extension_pasp
, kCleanApertureImageDescriptionExtension
);
860 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: AddImageDescriptionExtension [pasp] (%d)\n", qterr
);
862 if (P
!= NULL
) { // second or subsequent movie
865 P
= calloc(sizeof(PlanarPixmapInfoYUV420
) + image_size
, 1);
866 switch (image_format
)
871 P
->componentInfoY
.offset
= be2me_32(sizeof(PlanarPixmapInfoYUV420
));
872 P
->componentInfoCb
.offset
= be2me_32(be2me_32(P
->componentInfoY
.offset
) + image_size
/ 2);
873 P
->componentInfoCr
.offset
= be2me_32(be2me_32(P
->componentInfoCb
.offset
) + image_size
/ 4);
874 P
->componentInfoY
.rowBytes
= be2me_32(imgRect
.right
);
875 P
->componentInfoCb
.rowBytes
= be2me_32(imgRect
.right
/ 2);
876 P
->componentInfoCr
.rowBytes
= be2me_32(imgRect
.right
/ 2);
877 image_buffer_size
= image_size
+ sizeof(PlanarPixmapInfoYUV420
);
881 image_buffer_size
= image_size
;
885 qterr
= DecompressSequenceBeginS(&seqId
,
889 GetWindowPort(theWindow
),
892 ((d_width
!= width
) || (d_height
!= height
)) ?
897 codecLosslessQuality
,
902 mp_msg(MSGT_VO
, MSGL_FATAL
, "Quartz error: DecompressSequenceBeginS (%d)\n", qterr
);
910 RepositionWindow(theWindow
, NULL
, kWindowCenterOnMainScreen
);
911 ShowWindow(theWindow
);
923 SetWindowGroupLevel(winGroup
, CGWindowLevelForKey(levelList
[winLevel
]));
932 static void check_events(void)
935 EventTargetRef theTarget
;
939 theTarget
= GetEventDispatcherTarget();
940 theErr
= ReceiveNextEvent(0, 0, kEventDurationNoWait
, true, &theEvent
);
941 if (theErr
== noErr
&& theEvent
!= NULL
)
943 SendEventToEventTarget(theEvent
, theTarget
);
944 ReleaseEvent(theEvent
);
948 static void draw_osd(void)
950 vo_draw_text(imgRect
.right
, imgRect
.bottom
, draw_alpha
);
953 static void flip_page(void)
957 if (theWindow
== NULL
)
960 switch (image_format
)
964 CGContextRef context
;
966 QDBeginCGContext(GetWindowPort(theWindow
), &context
);
967 CGContextDrawImage(context
, bounds
, image
);
968 QDEndCGContext(GetWindowPort(theWindow
), &context
);
980 CodecFlags flags
= 0;
982 qterr
= DecompressSequenceFrameWhen(seqId
,
985 0, //codecFlagUseImageBuffer,
991 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: DecompressSequenceFrameWhen in flip_page (%d) flags:0x%08x\n", qterr
, flags
);
999 CGContextRef context
;
1001 QDBeginCGContext(GetWindowPort(theWindow
), &context
);
1002 // render resize box
1003 CGContextBeginPath(context
);
1004 CGContextSetAllowsAntialiasing(context
, false);
1005 //CGContextSaveGState(context);
1008 CGContextSetRGBStrokeColor(context
, 0.2, 0.2, 0.2, 0.5);
1009 CGContextMoveToPoint(context
, winRect
.right
- 1, 1); CGContextAddLineToPoint(context
, winRect
.right
- 1, 1);
1010 CGContextMoveToPoint(context
, winRect
.right
- 1, 5); CGContextAddLineToPoint(context
, winRect
.right
- 5, 1);
1011 CGContextMoveToPoint(context
, winRect
.right
- 1, 9); CGContextAddLineToPoint(context
, winRect
.right
- 9, 1);
1012 CGContextStrokePath(context
);
1015 CGContextSetRGBStrokeColor(context
, 0.4, 0.4, 0.4, 0.5);
1016 CGContextMoveToPoint(context
, winRect
.right
- 1, 2); CGContextAddLineToPoint(context
, winRect
.right
- 2, 1);
1017 CGContextMoveToPoint(context
, winRect
.right
- 1, 6); CGContextAddLineToPoint(context
, winRect
.right
- 6, 1);
1018 CGContextMoveToPoint(context
, winRect
.right
- 1, 10); CGContextAddLineToPoint(context
, winRect
.right
- 10, 1);
1019 CGContextStrokePath(context
);
1022 CGContextSetRGBStrokeColor(context
, 0.6, 0.6, 0.6, 0.5);
1023 CGContextMoveToPoint(context
, winRect
.right
- 1, 3); CGContextAddLineToPoint(context
, winRect
.right
- 3, 1);
1024 CGContextMoveToPoint(context
, winRect
.right
- 1, 7); CGContextAddLineToPoint(context
, winRect
.right
- 7, 1);
1025 CGContextMoveToPoint(context
, winRect
.right
- 1, 11); CGContextAddLineToPoint(context
, winRect
.right
- 11, 1);
1026 CGContextStrokePath(context
);
1028 // CGContextRestoreGState( context );
1029 CGContextFlush(context
);
1030 QDEndCGContext(GetWindowPort(theWindow
), &context
);
1033 curTime
= TickCount() / 60;
1035 // auto hide mouse cursor (and future on-screen control?)
1036 if (vo_quartz_fs
&& !mouseHide
)
1038 if (((curTime
- lastMouseHide
) >= 5) || (lastMouseHide
== 0))
1040 CGDisplayHideCursor(displayId
);
1042 lastMouseHide
= curTime
;
1045 // update activity every 30 seconds to prevent
1046 // screensaver from starting up.
1047 if (((curTime
- lastScreensaverUpdate
) >= 30) || (lastScreensaverUpdate
== 0))
1049 UpdateSystemActivity(UsrActivity
);
1050 lastScreensaverUpdate
= curTime
;
1054 static int draw_slice(uint8_t * src
[], int stride
[], int w
, int h
, int x
, int y
)
1056 switch (image_format
)
1060 memcpy_pic(((char *)P
) + be2me_32(P
->componentInfoY
.offset
) + x
+ imgRect
.right
* y
, src
[0], w
, h
, imgRect
.right
, stride
[0]);
1061 x
=x
/2;y
=y
/2;w
=w
/2;h
=h
/2;
1063 memcpy_pic(((char *)P
) + be2me_32(P
->componentInfoCb
.offset
) + x
+ imgRect
.right
/ 2 * y
, src
[1], w
, h
, imgRect
.right
/ 2, stride
[1]);
1064 memcpy_pic(((char *)P
) + be2me_32(P
->componentInfoCr
.offset
) + x
+ imgRect
.right
/ 2 * y
, src
[2], w
, h
, imgRect
.right
/ 2, stride
[2]);
1068 memcpy_pic(((char *)P
) + be2me_32(P
->componentInfoY
.offset
) + x
+ imgRect
.right
* y
, src
[0], w
, h
, imgRect
.right
, stride
[0]);
1069 x
=x
/2;y
=y
/2;w
=w
/2;h
=h
/2;
1071 memcpy_pic(((char *)P
) + be2me_32(P
->componentInfoCr
.offset
) + x
+ imgRect
.right
/ 2 * y
, src
[1], w
, h
, imgRect
.right
/ 2, stride
[1]);
1072 memcpy_pic(((char *)P
) + be2me_32(P
->componentInfoCb
.offset
) + x
+ imgRect
.right
/ 2 * y
, src
[2], w
, h
, imgRect
.right
/ 2, stride
[2]);
1078 static int draw_frame(uint8_t * src
[])
1080 switch (image_format
)
1083 fast_memcpy(image_data
, src
[0], image_size
);
1088 memcpy_pic(((char *)P
), src
[0], imgRect
.right
* 2, imgRect
.bottom
, imgRect
.right
* 2, imgRect
.right
* 2);
1094 static int query_format(uint32_t format
)
1096 image_format
= format
;
1099 if (format
== IMGFMT_RGB32
)
1101 return VFCAP_CSP_SUPPORTED
| VFCAP_OSD
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
;
1104 if ((format
== IMGFMT_YV12
) || (format
== IMGFMT_IYUV
) || (format
== IMGFMT_I420
))
1106 image_qtcodec
= kMpegYUV420CodecType
; //kYUV420CodecType ?;
1107 return VFCAP_CSP_SUPPORTED
| VFCAP_OSD
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
| VFCAP_ACCEPT_STRIDE
;
1110 if (format
== IMGFMT_YUY2
)
1112 image_qtcodec
= kComponentVideoUnsigned
;
1113 return VFCAP_CSP_SUPPORTED
| VFCAP_OSD
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
;
1116 if (format
== IMGFMT_UYVY
)
1118 image_qtcodec
= k422YpCbCr8CodecType
;
1119 return VFCAP_CSP_SUPPORTED
| VFCAP_OSD
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
;
1125 static void uninit(void)
1129 switch (image_format
)
1137 if (EnterMoviesDone
)
1139 qterr
= CDSequenceEnd(seqId
);
1142 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: CDSequenceEnd (%d)\n", qterr
);
1154 static int preinit(const char *arg
)
1160 char *parse_pos
= (char *)&arg
[0];
1162 while (parse_pos
[0] && !parse_err
)
1164 if (strncmp(parse_pos
, "device_id=", 10) == 0)
1166 parse_pos
= &parse_pos
[10];
1167 device_id
= strtol(parse_pos
, &parse_pos
, 0);
1169 if (strncmp(parse_pos
, "fs_res=", 7) == 0)
1171 parse_pos
= &parse_pos
[7];
1172 fs_res_x
= strtol(parse_pos
, &parse_pos
, 0);
1173 parse_pos
= &parse_pos
[1];
1174 fs_res_y
= strtol(parse_pos
, &parse_pos
, 0);
1176 if (parse_pos
[0] == ':')
1177 parse_pos
= &parse_pos
[1];
1178 else if (parse_pos
[0])
1183 #if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
1184 // this chunk of code is heavily based off SDL_macosx.m from SDL
1185 // the CPSEnableForegroundOperation that was here before is private and shouldn't be used
1186 // replaced by a call to the 10.3+ TransformProcessType
1188 ProcessSerialNumber myProc
, frProc
;
1191 if (GetFrontProcess(&frProc
) == noErr
)
1193 if (GetCurrentProcess(&myProc
) == noErr
)
1195 if (SameProcess(&frProc
, &myProc
, &sameProc
) == noErr
&& !sameProc
)
1197 TransformProcessType(&myProc
, kProcessTransformToForegroundApplication
);
1199 SetFrontProcess(&myProc
);
1208 static uint32_t draw_yuv_image(mp_image_t
* mpi
)
1210 // ATM we're only called for planar IMGFMT
1211 // drawing is done directly in P
1212 // and displaying is in flip_page.
1213 return get_image_done
? VO_TRUE
: VO_FALSE
;
1216 static uint32_t get_yuv_image(mp_image_t
* mpi
)
1218 if (mpi
->type
!= MP_IMGTYPE_EXPORT
) return VO_FALSE
;
1220 if (mpi
->imgfmt
!= image_format
) return VO_FALSE
;
1222 if (mpi
->flags
& MP_IMGFLAG_PLANAR
)
1224 if (mpi
->num_planes
!= 3)
1226 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: only 3 planes allowed in get_yuv_image for planar (%d) \n", mpi
->num_planes
);
1230 mpi
->planes
[0] = ((char *)P
) + be2me_32(P
->componentInfoY
.offset
);
1231 mpi
->stride
[0] = imgRect
.right
;
1232 mpi
->width
= imgRect
.right
;
1234 if (mpi
->flags
& MP_IMGFLAG_SWAPPED
)
1237 mpi
->planes
[1] = ((char *)P
) + be2me_32(P
->componentInfoCb
.offset
);
1238 mpi
->planes
[2] = ((char *)P
) + be2me_32(P
->componentInfoCr
.offset
);
1239 mpi
->stride
[1] = imgRect
.right
/ 2;
1240 mpi
->stride
[2] = imgRect
.right
/ 2;
1245 mpi
->planes
[1] = ((char *)P
) + be2me_32(P
->componentInfoCr
.offset
);
1246 mpi
->planes
[2] = ((char *)P
) + be2me_32(P
->componentInfoCb
.offset
);
1247 mpi
->stride
[1] = imgRect
.right
/ 2;
1248 mpi
->stride
[2] = imgRect
.right
/ 2;
1251 mpi
->flags
|= MP_IMGFLAG_DIRECT
;
1258 if (mpi
->num_planes
!= 1)
1260 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: only 1 plane allowed in get_yuv_image for packed (%d) \n", mpi
->num_planes
);
1264 mpi
->planes
[0] = (char *)P
;
1265 mpi
->stride
[0] = imgRect
.right
* 2;
1266 mpi
->width
= imgRect
.right
;
1267 mpi
->flags
|= MP_IMGFLAG_DIRECT
;
1274 static int control(uint32_t request
, void *data
)
1278 case VOCTRL_PAUSE
: return int_pause
= 1;
1279 case VOCTRL_RESUME
: return int_pause
= 0;
1280 case VOCTRL_FULLSCREEN
: vo_fs
= (!(vo_fs
)); window_fullscreen(); return VO_TRUE
;
1281 case VOCTRL_ONTOP
: vo_ontop
= (!(vo_ontop
)); window_ontop(); return VO_TRUE
;
1282 case VOCTRL_QUERY_FORMAT
: return query_format(*((uint32_t *) data
));
1283 case VOCTRL_GET_PANSCAN
: return VO_TRUE
;
1284 case VOCTRL_SET_PANSCAN
: window_panscan(); return VO_TRUE
;
1286 case VOCTRL_GET_IMAGE
:
1287 switch (image_format
)
1294 return get_yuv_image(data
);
1299 case VOCTRL_DRAW_IMAGE
:
1300 switch (image_format
)
1307 return draw_yuv_image(data
);
1316 void window_resized()
1328 CGContextRef context
;
1330 GetWindowPortBounds(theWindow
, &winRect
);
1334 aspect(&d_width
, &d_height
, A_NOZOOM
);
1335 d_height
= ((float)d_width
/ movie_aspect
);
1337 aspectX
= (float)((float)winRect
.right
/ (float)d_width
);
1338 aspectY
= (float)((float)(winRect
.bottom
) / (float)d_height
);
1340 if ((d_height
* aspectX
) > (winRect
.bottom
))
1342 padding
= (winRect
.right
- d_width
* aspectY
) / 2;
1343 SetRect(&dstRect
, padding
, 0, d_width
* aspectY
+ padding
, d_height
* aspectY
);
1347 padding
= ((winRect
.bottom
) - d_height
* aspectX
) / 2;
1348 SetRect(&dstRect
, 0, padding
, (d_width
* aspectX
), d_height
* aspectX
+ padding
);
1353 SetRect(&dstRect
, 0, 0, winRect
.right
, winRect
.bottom
);
1356 switch (image_format
)
1360 bounds
= CGRectMake(dstRect
.left
, dstRect
.top
, dstRect
.right
- dstRect
.left
, dstRect
.bottom
- dstRect
.top
);
1369 long scale_X
= FixDiv(Long2Fix(dstRect
.right
- dstRect
.left
), Long2Fix(imgRect
.right
));
1370 long scale_Y
= FixDiv(Long2Fix(dstRect
.bottom
- dstRect
.top
), Long2Fix(imgRect
.bottom
));
1372 SetIdentityMatrix(&matrix
);
1373 if (((dstRect
.right
- dstRect
.left
) != imgRect
.right
) || ((dstRect
.bottom
- dstRect
.right
) != imgRect
.bottom
))
1375 ScaleMatrix(&matrix
, scale_X
, scale_Y
, 0, 0);
1379 TranslateMatrix(&matrix
, Long2Fix(dstRect
.left
), Long2Fix(dstRect
.top
));
1383 SetDSequenceMatrix(seqId
, &matrix
);
1391 tmpBounds
= CGRectMake(0, 0, winRect
.right
, winRect
.bottom
);
1392 QDBeginCGContext(GetWindowPort(theWindow
), &context
);
1393 CGContextFillRect(context
, tmpBounds
);
1394 QDEndCGContext(GetWindowPort(theWindow
), &context
);
1401 // Cycle between level
1406 SetWindowGroupLevel(winGroup
, CGWindowLevelForKey(levelList
[winLevel
]));
1409 void window_fullscreen()
1416 if (displayId
== kCGDirectMainDisplay
)
1418 SetSystemUIMode(kUIModeAllHidden
, kUIOptionAutoShowMenuBar
);
1419 CGDisplayHideCursor(displayId
);
1423 if (fs_res_x
!= 0 || fs_res_y
!= 0)
1425 CFDictionaryRef mode
;
1426 size_t desiredBitDepth
= 32;
1427 boolean_t exactMatch
;
1429 originalMode
= CGDisplayCurrentMode(displayId
);
1431 mode
= CGDisplayBestModeForParameters(displayId
, desiredBitDepth
, fs_res_x
, fs_res_y
, &exactMatch
);
1437 // Warn if the mode doesn't match exactly
1438 mp_msg(MSGT_VO
, MSGL_WARN
, "Quartz warning: did not get exact mode match (got %dx%d) \n", (int)CFDictionaryGetValue(mode
, kCGDisplayWidth
), (int)CFDictionaryGetValue(mode
, kCGDisplayHeight
));
1441 CGDisplayCapture(displayId
);
1442 CGDisplaySwitchToMode(displayId
, mode
);
1446 mp_msg(MSGT_VO
, MSGL_ERR
, "Quartz error: can't switch to fullscreen \n");
1449 // Get Main device info///////////////////////////////////////////////////
1450 displayRect
= CGDisplayBounds(displayId
);
1453 // save old window size
1456 GetWindowPortBounds(theWindow
, &oldWinRect
);
1457 GetWindowBounds(theWindow
, kWindowContentRgn
, &oldWinBounds
);
1461 ChangeWindowAttributes(theWindow
, kWindowNoShadowAttribute
, 0);
1462 MoveWindow(theWindow
, displayRect
.origin
.x
- (vo_panscan_x
>> 1), displayRect
.origin
.y
- (vo_panscan_y
>> 1), 1);
1463 SizeWindow(theWindow
, displayRect
.size
.width
+ vo_panscan_x
, displayRect
.size
.height
+ vo_panscan_y
, 1);
1467 else //go back to windowed mode
1470 if (originalMode
!= NULL
)
1472 CGDisplaySwitchToMode(displayId
, originalMode
);
1473 CGDisplayRelease(displayId
);
1475 // Get Main device info///////////////////////////////////////////////////
1476 displayRect
= CGDisplayBounds(displayId
);
1478 originalMode
= NULL
;
1480 SetSystemUIMode(kUIModeNormal
, 0);
1482 // show mouse cursor
1483 CGDisplayShowCursor(displayId
);
1486 // revert window to previous setting
1487 ChangeWindowAttributes(theWindow
, 0, kWindowNoShadowAttribute
);
1488 SizeWindow(theWindow
, oldWinRect
.right
, oldWinRect
.bottom
, 1);
1489 MoveWindow(theWindow
, oldWinBounds
.left
, oldWinBounds
.top
, 1);
1494 void window_panscan()
1499 CheckMenuItem(aspectMenu
, 2, 1);
1501 CheckMenuItem(aspectMenu
, 2, 0);
1505 MoveWindow(theWindow
, displayRect
.origin
.x
- (vo_panscan_x
>> 1), displayRect
.origin
.y
- (vo_panscan_y
>> 1), 1);
1506 SizeWindow(theWindow
, displayRect
.size
.width
+ vo_panscan_x
, displayRect
.size
.height
+ vo_panscan_y
, 1);