Mercurial > mplayer.hg
annotate libvo/vo_quartz.c @ 25162:94f4e2f01dfd
r25058: Add missed translatable string in my previous commit
r25059: report why the dvd couldn't be opened. Patch by Jan Knutar jknutar+nic+fi
r25158: Make up missed update for osd message.
author | voroshil |
---|---|
date | Wed, 28 Nov 2007 14:15:40 +0000 |
parents | d86224fac2b5 |
children | 3aee342be929 |
rev | line source |
---|---|
12296 | 1 /* |
2 vo_quartz.c | |
3 | |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
4 by Nicolas Plourde <nicolasplourde@gmail.com> |
12296 | 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 | |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
12 todo: -screen overlay output |
13818
9f707a805967
window now save is old position when going in fullscreen or while using resize preset
nplourde
parents:
13796
diff
changeset
|
13 -fit osd in black bar when available |
15702 | 14 -fix RGB32 |
12296 | 15 -(add sugestion here) |
12120 | 16 */ |
17 | |
18 //SYS | |
19 #include <stdio.h> | |
20 | |
21 //OSX | |
22 #include <Carbon/Carbon.h> | |
12414 | 23 #include <QuickTime/QuickTime.h> |
12120 | 24 |
25 //MPLAYER | |
26 #include "config.h" | |
12414 | 27 #include "fastmemcpy.h" |
12120 | 28 #include "video_out.h" |
29 #include "video_out_internal.h" | |
30 #include "aspect.h" | |
12414 | 31 #include "mp_msg.h" |
32 #include "m_option.h" | |
22823
98eaf29b5dee
Code cleanup: don't include a .c file in mplayer.c and fix a few
rathann
parents:
21396
diff
changeset
|
33 #include "mp_fifo.h" |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
34 #include "mpbswap.h" |
12120 | 35 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13779
diff
changeset
|
36 #include "input/input.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13779
diff
changeset
|
37 #include "input/mouse.h" |
12120 | 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 |
12487 | 72 static int vo_quartz_fs; // we are in fullscreen |
13791 | 73 extern float monitor_aspect; |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
74 extern float movie_aspect; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
75 static float old_movie_aspect; |
12120 | 76 |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
77 static int winLevel = 1; |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
78 int levelList[] = |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
79 { |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
80 kCGDesktopWindowLevelKey, |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
81 kCGNormalWindowLevelKey, |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
82 kCGScreenSaverWindowLevelKey |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
83 }; |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
84 |
12487 | 85 static int int_pause = 0; |
86 static float winAlpha = 1; | |
15892 | 87 static int mouseHide = FALSE; |
12296 | 88 |
12487 | 89 static int device_width; |
90 static int device_height; | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
91 static int device_id; |
12120 | 92 |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
93 static short fs_res_x=0; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
94 static short fs_res_y=0; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
95 |
12487 | 96 static WindowRef theWindow = NULL; |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
97 static WindowGroupRef winGroup = NULL; |
13124 | 98 static CGContextRef context; |
99 static CGRect bounds; | |
13840 | 100 static GDHandle deviceHdl; |
13124 | 101 |
102 static CGDataProviderRef dataProviderRef; | |
103 static CGImageRef image; | |
12296 | 104 |
12487 | 105 static Rect imgRect; // size of the original image (unscaled) |
106 static Rect dstRect; // size of the displayed image (after scaling) | |
107 static Rect winRect; // size of the window containg the displayed image (include padding) | |
108 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
|
109 static Rect deviceRect; // size of the display device |
13840 | 110 static Rect oldWinBounds; |
12296 | 111 |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
112 static MenuRef windMenu; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
113 static MenuRef movMenu; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
114 static MenuRef aspectMenu; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
115 |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
116 enum |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
117 { |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
118 kQuitCmd = 1, |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
119 kHalfScreenCmd = 2, |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
120 kNormalScreenCmd = 3, |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
121 kDoubleScreenCmd = 4, |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
122 kFullScreenCmd = 5, |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
123 kKeepAspectCmd = 6, |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
124 kAspectOrgCmd = 7, |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
125 kAspectFullCmd = 8, |
13795 | 126 kAspectWideCmd = 9, |
127 kPanScanCmd = 10 | |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
128 }; |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
129 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13779
diff
changeset
|
130 #include "osdep/keycodes.h" |
15702 | 131 |
12296 | 132 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 | 133 |
134 //PROTOTYPE///////////////////////////////////////////////////////////////// | |
15702 | 135 static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); |
136 static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
137 static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
12296 | 138 void window_resized(); |
139 void window_ontop(); | |
140 void window_fullscreen(); | |
13840 | 141 void window_panscan(); |
12120 | 142 |
12886
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
143 static inline int convert_key(UInt32 key, UInt32 charcode) |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
144 { |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
145 switch(key) |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
146 { |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
147 case QZ_IBOOK_ENTER: |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
148 case QZ_RETURN: return KEY_ENTER; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
149 case QZ_ESCAPE: return KEY_ESC; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
150 case QZ_BACKSPACE: return KEY_BACKSPACE; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
151 case QZ_LALT: return KEY_BACKSPACE; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
152 case QZ_LCTRL: return KEY_BACKSPACE; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
153 case QZ_LSHIFT: return KEY_BACKSPACE; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
154 case QZ_F1: return KEY_F+1; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
155 case QZ_F2: return KEY_F+2; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
156 case QZ_F3: return KEY_F+3; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
157 case QZ_F4: return KEY_F+4; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
158 case QZ_F5: return KEY_F+5; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
159 case QZ_F6: return KEY_F+6; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
160 case QZ_F7: return KEY_F+7; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
161 case QZ_F8: return KEY_F+8; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
162 case QZ_F9: return KEY_F+9; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
163 case QZ_F10: return KEY_F+10; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
164 case QZ_F11: return KEY_F+11; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
165 case QZ_F12: return KEY_F+12; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
166 case QZ_INSERT: return KEY_INSERT; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
167 case QZ_DELETE: return KEY_DELETE; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
168 case QZ_HOME: return KEY_HOME; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
169 case QZ_END: return KEY_END; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
170 case QZ_KP_PLUS: return '+'; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
171 case QZ_KP_MINUS: return '-'; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
172 case QZ_TAB: return KEY_TAB; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
173 case QZ_PAGEUP: return KEY_PAGE_UP; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
174 case QZ_PAGEDOWN: return KEY_PAGE_DOWN; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
175 case QZ_UP: return KEY_UP; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
176 case QZ_DOWN: return KEY_DOWN; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
177 case QZ_LEFT: return KEY_LEFT; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
178 case QZ_RIGHT: return KEY_RIGHT; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
179 case QZ_KP_MULTIPLY: return '*'; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
180 case QZ_KP_DIVIDE: return '/'; |
24955 | 181 case QZ_KP_ENTER: return KEY_KPENTER; |
12886
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
182 case QZ_KP_PERIOD: return KEY_KPDEC; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
183 case QZ_KP0: return KEY_KP0; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
184 case QZ_KP1: return KEY_KP1; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
185 case QZ_KP2: return KEY_KP2; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
186 case QZ_KP3: return KEY_KP3; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
187 case QZ_KP4: return KEY_KP4; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
188 case QZ_KP5: return KEY_KP5; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
189 case QZ_KP6: return KEY_KP6; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
190 case QZ_KP7: return KEY_KP7; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
191 case QZ_KP8: return KEY_KP8; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
192 case QZ_KP9: return KEY_KP9; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
193 default: return charcode; |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
194 } |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
195 } |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
196 |
12296 | 197 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) |
198 { | |
12424 | 199 switch (image_format) |
200 { | |
201 case IMGFMT_RGB32: | |
202 vo_draw_alpha_rgb32(w,h,src,srca,stride,image_data+4*(y0*imgRect.right+x0),4*imgRect.right); | |
203 break; | |
204 case IMGFMT_YV12: | |
205 case IMGFMT_IYUV: | |
206 case IMGFMT_I420: | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
207 vo_draw_alpha_yv12(w,h,src,srca,stride, ((char*)P) + be2me_32(P->componentInfoY.offset) + x0 + y0 * imgRect.right, imgRect.right); |
12424 | 208 break; |
209 case IMGFMT_UYVY: | |
12517 | 210 vo_draw_alpha_uyvy(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); |
12424 | 211 break; |
212 case IMGFMT_YUY2: | |
12487 | 213 vo_draw_alpha_yuy2(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); |
12424 | 214 break; |
12487 | 215 } |
12296 | 216 } |
12120 | 217 |
15702 | 218 //default keyboard event handler |
219 static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) | |
12120 | 220 { |
12624 | 221 OSStatus result = noErr; |
12460 | 222 UInt32 class = GetEventClass (event); |
223 UInt32 kind = GetEventKind (event); | |
12624 | 224 |
225 result = CallNextEventHandler(nextHandler, event); | |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
226 |
13712
f6ef5a0ad7e4
removed duplicate case and fixed aspect ratio for window zoom feature
nplourde
parents:
13707
diff
changeset
|
227 if(class == kEventClassKeyboard) |
12460 | 228 { |
229 char macCharCodes; | |
230 UInt32 macKeyCode; | |
231 UInt32 macKeyModifiers; | |
232 | |
233 GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(macCharCodes), NULL, &macCharCodes); | |
234 GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(macKeyCode), NULL, &macKeyCode); | |
235 GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(macKeyModifiers), NULL, &macKeyModifiers); | |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
236 |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
237 if(macKeyModifiers != 256) |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
238 { |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
239 if (kind == kEventRawKeyRepeat || kind == kEventRawKeyDown) |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
240 { |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
241 int key = convert_key(macKeyCode, macCharCodes); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
242 if(key != -1) |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
243 mplayer_put_key(key); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
244 } |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
245 } |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
246 else if(macKeyModifiers == 256) |
12296 | 247 { |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
248 switch(macCharCodes) |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
249 { |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
250 case '[': SetWindowAlpha(theWindow, winAlpha-=0.05); break; |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
251 case ']': SetWindowAlpha(theWindow, winAlpha+=0.05); break; |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
252 } |
12460 | 253 } |
12886
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
254 else |
9b95958f4eb0
listen for key repeats, patch by Dan Christiansen
nplourde
parents:
12830
diff
changeset
|
255 result = eventNotHandledErr; |
12460 | 256 } |
15702 | 257 |
258 return result; | |
259 } | |
260 | |
261 //default mouse event handler | |
262 static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) | |
263 { | |
264 OSStatus result = noErr; | |
265 UInt32 class = GetEventClass (event); | |
266 UInt32 kind = GetEventKind (event); | |
267 | |
268 result = CallNextEventHandler(nextHandler, event); | |
269 | |
270 if(class == kEventClassMouse) | |
12460 | 271 { |
272 WindowPtr tmpWin; | |
273 Point mousePos; | |
15702 | 274 Point winMousePos; |
12460 | 275 |
276 GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(Point), 0, &mousePos); | |
15702 | 277 GetEventParameter(event, kEventParamWindowMouseLocation, typeQDPoint, 0, sizeof(Point), 0, &winMousePos); |
12460 | 278 |
279 switch (kind) | |
280 { | |
15881 | 281 case kEventMouseMoved: |
282 { | |
283 if(vo_quartz_fs) | |
284 { | |
18057 | 285 CGDisplayShowCursor(kCGDirectMainDisplay); |
15881 | 286 mouseHide = FALSE; |
287 } | |
288 } | |
289 break; | |
290 | |
15702 | 291 case kEventMouseWheelMoved: |
292 { | |
293 int wheel; | |
294 short part; | |
295 | |
296 GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(int), 0, &wheel); | |
297 | |
298 part = FindWindow(mousePos,&tmpWin); | |
299 | |
300 if(part == inContent) | |
301 { | |
302 if(wheel > 0) | |
303 mplayer_put_key(MOUSE_BTN3); | |
304 else | |
305 mplayer_put_key(MOUSE_BTN4); | |
306 } | |
307 } | |
308 break; | |
309 | |
12460 | 310 case kEventMouseDown: |
24958
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
311 case kEventMouseUp: |
12296 | 312 { |
12460 | 313 EventMouseButton button; |
13719 | 314 short part; |
15702 | 315 Rect bounds; |
316 | |
317 GetWindowPortBounds(theWindow, &bounds); | |
12460 | 318 GetEventParameter(event, kEventParamMouseButton, typeMouseButton, 0, sizeof(EventMouseButton), 0, &button); |
319 | |
13719 | 320 part = FindWindow(mousePos,&tmpWin); |
24958
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
321 if(kind == kEventMouseUp) |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
322 { |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
323 if (part != inContent) |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
324 break; |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
325 switch(button) |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
326 { |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
327 case kEventMouseButtonPrimary: |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
328 mplayer_put_key(MOUSE_BTN0); |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
329 break; |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
330 case kEventMouseButtonSecondary: |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
331 mplayer_put_key(MOUSE_BTN1); |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
332 break; |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
333 case kEventMouseButtonTertiary: |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
334 mplayer_put_key(MOUSE_BTN2); |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
335 break; |
12296 | 336 |
24958
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
337 default:result = eventNotHandledErr;break; |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
338 } |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
339 break; |
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
340 } |
15702 | 341 if( (winMousePos.h > (bounds.right - 15)) && (winMousePos.v > (bounds.bottom)) ) |
342 { | |
15723 | 343 if(!vo_quartz_fs) |
344 { | |
345 GrowWindow(theWindow, mousePos, NULL); | |
346 } | |
15702 | 347 } |
348 else if(part == inMenuBar) | |
12296 | 349 { |
350 MenuSelect(mousePos); | |
12460 | 351 HiliteMenu(0); |
12296 | 352 } |
12460 | 353 else if(part == inContent) |
354 { | |
355 switch(button) | |
356 { | |
24956
729f5c704763
Fix mouse right button and middle button incorrect identifications.
ulion
parents:
24955
diff
changeset
|
357 case kEventMouseButtonPrimary: |
24958
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
358 mplayer_put_key(MOUSE_BTN0 | MP_KEY_DOWN); |
24956
729f5c704763
Fix mouse right button and middle button incorrect identifications.
ulion
parents:
24955
diff
changeset
|
359 break; |
729f5c704763
Fix mouse right button and middle button incorrect identifications.
ulion
parents:
24955
diff
changeset
|
360 case kEventMouseButtonSecondary: |
24958
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
361 mplayer_put_key(MOUSE_BTN1 | MP_KEY_DOWN); |
24956
729f5c704763
Fix mouse right button and middle button incorrect identifications.
ulion
parents:
24955
diff
changeset
|
362 break; |
729f5c704763
Fix mouse right button and middle button incorrect identifications.
ulion
parents:
24955
diff
changeset
|
363 case kEventMouseButtonTertiary: |
24958
d86224fac2b5
Handle mouse up event to get double click support from mp_fifo.
ulion
parents:
24956
diff
changeset
|
364 mplayer_put_key(MOUSE_BTN2 | MP_KEY_DOWN); |
24956
729f5c704763
Fix mouse right button and middle button incorrect identifications.
ulion
parents:
24955
diff
changeset
|
365 break; |
12460 | 366 |
12624 | 367 default:result = eventNotHandledErr;break; |
12460 | 368 } |
369 } | |
370 } | |
371 break; | |
372 | |
15702 | 373 case kEventMouseDragged: |
374 break; | |
375 | |
12624 | 376 default:result = eventNotHandledErr;break; |
12460 | 377 } |
378 } | |
15702 | 379 |
12624 | 380 return result; |
12296 | 381 } |
12120 | 382 |
15702 | 383 //default window event handler |
384 static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) | |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
385 { |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
386 OSStatus result = noErr; |
13722 | 387 uint32_t d_width; |
388 uint32_t d_height; | |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
389 UInt32 class = GetEventClass (event); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
390 UInt32 kind = GetEventKind (event); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
391 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
392 result = CallNextEventHandler(nextHandler, event); |
13712
f6ef5a0ad7e4
removed duplicate case and fixed aspect ratio for window zoom feature
nplourde
parents:
13707
diff
changeset
|
393 |
f6ef5a0ad7e4
removed duplicate case and fixed aspect ratio for window zoom feature
nplourde
parents:
13707
diff
changeset
|
394 aspect(&d_width,&d_height,A_NOZOOM); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
395 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
396 if(class == kEventClassCommand) |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
397 { |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
398 HICommand theHICommand; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
399 GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand ); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
400 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
401 switch ( theHICommand.commandID ) |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
402 { |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
403 case kHICommandQuit: |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16280
diff
changeset
|
404 mplayer_put_key(KEY_CLOSE_WIN); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
405 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
406 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
407 case kHalfScreenCmd: |
13734 | 408 if(vo_quartz_fs) |
409 { | |
410 vo_fs = (!(vo_fs)); window_fullscreen(); | |
411 } | |
412 | |
15702 | 413 SizeWindow(theWindow, (d_width/2), ((d_width/movie_aspect)/2), 1); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
414 window_resized(); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
415 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
416 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
417 case kNormalScreenCmd: |
13734 | 418 if(vo_quartz_fs) |
419 { | |
420 vo_fs = (!(vo_fs)); window_fullscreen(); | |
421 } | |
422 | |
15702 | 423 SizeWindow(theWindow, d_width, (d_width/movie_aspect), 1); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
424 window_resized(); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
425 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
426 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
427 case kDoubleScreenCmd: |
13734 | 428 if(vo_quartz_fs) |
429 { | |
430 vo_fs = (!(vo_fs)); window_fullscreen(); | |
431 } | |
432 | |
15702 | 433 SizeWindow(theWindow, (d_width*2), ((d_width/movie_aspect)*2), 1); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
434 window_resized(); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
435 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
436 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
437 case kFullScreenCmd: |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
438 vo_fs = (!(vo_fs)); window_fullscreen(); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
439 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
440 |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
441 case kKeepAspectCmd: |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
442 vo_keepaspect = (!(vo_keepaspect)); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
443 CheckMenuItem (aspectMenu, 1, vo_keepaspect); |
15909 | 444 window_resized(); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
445 break; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
446 |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
447 case kAspectOrgCmd: |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
448 movie_aspect = old_movie_aspect; |
15902
16534910f0fb
fix various window resizing bug with menu option
nplourde
parents:
15892
diff
changeset
|
449 if(!vo_quartz_fs) |
16534910f0fb
fix various window resizing bug with menu option
nplourde
parents:
15892
diff
changeset
|
450 { |
16534910f0fb
fix various window resizing bug with menu option
nplourde
parents:
15892
diff
changeset
|
451 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect),1); |
16534910f0fb
fix various window resizing bug with menu option
nplourde
parents:
15892
diff
changeset
|
452 } |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
453 window_resized(); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
454 break; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
455 |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
456 case kAspectFullCmd: |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
457 movie_aspect = 4.0f/3.0f; |
15892 | 458 if(!vo_quartz_fs) |
459 { | |
460 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect),1); | |
461 } | |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
462 window_resized(); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
463 break; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
464 |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
465 case kAspectWideCmd: |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
466 movie_aspect = 16.0f/9.0f; |
15892 | 467 if(!vo_quartz_fs) |
468 { | |
469 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect),1); | |
470 } | |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
471 window_resized(); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
472 break; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
473 |
13795 | 474 case kPanScanCmd: |
13840 | 475 vo_panscan = (!(vo_panscan)); |
476 CheckMenuItem (aspectMenu, 2, vo_panscan); | |
15902
16534910f0fb
fix various window resizing bug with menu option
nplourde
parents:
15892
diff
changeset
|
477 window_panscan(); |
16534910f0fb
fix various window resizing bug with menu option
nplourde
parents:
15892
diff
changeset
|
478 window_resized(); |
13795 | 479 break; |
480 | |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
481 default: |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
482 result = eventNotHandledErr; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
483 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
484 } |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
485 } |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
486 else if(class == kEventClassWindow) |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
487 { |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
488 WindowRef window; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
489 Rect rectPort = {0,0,0,0}; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
490 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
491 GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
492 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
493 if(window) |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
494 { |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
495 GetPortBounds(GetWindowPort(window), &rectPort); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
496 } |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
497 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
498 switch (kind) |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
499 { |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
500 case kEventWindowClosed: |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
501 theWindow = NULL; |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16280
diff
changeset
|
502 mplayer_put_key(KEY_CLOSE_WIN); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
503 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
504 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
505 //resize window |
15702 | 506 case kEventWindowZoomed: |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
507 case kEventWindowBoundsChanged: |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
508 window_resized(); |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
509 flip_page(); |
15885
b2f434649dec
properly redraw fullscreen window with -fs and zoom
nplourde
parents:
15881
diff
changeset
|
510 window_resized(); |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
511 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
512 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
513 default: |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
514 result = eventNotHandledErr; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
515 break; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
516 } |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
517 } |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
518 |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
519 return result; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
520 } |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
521 |
12487 | 522 static void quartz_CreateWindow(uint32_t d_width, uint32_t d_height, WindowAttributes windowAttrs) |
523 { | |
524 CFStringRef titleKey; | |
525 CFStringRef windowTitle; | |
526 OSStatus result; | |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
527 |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
528 MenuItemIndex index; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
529 CFStringRef movMenuTitle; |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
530 CFStringRef aspMenuTitle; |
12487 | 531 |
24952 | 532 const EventTypeSpec win_events[] = { |
533 { kEventClassWindow, kEventWindowClosed }, | |
534 { kEventClassWindow, kEventWindowBoundsChanged }, | |
535 { kEventClassCommand, kEventCommandProcess } | |
536 }; | |
537 | |
538 const EventTypeSpec key_events[] = { | |
539 { kEventClassKeyboard, kEventRawKeyDown }, | |
540 { kEventClassKeyboard, kEventRawKeyRepeat } | |
541 }; | |
542 | |
543 const EventTypeSpec mouse_events[] = { | |
544 { kEventClassMouse, kEventMouseMoved }, | |
545 { kEventClassMouse, kEventMouseWheelMoved }, | |
546 { kEventClassMouse, kEventMouseDown }, | |
547 { kEventClassMouse, kEventMouseUp }, | |
548 { kEventClassMouse, kEventMouseDragged } | |
549 }; | |
550 | |
12487 | 551 SetRect(&winRect, 0, 0, d_width, d_height); |
552 SetRect(&oldWinRect, 0, 0, d_width, d_height); | |
553 SetRect(&dstRect, 0, 0, d_width, d_height); | |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
554 |
14081 | 555 //Clear Menu Bar |
556 ClearMenuBar(); | |
557 | |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
558 //Create Window Menu |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
559 CreateStandardWindowMenu(0, &windMenu); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
560 InsertMenu(windMenu, 0); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
561 |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
562 //Create Movie Menu |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
563 CreateNewMenu (1004, 0, &movMenu); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
564 movMenuTitle = CFSTR("Movie"); |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
565 SetMenuTitleWithCFString(movMenu, movMenuTitle); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
566 |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
567 AppendMenuItemTextWithCFString(movMenu, CFSTR("Half Size"), 0, kHalfScreenCmd, &index); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
568 SetMenuItemCommandKey(movMenu, index, 0, '0'); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
569 |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
570 AppendMenuItemTextWithCFString(movMenu, CFSTR("Normal Size"), 0, kNormalScreenCmd, &index); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
571 SetMenuItemCommandKey(movMenu, index, 0, '1'); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
572 |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
573 AppendMenuItemTextWithCFString(movMenu, CFSTR("Double Size"), 0, kDoubleScreenCmd, &index); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
574 SetMenuItemCommandKey(movMenu, index, 0, '2'); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
575 |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
576 AppendMenuItemTextWithCFString(movMenu, CFSTR("Full Size"), 0, kFullScreenCmd, &index); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
577 SetMenuItemCommandKey(movMenu, index, 0, 'F'); |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
578 |
24952 | 579 AppendMenuItemTextWithCFString(movMenu, NULL, kMenuItemAttrSeparator, 0, &index); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
580 |
24952 | 581 AppendMenuItemTextWithCFString(movMenu, CFSTR("Aspect Ratio"), 0, 0, &index); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
582 |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
583 ////Create Aspect Ratio Sub Menu |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
584 CreateNewMenu (0, 0, &aspectMenu); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
585 aspMenuTitle = CFSTR("Aspect Ratio"); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
586 SetMenuTitleWithCFString(aspectMenu, aspMenuTitle); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
587 SetMenuItemHierarchicalMenu(movMenu, 6, aspectMenu); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
588 |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
589 AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Keep"), 0, kKeepAspectCmd, &index); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
590 CheckMenuItem (aspectMenu, 1, vo_keepaspect); |
13795 | 591 AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Pan-Scan"), 0, kPanScanCmd, &index); |
13840 | 592 CheckMenuItem (aspectMenu, 2, vo_panscan); |
24952 | 593 AppendMenuItemTextWithCFString(aspectMenu, NULL, kMenuItemAttrSeparator, 0, &index); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
594 AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Original"), 0, kAspectOrgCmd, &index); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
595 AppendMenuItemTextWithCFString(aspectMenu, CFSTR("4:3"), 0, kAspectFullCmd, &index); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
596 AppendMenuItemTextWithCFString(aspectMenu, CFSTR("16:9"), 0, kAspectWideCmd, &index); |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
597 |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
598 InsertMenu(movMenu, GetMenuID(windMenu)); //insert before Window menu |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
599 |
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
600 DrawMenuBar(); |
12487 | 601 |
13693
abba514689a1
fix menu bar support and add new movie zoom option menu a la quicktime
nplourde
parents:
13124
diff
changeset
|
602 //create window |
12487 | 603 CreateNewWindow(kDocumentWindowClass, windowAttrs, &winRect, &theWindow); |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
604 |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
605 CreateWindowGroup(0, &winGroup); |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
606 SetWindowGroup(theWindow, winGroup); |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
607 |
12487 | 608 //Set window title |
12785
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
609 titleKey = CFSTR("MPlayer - The Movie Player"); |
12487 | 610 windowTitle = CFCopyLocalizedString(titleKey, NULL); |
611 result = SetWindowTitleWithCFString(theWindow, windowTitle); | |
612 CFRelease(titleKey); | |
613 CFRelease(windowTitle); | |
614 | |
615 //Install event handler | |
15702 | 616 InstallApplicationEventHandler (NewEventHandlerUPP (KeyEventHandler), GetEventTypeCount(key_events), key_events, NULL, NULL); |
617 InstallApplicationEventHandler (NewEventHandlerUPP (MouseEventHandler), GetEventTypeCount(mouse_events), mouse_events, NULL, NULL); | |
618 InstallWindowEventHandler (theWindow, NewEventHandlerUPP (WindowEventHandler), GetEventTypeCount(win_events), win_events, theWindow, NULL); | |
12487 | 619 } |
620 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15909
diff
changeset
|
621 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) |
12296 | 622 { |
623 WindowAttributes windowAttrs; | |
12414 | 624 OSErr qterr; |
13719 | 625 int i; |
15702 | 626 CGRect tmpBounds; |
13719 | 627 |
12296 | 628 //Get Main device info/////////////////////////////////////////////////// |
13719 | 629 |
630 | |
12296 | 631 deviceHdl = GetMainDevice(); |
632 | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
633 for(i=0; i<device_id; i++) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
634 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
635 deviceHdl = GetNextDevice(deviceHdl); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
636 |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
637 if(deviceHdl == NULL) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
638 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
639 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
|
640 deviceHdl = GetMainDevice(); |
14699
779230cb313d
set device id to 0 if the device selected on startup do not exist
nplourde
parents:
14082
diff
changeset
|
641 device_id = 0; |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
642 break; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
643 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
644 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
645 |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
646 deviceRect = (*deviceHdl)->gdRect; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
647 device_width = deviceRect.right-deviceRect.left; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
648 device_height = deviceRect.bottom-deviceRect.top; |
12296 | 649 |
13791 | 650 monitor_aspect = (float)device_width/(float)device_height; |
651 | |
12296 | 652 //misc mplayer setup///////////////////////////////////////////////////// |
12487 | 653 SetRect(&imgRect, 0, 0, width, height); |
12414 | 654 switch (image_format) |
655 { | |
656 case IMGFMT_RGB32: | |
12432 | 657 image_depth = 32; |
12414 | 658 break; |
659 case IMGFMT_YV12: | |
660 case IMGFMT_IYUV: | |
661 case IMGFMT_I420: | |
662 case IMGFMT_UYVY: | |
663 case IMGFMT_YUY2: | |
664 image_depth = 16; | |
665 break; | |
666 } | |
12487 | 667 image_size = ((imgRect.right*imgRect.bottom*image_depth)+7)/8; |
12296 | 668 |
669 vo_fs = flags & VOFLAG_FULLSCREEN; | |
670 | |
671 //get movie aspect | |
13795 | 672 panscan_init(); |
12296 | 673 aspect_save_orig(width,height); |
674 aspect_save_prescale(d_width,d_height); | |
675 aspect_save_screenres(device_width, device_height); | |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
676 |
12296 | 677 aspect(&d_width,&d_height,A_NOZOOM); |
13124 | 678 |
13793 | 679 movie_aspect = (float)d_width/(float)d_height; |
680 old_movie_aspect = movie_aspect; | |
681 | |
13124 | 682 if(image_data) |
683 free(image_data); | |
684 | |
685 image_data = malloc(image_size); | |
12296 | 686 |
687 //Create player window////////////////////////////////////////////////// | |
688 windowAttrs = kWindowStandardDocumentAttributes | |
689 | kWindowStandardHandlerAttribute | |
690 | kWindowLiveResizeAttribute; | |
12425 | 691 |
15702 | 692 windowAttrs &= (~kWindowResizableAttribute); |
693 | |
12487 | 694 if (theWindow == NULL) |
695 { | |
15702 | 696 quartz_CreateWindow(d_width, d_height, windowAttrs); |
12487 | 697 |
698 if (theWindow == NULL) | |
699 { | |
700 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Couldn't create window !!!!!\n"); | |
701 return -1; | |
702 } | |
15702 | 703 tmpBounds = CGRectMake( 0, 0, winRect.right, winRect.bottom); |
704 CreateCGContextForPort(GetWindowPort(theWindow),&context); | |
705 CGContextFillRect(context, tmpBounds); | |
12487 | 706 } |
707 else | |
708 { | |
709 HideWindow(theWindow); | |
710 ChangeWindowAttributes(theWindow, ~windowAttrs, windowAttrs); | |
711 SetRect(&winRect, 0, 0, d_width, d_height); | |
712 SetRect(&oldWinRect, 0, 0, d_width, d_height); | |
713 SizeWindow (theWindow, d_width, d_height, 1); | |
714 } | |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
715 |
12432 | 716 switch (image_format) |
717 { | |
13124 | 718 case IMGFMT_RGB32: |
719 { | |
720 CreateCGContextForPort (GetWindowPort (theWindow), &context); | |
721 | |
722 dataProviderRef = CGDataProviderCreateWithData (0, image_data, imgRect.right * imgRect.bottom * 4, 0); | |
723 | |
724 image = CGImageCreate (imgRect.right, | |
725 imgRect.bottom, | |
726 8, | |
727 image_depth, | |
728 ((imgRect.right*32)+7)/8, | |
729 CGColorSpaceCreateDeviceRGB(), | |
730 kCGImageAlphaNoneSkipFirst, | |
731 dataProviderRef, 0, 1, kCGRenderingIntentDefault); | |
732 break; | |
733 } | |
734 | |
12432 | 735 case IMGFMT_YV12: |
736 case IMGFMT_IYUV: | |
737 case IMGFMT_I420: | |
738 case IMGFMT_UYVY: | |
739 case IMGFMT_YUY2: | |
12424 | 740 { |
12623 | 741 get_image_done = 0; |
742 | |
743 if (!EnterMoviesDone) | |
744 { | |
745 qterr = EnterMovies(); | |
746 EnterMoviesDone = 1; | |
747 } | |
748 else | |
749 qterr = 0; | |
750 | |
751 if (qterr) | |
752 { | |
753 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: EnterMovies (%d)\n", qterr); | |
754 return -1; | |
755 } | |
756 | |
757 | |
758 SetIdentityMatrix(&matrix); | |
759 | |
760 if ((d_width != width) || (d_height != height)) | |
761 { | |
762 ScaleMatrix(&matrix, FixDiv(Long2Fix(d_width),Long2Fix(width)), FixDiv(Long2Fix(d_height),Long2Fix(height)), 0, 0); | |
763 } | |
764 | |
12432 | 765 yuv_qt_stuff.desc = (ImageDescriptionHandle)NewHandleClear( sizeof(ImageDescription) ); |
12424 | 766 |
12432 | 767 yuv_qt_stuff.extension_colr = NewHandleClear(sizeof(NCLCColorInfoImageDescriptionExtension)); |
768 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->colorParamType = kVideoColorInfoImageDescriptionExtensionType; | |
769 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->primaries = 2; | |
770 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->transferFunction = 2; | |
771 ((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->matrix = 2; | |
772 | |
773 yuv_qt_stuff.extension_fiel = NewHandleClear(sizeof(FieldInfoImageDescriptionExtension)); | |
774 ((FieldInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_fiel))->fieldCount = 1; | |
775 ((FieldInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_fiel))->fieldOrderings = 0; | |
12424 | 776 |
12432 | 777 yuv_qt_stuff.extension_clap = NewHandleClear(sizeof(CleanApertureImageDescriptionExtension)); |
12487 | 778 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureWidthN = imgRect.right; |
12432 | 779 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureWidthD = 1; |
12487 | 780 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureHeightN = imgRect.bottom; |
12432 | 781 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->cleanApertureHeightD = 1; |
782 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->horizOffN = 0; | |
783 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->horizOffD = 1; | |
784 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->vertOffN = 0; | |
785 ((CleanApertureImageDescriptionExtension*)(*yuv_qt_stuff.extension_clap))->vertOffD = 1; | |
786 | |
787 yuv_qt_stuff.extension_pasp = NewHandleClear(sizeof(PixelAspectRatioImageDescriptionExtension)); | |
788 ((PixelAspectRatioImageDescriptionExtension*)(*yuv_qt_stuff.extension_pasp))->hSpacing = 1; | |
789 ((PixelAspectRatioImageDescriptionExtension*)(*yuv_qt_stuff.extension_pasp))->vSpacing = 1; | |
790 | |
791 (*yuv_qt_stuff.desc)->idSize = sizeof(ImageDescription); | |
792 (*yuv_qt_stuff.desc)->cType = image_qtcodec; | |
793 (*yuv_qt_stuff.desc)->version = 2; | |
794 (*yuv_qt_stuff.desc)->revisionLevel = 0; | |
795 (*yuv_qt_stuff.desc)->vendor = 'mpla'; | |
12487 | 796 (*yuv_qt_stuff.desc)->width = imgRect.right; |
797 (*yuv_qt_stuff.desc)->height = imgRect.bottom; | |
12432 | 798 (*yuv_qt_stuff.desc)->hRes = Long2Fix(72); |
799 (*yuv_qt_stuff.desc)->vRes = Long2Fix(72); | |
800 (*yuv_qt_stuff.desc)->temporalQuality = 0; | |
801 (*yuv_qt_stuff.desc)->spatialQuality = codecLosslessQuality; | |
802 (*yuv_qt_stuff.desc)->frameCount = 1; | |
803 (*yuv_qt_stuff.desc)->dataSize = 0; | |
804 (*yuv_qt_stuff.desc)->depth = 24; | |
805 (*yuv_qt_stuff.desc)->clutID = -1; | |
12424 | 806 |
12432 | 807 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_colr, kColorInfoImageDescriptionExtension); |
808 if (qterr) | |
809 { | |
12487 | 810 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [colr] (%d)\n", qterr); |
12432 | 811 } |
812 | |
813 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_fiel, kFieldInfoImageDescriptionExtension); | |
814 if (qterr) | |
815 { | |
12487 | 816 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [fiel] (%d)\n", qterr); |
12432 | 817 } |
818 | |
819 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_clap, kCleanApertureImageDescriptionExtension); | |
820 if (qterr) | |
821 { | |
12487 | 822 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [clap] (%d)\n", qterr); |
12432 | 823 } |
824 | |
825 qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_pasp, kCleanApertureImageDescriptionExtension); | |
826 if (qterr) | |
827 { | |
12487 | 828 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [pasp] (%d)\n", qterr); |
12432 | 829 } |
12487 | 830 if (P != NULL) { // second or subsequent movie |
831 free(P); | |
832 } | |
12432 | 833 P = calloc(sizeof(PlanarPixmapInfoYUV420) + image_size, 1); |
834 switch (image_format) | |
835 { | |
836 case IMGFMT_YV12: | |
837 case IMGFMT_IYUV: | |
838 case IMGFMT_I420: | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
839 P->componentInfoY.offset = be2me_32(sizeof(PlanarPixmapInfoYUV420)); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
840 P->componentInfoCb.offset = be2me_32(be2me_32(P->componentInfoY.offset) + image_size / 2); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
841 P->componentInfoCr.offset = be2me_32(be2me_32(P->componentInfoCb.offset) + image_size / 4); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
842 P->componentInfoY.rowBytes = be2me_32(imgRect.right); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
843 P->componentInfoCb.rowBytes = be2me_32(imgRect.right / 2); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
844 P->componentInfoCr.rowBytes = be2me_32(imgRect.right / 2); |
12432 | 845 image_buffer_size = image_size + sizeof(PlanarPixmapInfoYUV420); |
846 break; | |
847 case IMGFMT_UYVY: | |
848 case IMGFMT_YUY2: | |
849 image_buffer_size = image_size; | |
850 break; | |
851 } | |
12414 | 852 |
12432 | 853 qterr = DecompressSequenceBeginS(&seqId, |
12414 | 854 yuv_qt_stuff.desc, |
12432 | 855 (char *)P, |
12414 | 856 image_buffer_size, |
12623 | 857 GetWindowPort(theWindow), |
12432 | 858 NULL, |
859 NULL, | |
12414 | 860 ((d_width != width) || (d_height != height)) ? |
12432 | 861 &matrix : NULL, |
12414 | 862 srcCopy, |
12432 | 863 NULL, |
864 0, | |
12414 | 865 codecLosslessQuality, |
866 bestSpeedCodec); | |
12432 | 867 |
868 if (qterr) | |
869 { | |
870 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: DecompressSequenceBeginS (%d)\n", qterr); | |
12487 | 871 return -1; |
12432 | 872 } |
12424 | 873 } |
12432 | 874 break; |
12414 | 875 } |
12296 | 876 |
15885
b2f434649dec
properly redraw fullscreen window with -fs and zoom
nplourde
parents:
15881
diff
changeset
|
877 //Show window |
b2f434649dec
properly redraw fullscreen window with -fs and zoom
nplourde
parents:
15881
diff
changeset
|
878 RepositionWindow(theWindow, NULL, kWindowCenterOnMainScreen); |
b2f434649dec
properly redraw fullscreen window with -fs and zoom
nplourde
parents:
15881
diff
changeset
|
879 ShowWindow (theWindow); |
b2f434649dec
properly redraw fullscreen window with -fs and zoom
nplourde
parents:
15881
diff
changeset
|
880 |
12296 | 881 if(vo_fs) |
882 window_fullscreen(); | |
883 | |
884 if(vo_ontop) | |
885 window_ontop(); | |
12888 | 886 |
12912
1f6bb2356d18
add var vo_rootwin and -rootwin switch for mac osx
nplourde
parents:
12889
diff
changeset
|
887 if(vo_rootwin) |
12888 | 888 { |
889 vo_fs = TRUE; | |
890 winLevel = 0; | |
891 SetWindowGroupLevel(winGroup, CGWindowLevelForKey(levelList[winLevel])); | |
892 window_fullscreen(); | |
893 } | |
12296 | 894 |
15885
b2f434649dec
properly redraw fullscreen window with -fs and zoom
nplourde
parents:
15881
diff
changeset
|
895 window_resized(); |
15702 | 896 |
12296 | 897 return 0; |
12120 | 898 } |
899 | |
12296 | 900 static void check_events(void) |
12120 | 901 { |
12296 | 902 EventRef theEvent; |
903 EventTargetRef theTarget; | |
904 OSStatus theErr; | |
905 | |
906 //Get event | |
907 theTarget = GetEventDispatcherTarget(); | |
908 theErr = ReceiveNextEvent(0, 0, kEventDurationNoWait,true, &theEvent); | |
909 if(theErr == noErr && theEvent != NULL) | |
910 { | |
911 SendEventToEventTarget (theEvent, theTarget); | |
912 ReleaseEvent(theEvent); | |
913 } | |
914 } | |
12120 | 915 |
12296 | 916 static void draw_osd(void) |
917 { | |
12487 | 918 vo_draw_text(imgRect.right,imgRect.bottom,draw_alpha); |
12296 | 919 } |
12120 | 920 |
12296 | 921 static void flip_page(void) |
922 { | |
21396 | 923 int curTime; |
24954
a4cf3ff9b70e
Fix the prevent system idle code. Original code also works, but not as expected.
ulion
parents:
24952
diff
changeset
|
924 static int lastTime = 0; |
21396 | 925 |
13707
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
926 if(theWindow == NULL) |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
927 return; |
3fff37ed4fe7
Fixed event handling for menubar and window close button.
nplourde
parents:
13693
diff
changeset
|
928 |
12432 | 929 switch (image_format) |
930 { | |
13124 | 931 case IMGFMT_RGB32: |
932 { | |
933 CGContextDrawImage (context, bounds, image); | |
934 } | |
935 break; | |
936 | |
12433 | 937 case IMGFMT_YV12: |
938 case IMGFMT_IYUV: | |
939 case IMGFMT_I420: | |
940 case IMGFMT_UYVY: | |
941 case IMGFMT_YUY2: | |
942 if (EnterMoviesDone) | |
943 { | |
944 OSErr qterr; | |
945 CodecFlags flags = 0; | |
946 qterr = DecompressSequenceFrameWhen(seqId, | |
947 (char *)P, | |
948 image_buffer_size, | |
949 0, //codecFlagUseImageBuffer, | |
950 &flags, | |
951 NULL, | |
952 NULL); | |
953 if (qterr) | |
954 { | |
12487 | 955 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: DecompressSequenceFrameWhen in flip_page (%d) flags:0x%08x\n", qterr, flags); |
12433 | 956 } |
957 } | |
958 break; | |
959 } | |
15723 | 960 |
961 if(!vo_quartz_fs) | |
962 { | |
963 //render resize box | |
964 CGContextBeginPath(context); | |
965 CGContextSetAllowsAntialiasing(context, false); | |
966 //CGContextSaveGState(context); | |
967 | |
968 //line white | |
969 CGContextSetRGBStrokeColor (context, 0.2, 0.2, 0.2, 0.5); | |
970 CGContextMoveToPoint( context, winRect.right-1, 1); CGContextAddLineToPoint( context, winRect.right-1, 1); | |
971 CGContextMoveToPoint( context, winRect.right-1, 5); CGContextAddLineToPoint( context, winRect.right-5, 1); | |
972 CGContextMoveToPoint( context, winRect.right-1, 9); CGContextAddLineToPoint( context, winRect.right-9, 1); | |
973 CGContextStrokePath( context ); | |
974 | |
975 //line gray | |
976 CGContextSetRGBStrokeColor (context, 0.4, 0.4, 0.4, 0.5); | |
977 CGContextMoveToPoint( context, winRect.right-1, 2); CGContextAddLineToPoint( context, winRect.right-2, 1); | |
978 CGContextMoveToPoint( context, winRect.right-1, 6); CGContextAddLineToPoint( context, winRect.right-6, 1); | |
979 CGContextMoveToPoint( context, winRect.right-1, 10); CGContextAddLineToPoint( context, winRect.right-10, 1); | |
980 CGContextStrokePath( context ); | |
981 | |
982 //line black | |
983 CGContextSetRGBStrokeColor (context, 0.6, 0.6, 0.6, 0.5); | |
984 CGContextMoveToPoint( context, winRect.right-1, 3); CGContextAddLineToPoint( context, winRect.right-3, 1); | |
985 CGContextMoveToPoint( context, winRect.right-1, 7); CGContextAddLineToPoint( context, winRect.right-7, 1); | |
986 CGContextMoveToPoint( context, winRect.right-1, 11); CGContextAddLineToPoint( context, winRect.right-11, 1); | |
987 CGContextStrokePath( context ); | |
988 | |
989 //CGContextRestoreGState( context ); | |
990 CGContextFlush (context); | |
991 } | |
15881 | 992 |
993 //auto hide mouse cursor and futur on-screen control? | |
994 if(vo_quartz_fs && !mouseHide) | |
995 { | |
18057 | 996 int curTime = TickCount()/60; |
997 static int lastTime = 0; | |
15881 | 998 |
999 if( ((curTime - lastTime) >= 5) || (lastTime == 0) ) | |
1000 { | |
18057 | 1001 CGDisplayHideCursor(kCGDirectMainDisplay); |
15881 | 1002 mouseHide = TRUE; |
1003 lastTime = curTime; | |
1004 } | |
1005 } | |
17546 | 1006 |
1007 //update activity every 30 seconds to prevent | |
1008 //screensaver from starting up. | |
21396 | 1009 curTime = TickCount()/60; |
18057 | 1010 |
24954
a4cf3ff9b70e
Fix the prevent system idle code. Original code also works, but not as expected.
ulion
parents:
24952
diff
changeset
|
1011 if( ((curTime - lastTime) >= 30) || (lastTime == 0) ) |
17546 | 1012 { |
1013 UpdateSystemActivity(UsrActivity); | |
1014 lastTime = curTime; | |
1015 } | |
12296 | 1016 } |
1017 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15909
diff
changeset
|
1018 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) |
12296 | 1019 { |
12433 | 1020 switch (image_format) |
1021 { | |
12487 | 1022 case IMGFMT_YV12: |
1023 case IMGFMT_I420: | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1024 memcpy_pic(((char*)P) + be2me_32(P->componentInfoY.offset) + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); |
12487 | 1025 x=x/2;y=y/2;w=w/2;h=h/2; |
1026 | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1027 memcpy_pic(((char*)P) + be2me_32(P->componentInfoCb.offset) + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1028 memcpy_pic(((char*)P) + be2me_32(P->componentInfoCr.offset) + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); |
12487 | 1029 return 0; |
1030 | |
1031 case IMGFMT_IYUV: | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1032 memcpy_pic(((char*)P) + be2me_32(P->componentInfoY.offset) + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); |
12487 | 1033 x=x/2;y=y/2;w=w/2;h=h/2; |
1034 | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1035 memcpy_pic(((char*)P) + be2me_32(P->componentInfoCr.offset) + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1036 memcpy_pic(((char*)P) + be2me_32(P->componentInfoCb.offset) + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); |
12487 | 1037 return 0; |
12433 | 1038 } |
12296 | 1039 return -1; |
1040 } | |
1041 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15909
diff
changeset
|
1042 static int draw_frame(uint8_t *src[]) |
12296 | 1043 { |
12433 | 1044 switch (image_format) |
1045 { | |
13124 | 1046 case IMGFMT_RGB32: |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
23381
diff
changeset
|
1047 fast_memcpy(image_data,src[0],image_size); |
13124 | 1048 return 0; |
1049 | |
12433 | 1050 case IMGFMT_UYVY: |
1051 case IMGFMT_YUY2: | |
12487 | 1052 memcpy_pic(((char*)P), src[0], imgRect.right * 2, imgRect.bottom, imgRect.right * 2, imgRect.right * 2); |
12433 | 1053 return 0; |
1054 } | |
1055 return -1; | |
12296 | 1056 } |
12120 | 1057 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15909
diff
changeset
|
1058 static int query_format(uint32_t format) |
12296 | 1059 { |
1060 image_format = format; | |
12432 | 1061 image_qtcodec = 0; |
13124 | 1062 |
1063 if (format == IMGFMT_RGB32) | |
1064 { | |
1065 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; | |
1066 } | |
12432 | 1067 |
12424 | 1068 if ((format == IMGFMT_YV12) || (format == IMGFMT_IYUV) || (format == IMGFMT_I420)) |
1069 { | |
1070 image_qtcodec = kMpegYUV420CodecType; //kYUV420CodecType ?; | |
12487 | 1071 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; |
12414 | 1072 } |
1073 | |
12424 | 1074 if (format == IMGFMT_YUY2) |
1075 { | |
1076 image_qtcodec = kComponentVideoUnsigned; | |
12487 | 1077 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
12414 | 1078 } |
1079 | |
12424 | 1080 if (format == IMGFMT_UYVY) |
1081 { | |
1082 image_qtcodec = k422YpCbCr8CodecType; | |
12487 | 1083 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
12424 | 1084 } |
12414 | 1085 |
12296 | 1086 return 0; |
1087 } | |
12120 | 1088 |
12296 | 1089 static void uninit(void) |
1090 { | |
12432 | 1091 OSErr qterr; |
13124 | 1092 |
1093 switch (image_format) | |
12432 | 1094 { |
13124 | 1095 case IMGFMT_YV12: |
1096 case IMGFMT_IYUV: | |
1097 case IMGFMT_I420: | |
1098 case IMGFMT_UYVY: | |
1099 case IMGFMT_YUY2: | |
12432 | 1100 { |
13124 | 1101 if (EnterMoviesDone) |
1102 { | |
1103 qterr = CDSequenceEnd(seqId); | |
1104 if (qterr) | |
1105 { | |
1106 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: CDSequenceEnd (%d)\n", qterr); | |
1107 } | |
1108 } | |
1109 break; | |
12424 | 1110 } |
13124 | 1111 default: |
1112 break; | |
12414 | 1113 } |
12432 | 1114 |
12296 | 1115 ShowMenuBar(); |
1116 } | |
12120 | 1117 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15909
diff
changeset
|
1118 static int preinit(const char *arg) |
12296 | 1119 { |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1120 int parse_err = 0; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1121 |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1122 if(arg) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1123 { |
12623 | 1124 char *parse_pos = (char *)&arg[0]; |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1125 while (parse_pos[0] && !parse_err) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1126 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1127 if (strncmp (parse_pos, "device_id=", 10) == 0) |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1128 { |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1129 parse_pos = &parse_pos[10]; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1130 device_id = strtol(parse_pos, &parse_pos, 0); |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1131 } |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1132 if (strncmp (parse_pos, "fs_res=", 7) == 0) |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1133 { |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1134 parse_pos = &parse_pos[7]; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1135 fs_res_x = strtol(parse_pos, &parse_pos, 0); |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1136 parse_pos = &parse_pos[1]; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1137 fs_res_y = strtol(parse_pos, &parse_pos, 0); |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1138 } |
12519
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1139 if (parse_pos[0] == ':') parse_pos = &parse_pos[1]; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1140 else if (parse_pos[0]) parse_err = 1; |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1141 } |
12a87d539f6d
choose fullscreen device with suboption device_id=#
nplourde
parents:
12517
diff
changeset
|
1142 } |
12785
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1143 |
14082 | 1144 #if !defined (MACOSX_FINDER_SUPPORT) || !defined (HAVE_SDL) |
12785
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1145 //this chunk of code is heavily based off SDL_macosx.m from SDL |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1146 //it uses an Apple private function to request foreground operation |
24952 | 1147 { |
12785
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1148 void CPSEnableForegroundOperation(ProcessSerialNumber* psn); |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1149 ProcessSerialNumber myProc, frProc; |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1150 Boolean sameProc; |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1151 |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1152 if (GetFrontProcess(&frProc) == noErr) |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1153 { |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1154 if (GetCurrentProcess(&myProc) == noErr) |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1155 { |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1156 if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc) |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1157 { |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1158 CPSEnableForegroundOperation(&myProc); |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1159 } |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1160 SetFrontProcess(&myProc); |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1161 } |
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1162 } |
24952 | 1163 } |
13909
07dadc3066f3
add support for macosx finder argument support (let you bundle mplayer to be a finder compliant .app) patch by Chris Roccati <roccati@pobox.com>
nplourde
parents:
13856
diff
changeset
|
1164 #endif |
12785
33f58bfc8a1b
make mplayer capable of being in the foreground by Dan Christiansen
nplourde
parents:
12624
diff
changeset
|
1165 |
12296 | 1166 return 0; |
12120 | 1167 } |
1168 | |
12424 | 1169 static uint32_t draw_yuv_image(mp_image_t *mpi) |
1170 { | |
1171 // ATM we're only called for planar IMGFMT | |
1172 // drawing is done directly in P | |
1173 // and displaying is in flip_page. | |
12487 | 1174 return get_image_done ? VO_TRUE : VO_FALSE; |
12414 | 1175 } |
1176 | |
12424 | 1177 static uint32_t get_yuv_image(mp_image_t *mpi) |
1178 { | |
1179 if(mpi->type!=MP_IMGTYPE_EXPORT) return VO_FALSE; | |
12414 | 1180 |
12424 | 1181 if(mpi->imgfmt!=image_format) return VO_FALSE; |
12414 | 1182 |
12424 | 1183 if(mpi->flags&MP_IMGFLAG_PLANAR) |
1184 { | |
1185 if (mpi->num_planes != 3) | |
1186 { | |
1187 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: only 3 planes allowed in get_yuv_image for planar (%d) \n", mpi->num_planes); | |
1188 return VO_FALSE; | |
1189 } | |
12414 | 1190 |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1191 mpi->planes[0]=((char*)P) + be2me_32(P->componentInfoY.offset); |
12487 | 1192 mpi->stride[0]=imgRect.right; |
1193 mpi->width=imgRect.right; | |
12414 | 1194 |
12424 | 1195 if(mpi->flags&MP_IMGFLAG_SWAPPED) |
1196 { | |
1197 // I420 | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1198 mpi->planes[1]=((char*)P) + be2me_32(P->componentInfoCb.offset); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1199 mpi->planes[2]=((char*)P) + be2me_32(P->componentInfoCr.offset); |
12487 | 1200 mpi->stride[1]=imgRect.right/2; |
1201 mpi->stride[2]=imgRect.right/2; | |
12424 | 1202 } |
1203 else | |
1204 { | |
1205 // YV12 | |
23676
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1206 mpi->planes[1]=((char*)P) + be2me_32(P->componentInfoCr.offset); |
f3cb35ec74c3
bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
nplourde
parents:
23457
diff
changeset
|
1207 mpi->planes[2]=((char*)P) + be2me_32(P->componentInfoCb.offset); |
12487 | 1208 mpi->stride[1]=imgRect.right/2; |
1209 mpi->stride[2]=imgRect.right/2; | |
12424 | 1210 } |
1211 | |
1212 mpi->flags|=MP_IMGFLAG_DIRECT; | |
12487 | 1213 get_image_done = 1; |
12424 | 1214 return VO_TRUE; |
1215 } | |
1216 else | |
12433 | 1217 { |
1218 // doesn't work yet | |
12424 | 1219 if (mpi->num_planes != 1) |
1220 { | |
1221 mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: only 1 plane allowed in get_yuv_image for packed (%d) \n", mpi->num_planes); | |
1222 return VO_FALSE; | |
1223 } | |
12414 | 1224 |
12424 | 1225 mpi->planes[0] = (char*)P; |
12487 | 1226 mpi->stride[0] = imgRect.right * 2; |
1227 mpi->width=imgRect.right; | |
12424 | 1228 mpi->flags|=MP_IMGFLAG_DIRECT; |
12487 | 1229 get_image_done = 1; |
12424 | 1230 return VO_TRUE; |
1231 } | |
1232 return VO_FALSE; | |
12414 | 1233 } |
1234 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15909
diff
changeset
|
1235 static int control(uint32_t request, void *data, ...) |
12120 | 1236 { |
12424 | 1237 switch (request) |
1238 { | |
1239 case VOCTRL_PAUSE: return (int_pause=1); | |
1240 case VOCTRL_RESUME: return (int_pause=0); | |
12460 | 1241 case VOCTRL_FULLSCREEN: vo_fs = (!(vo_fs)); window_fullscreen(); return VO_TRUE; |
1242 case VOCTRL_ONTOP: vo_ontop = (!(vo_ontop)); window_ontop(); return VO_TRUE; | |
12424 | 1243 case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); |
13795 | 1244 case VOCTRL_GET_PANSCAN: return VO_TRUE; |
13840 | 1245 case VOCTRL_SET_PANSCAN: window_panscan(); return VO_TRUE; |
13795 | 1246 |
12424 | 1247 case VOCTRL_GET_IMAGE: |
1248 switch (image_format) | |
1249 { | |
1250 case IMGFMT_YV12: | |
1251 case IMGFMT_IYUV: | |
1252 case IMGFMT_I420: | |
12487 | 1253 case IMGFMT_UYVY: |
1254 case IMGFMT_YUY2: | |
12424 | 1255 return get_yuv_image(data); |
1256 break; | |
12487 | 1257 default: |
1258 break; | |
12424 | 1259 } |
1260 case VOCTRL_DRAW_IMAGE: | |
1261 switch (image_format) | |
1262 { | |
1263 case IMGFMT_YV12: | |
1264 case IMGFMT_IYUV: | |
1265 case IMGFMT_I420: | |
12487 | 1266 case IMGFMT_UYVY: |
1267 case IMGFMT_YUY2: | |
12424 | 1268 return draw_yuv_image(data); |
1269 break; | |
12487 | 1270 default: |
1271 break; | |
12424 | 1272 } |
1273 } | |
1274 return VO_NOTIMPL; | |
12120 | 1275 } |
1276 | |
12296 | 1277 void window_resized() |
12120 | 1278 { |
12296 | 1279 float aspectX; |
1280 float aspectY; | |
1281 | |
13855 | 1282 int padding = 0; |
12296 | 1283 |
1284 uint32_t d_width; | |
1285 uint32_t d_height; | |
1286 | |
13779 | 1287 CGRect tmpBounds; |
13734 | 1288 |
12623 | 1289 GetPortBounds( GetWindowPort(theWindow), &winRect ); |
12120 | 1290 |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1291 if(vo_keepaspect) |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1292 { |
12296 | 1293 aspect( &d_width, &d_height, A_NOZOOM); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1294 d_height = ((float)d_width/movie_aspect); |
12296 | 1295 |
1296 aspectX = (float)((float)winRect.right/(float)d_width); | |
15702 | 1297 aspectY = (float)((float)(winRect.bottom)/(float)d_height); |
12296 | 1298 |
15702 | 1299 if((d_height*aspectX)>(winRect.bottom)) |
12296 | 1300 { |
1301 padding = (winRect.right - d_width*aspectY)/2; | |
1302 SetRect(&dstRect, padding, 0, d_width*aspectY+padding, d_height*aspectY); | |
1303 } | |
1304 else | |
1305 { | |
15702 | 1306 padding = ((winRect.bottom) - d_height*aspectX)/2; |
12296 | 1307 SetRect(&dstRect, 0, padding, (d_width*aspectX), d_height*aspectX+padding); |
1308 } | |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1309 } |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1310 else |
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1311 { |
15702 | 1312 SetRect(&dstRect, 0, 0, winRect.right, winRect.bottom); |
13792
d603c33bb3d3
menu option to set desired movie aspect & keep aspect on window resize
nplourde
parents:
13791
diff
changeset
|
1313 } |
13124 | 1314 |
1315 switch (image_format) | |
12432 | 1316 { |
13124 | 1317 case IMGFMT_RGB32: |
1318 { | |
15702 | 1319 bounds = CGRectMake(dstRect.left, dstRect.top, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top); |
13124 | 1320 CreateCGContextForPort (GetWindowPort (theWindow), &context); |
1321 break; | |
1322 } | |
1323 case IMGFMT_YV12: | |
1324 case IMGFMT_IYUV: | |
1325 case IMGFMT_I420: | |
1326 case IMGFMT_UYVY: | |
1327 case IMGFMT_YUY2: | |
12432 | 1328 { |
13124 | 1329 long scale_X = FixDiv(Long2Fix(dstRect.right - dstRect.left),Long2Fix(imgRect.right)); |
1330 long scale_Y = FixDiv(Long2Fix(dstRect.bottom - dstRect.top),Long2Fix(imgRect.bottom)); | |
1331 | |
1332 SetIdentityMatrix(&matrix); | |
1333 if (((dstRect.right - dstRect.left) != imgRect.right) || ((dstRect.bottom - dstRect.right) != imgRect.bottom)) | |
1334 { | |
1335 ScaleMatrix(&matrix, scale_X, scale_Y, 0, 0); | |
1336 | |
1337 if (padding > 0) | |
1338 { | |
1339 TranslateMatrix(&matrix, Long2Fix(dstRect.left), Long2Fix(dstRect.top)); | |
1340 } | |
1341 } | |
1342 | |
1343 SetDSequenceMatrix(seqId, &matrix); | |
1344 break; | |
12432 | 1345 } |
13124 | 1346 default: |
1347 break; | |
12432 | 1348 } |
15702 | 1349 |
1350 //Clear Background | |
1351 tmpBounds = CGRectMake( 0, 0, winRect.right, winRect.bottom); | |
1352 CreateCGContextForPort(GetWindowPort(theWindow),&context); | |
1353 CGContextFillRect(context, tmpBounds); | |
12120 | 1354 } |
1355 | |
12296 | 1356 void window_ontop() |
12460 | 1357 { |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1358 if(!vo_quartz_fs) |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1359 { |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1360 //Cycle between level |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1361 winLevel++; |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1362 if(winLevel>2) |
15524 | 1363 winLevel = 1; |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1364 } |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1365 SetWindowGroupLevel(winGroup, CGWindowLevelForKey(levelList[winLevel])); |
12120 | 1366 } |
1367 | |
12296 | 1368 void window_fullscreen() |
12120 | 1369 { |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1370 static Ptr restoreState = NULL; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1371 |
12296 | 1372 //go fullscreen |
12432 | 1373 if(vo_fs) |
12296 | 1374 { |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1375 if(winLevel != 0) |
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1376 { |
13841
394deaee5d21
do not hide mouse and menubar in fulscreen if not using main device
nplourde
parents:
13840
diff
changeset
|
1377 if(device_id == 0) |
394deaee5d21
do not hide mouse and menubar in fulscreen if not using main device
nplourde
parents:
13840
diff
changeset
|
1378 { |
15881 | 1379 SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); |
18057 | 1380 CGDisplayHideCursor(kCGDirectMainDisplay); |
15892 | 1381 mouseHide = TRUE; |
13841
394deaee5d21
do not hide mouse and menubar in fulscreen if not using main device
nplourde
parents:
13840
diff
changeset
|
1382 } |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1383 |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1384 if(fs_res_x != 0 || fs_res_y != 0) |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1385 { |
24952 | 1386 BeginFullScreen( &restoreState, deviceHdl, &fs_res_x, &fs_res_y, NULL, NULL, 0); |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1387 |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1388 //Get Main device info/////////////////////////////////////////////////// |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1389 deviceRect = (*deviceHdl)->gdRect; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1390 |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1391 device_width = deviceRect.right; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1392 device_height = deviceRect.bottom; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1393 } |
12826
fb55f94f3001
Add Window Level Key, Can switch mode with T key
nplourde
parents:
12785
diff
changeset
|
1394 } |
12120 | 1395 |
12296 | 1396 //save old window size |
12487 | 1397 if (!vo_quartz_fs) |
13818
9f707a805967
window now save is old position when going in fullscreen or while using resize preset
nplourde
parents:
13796
diff
changeset
|
1398 { |
12487 | 1399 GetWindowPortBounds(theWindow, &oldWinRect); |
13818
9f707a805967
window now save is old position when going in fullscreen or while using resize preset
nplourde
parents:
13796
diff
changeset
|
1400 GetWindowBounds(theWindow, kWindowContentRgn, &oldWinBounds); |
9f707a805967
window now save is old position when going in fullscreen or while using resize preset
nplourde
parents:
13796
diff
changeset
|
1401 } |
12296 | 1402 |
1403 //go fullscreen | |
13840 | 1404 panscan_calc(); |
15702 | 1405 ChangeWindowAttributes(theWindow, kWindowNoShadowAttribute, 0); |
13840 | 1406 MoveWindow(theWindow, deviceRect.left-(vo_panscan_x >> 1), deviceRect.top-(vo_panscan_y >> 1), 1); |
1407 SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1); | |
12487 | 1408 |
1409 vo_quartz_fs = 1; | |
12296 | 1410 } |
1411 else //go back to windowed mode | |
1412 { | |
15892 | 1413 vo_quartz_fs = 0; |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1414 if(restoreState != NULL) |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1415 { |
24952 | 1416 EndFullScreen(restoreState, 0); |
13788
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1417 |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1418 //Get Main device info/////////////////////////////////////////////////// |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1419 deviceRect = (*deviceHdl)->gdRect; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1420 |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1421 device_width = deviceRect.right; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1422 device_height = deviceRect.bottom; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1423 restoreState = NULL; |
ced61fa921ca
let you choose fullscreen resolution for slower system
nplourde
parents:
13787
diff
changeset
|
1424 } |
24952 | 1425 SetSystemUIMode( kUIModeNormal, 0); |
12120 | 1426 |
12296 | 1427 //show mouse cursor |
18057 | 1428 CGDisplayShowCursor(kCGDirectMainDisplay); |
15892 | 1429 mouseHide = FALSE; |
12296 | 1430 |
1431 //revert window to previous setting | |
15702 | 1432 ChangeWindowAttributes(theWindow, 0, kWindowNoShadowAttribute); |
12487 | 1433 SizeWindow(theWindow, oldWinRect.right, oldWinRect.bottom,1); |
13818
9f707a805967
window now save is old position when going in fullscreen or while using resize preset
nplourde
parents:
13796
diff
changeset
|
1434 MoveWindow(theWindow, oldWinBounds.left, oldWinBounds.top, 1); |
12296 | 1435 } |
15702 | 1436 window_resized(); |
12120 | 1437 } |
13840 | 1438 |
1439 void window_panscan() | |
1440 { | |
1441 panscan_calc(); | |
1442 | |
1443 if(vo_panscan > 0) | |
1444 CheckMenuItem (aspectMenu, 2, 1); | |
1445 else | |
1446 CheckMenuItem (aspectMenu, 2, 0); | |
1447 | |
1448 if(vo_quartz_fs) | |
1449 { | |
1450 MoveWindow(theWindow, deviceRect.left-(vo_panscan_x >> 1), deviceRect.top-(vo_panscan_y >> 1), 1); | |
1451 SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1); | |
1452 } | |
1453 } |