annotate libvo/vo_quartz.c @ 29375:715638877801

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