annotate libvo/vo_quartz.c @ 13241:9aac2cd8bc53

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