annotate libvo/vo_quartz.c @ 12662:05d46af5e2bf

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