summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2012-03-04 20:12:57 +0100
committerUoti Urpala <uau@mplayer2.org>2012-03-25 22:30:37 +0300
commitd0f0bf7fd2b021c17432de5108fd7fa3534a2a10 (patch)
tree156a679e9c58d329068672215e093f02b156a268
parent24e08eb5f2e54fce46a6ff504276aa8da4bf2fa2 (diff)
downloadmpv-d0f0bf7fd2b021c17432de5108fd7fa3534a2a10.tar.bz2
mpv-d0f0bf7fd2b021c17432de5108fd7fa3534a2a10.tar.xz
vo_quartz: remove this video output
This video output is not useful anymore. It is based on Carbon to draw the mplayer window and this has been deprecated by Apple in 10.5. The upcoming 10.8 OSX release should deprecate most of Carbon, so it doesn't make sense to keep vo_quartz in the codebase when there are modern and better alternatives (vo_gl and vo_corevideo).
-rw-r--r--Makefile1
-rwxr-xr-xconfigure22
-rw-r--r--libvo/video_out.c4
-rw-r--r--libvo/vo_quartz.c1371
4 files changed, 0 insertions, 1398 deletions
diff --git a/Makefile b/Makefile
index a67554f377..b3b0634d6d 100644
--- a/Makefile
+++ b/Makefile
@@ -469,7 +469,6 @@ SRCS_MPLAYER-$(OPENAL) += libao2/ao_openal.c
SRCS_MPLAYER-$(OSS) += libao2/ao_oss.c
SRCS_MPLAYER-$(PNM) += libvo/vo_pnm.c
SRCS_MPLAYER-$(PULSE) += libao2/ao_pulse.c
-SRCS_MPLAYER-$(QUARTZ) += libvo/vo_quartz.c libvo/osx_common.c
SRCS_MPLAYER-$(RSOUND) += libao2/ao_rsound.c
SRCS_MPLAYER-$(S3FB) += libvo/vo_s3fb.c
SRCS_MPLAYER-$(SDL) += libao2/ao_sdl.c libvo/vo_sdl.c libvo/sdl_common.c
diff --git a/configure b/configure
index 520c37e30b..22ea2b185e 100755
--- a/configure
+++ b/configure
@@ -437,7 +437,6 @@ Video output:
--disable-yuv4mpeg disable yuv4mpeg video output [enable]
--disable-corevideo disable CoreVideo video output [autodetect]
--disable-cocoa disable Cocoa OpenGL backend [autodetect]
- --disable-quartz disable Quartz video output [autodetect]
Audio output:
--disable-alsa disable ALSA audio output [autodetect]
@@ -699,7 +698,6 @@ _qtx=auto
_coreaudio=auto
_corevideo=auto
_cocoa=auto
-_quartz=auto
quicktime=auto
_macosx_finder=no
_macosx_bundle=auto
@@ -1135,8 +1133,6 @@ for ac_option do
--disable-corevideo) _corevideo=no ;;
--enable-cocoa) _cocoa=yes ;;
--disable-cocoa) _cocoa=no ;;
- --enable-quartz) _quartz=yes ;;
- --disable-quartz) _quartz=no ;;
--enable-macosx-finder) _macosx_finder=yes ;;
--disable-macosx-finder) _macosx_finder=no ;;
--enable-macosx-bundle) _macosx_bundle=yes ;;
@@ -4213,25 +4209,9 @@ if test "$quicktime" = yes ; then
def_quicktime='#define CONFIG_QUICKTIME 1'
else
def_quicktime='#undef CONFIG_QUICKTIME'
- _quartz=no
fi
echores $quicktime
-echocheck "Quartz"
-if test "$_quartz" = auto ; then
- _quartz=no
- statement_check Carbon/Carbon.h 'CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false)' -framework Carbon && _quartz=yes
-fi
-if test "$_quartz" = yes ; then
- libs_mplayer="$libs_mplayer -framework Carbon"
- def_quartz='#define CONFIG_QUARTZ 1'
- vomodules="quartz $vomodules"
-else
- def_quartz='#undef CONFIG_QUARTZ'
- novomodules="quartz $novomodules"
-fi
-echores $_quartz
-
echocheck "CoreVideo"
if test "$_corevideo" = auto ; then
cat > $TMPC <<EOF
@@ -6543,7 +6523,6 @@ PVR = $_pvr
QTX_CODECS = $_qtx
QTX_CODECS_WIN32 = $_qtx_codecs_win32
QTX_EMULATION = $_qtx_emulation
-QUARTZ = $_quartz
RADIO=$_radio
RADIO_CAPTURE=$_radio_capture
REAL_CODECS = $_real
@@ -6908,7 +6887,6 @@ $def_mga
$def_mng
$def_png
$def_pnm
-$def_quartz
$def_s3fb
$def_sdl
$def_sdl_sdl_h
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 18ca3e99e9..1ac5164ada 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -117,7 +117,6 @@ extern struct vo_driver video_out_tdfx_vid;
extern struct vo_driver video_out_xvr100;
extern struct vo_driver video_out_tga;
extern struct vo_driver video_out_corevideo;
-extern struct vo_driver video_out_quartz;
extern struct vo_driver video_out_pnm;
extern struct vo_driver video_out_md5sum;
@@ -141,9 +140,6 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_COREVIDEO
&video_out_corevideo,
#endif
-#ifdef CONFIG_QUARTZ
- &video_out_quartz,
-#endif
#ifdef CONFIG_XMGA
&video_out_xmga,
#endif
diff --git a/libvo/vo_quartz.c b/libvo/vo_quartz.c
deleted file mode 100644
index 9098598aa8..0000000000
--- a/libvo/vo_quartz.c
+++ /dev/null
@@ -1,1371 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- \author Nicolas Plourde <nicolasplourde@gmail.com>
-
- Copyright (c) Nicolas Plourde - April 2004
-
- YUV support Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
-
- \brief MPlayer Mac OSX Quartz video out module.
-
- \todo: -screen overlay output
- -fit osd in black bar when available
- -fix RGB32
- -(add sugestion here)
-*/
-
-//SYS
-#include <stdio.h>
-
-//OSX
-#include <Carbon/Carbon.h>
-#include <QuickTime/QuickTime.h>
-
-//MPLAYER
-#include "config.h"
-#include "fastmemcpy.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "mp_msg.h"
-#include "m_option.h"
-#include "mp_fifo.h"
-#include "mpbswap.h"
-#include "sub/sub.h"
-
-#include "input/input.h"
-#include "input/keycodes.h"
-
-#include "osx_common.h"
-
-static const vo_info_t info =
-{
- "Mac OSX (Quartz)",
- "quartz",
- "Nicolas Plourde <nicolasplourde@hotmail.com>, Romain Dolbeau <romain@dolbeau.org>",
- ""
-};
-
-const LIBVO_EXTERN(quartz)
-
-static uint32_t image_depth;
-static uint32_t image_format;
-static uint32_t image_size;
-static uint32_t image_buffer_size;
-static char *image_data;
-
-static ImageSequence seqId;
-static CodecType image_qtcodec;
-static PlanarPixmapInfoYUV420 *P = NULL;
-static struct
-{
- ImageDescriptionHandle desc;
- Handle extension_colr;
- Handle extension_fiel;
- Handle extension_clap;
- Handle extension_pasp;
-} yuv_qt_stuff;
-static MatrixRecord matrix;
-static int EnterMoviesDone = 0;
-static int get_image_done = 0;
-
-static int vo_quartz_fs; // we are in fullscreen
-
-static int winLevel = 1;
-int levelList[] =
-{
- kCGDesktopWindowLevelKey,
- kCGNormalWindowLevelKey,
- kCGScreenSaverWindowLevelKey
-};
-
-static int int_pause = 0;
-static float winAlpha = 1;
-static int mouseHide = FALSE;
-static float winSizeMult = 1;
-
-static int device_id = 0;
-
-static short fs_res_x = 0;
-static short fs_res_y = 0;
-
-static WindowRef theWindow = NULL;
-static WindowGroupRef winGroup = NULL;
-static CGRect bounds;
-static CGDirectDisplayID displayId = 0;
-static CFDictionaryRef originalMode = NULL;
-
-static CGDataProviderRef dataProviderRef = NULL;
-static CGImageRef image = NULL;
-
-static Rect imgRect; // size of the original image (unscaled)
-static Rect dstRect; // size of the displayed image (after scaling)
-static Rect winRect; // size of the window containg the displayed image (include padding)
-static Rect oldWinRect; // size of the window containg the displayed image (include padding) when NOT in FS mode
-static Rect oldWinBounds;
-
-static MenuRef windMenu;
-static MenuRef movMenu;
-static MenuRef aspectMenu;
-
-static int lastScreensaverUpdate = 0;
-static int lastMouseHide = 0;
-
-enum
-{
- kHalfScreenCmd = 2,
- kNormalScreenCmd = 3,
- kDoubleScreenCmd = 4,
- kFullScreenCmd = 5,
- kKeepAspectCmd = 6,
- kAspectOrgCmd = 7,
- kAspectFullCmd = 8,
- kAspectWideCmd = 9,
- kPanScanCmd = 10
-};
-
-//PROTOTYPE/////////////////////////////////////////////////////////////////
-static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData);
-static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData);
-static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData);
-void window_resized(void);
-void window_ontop(void);
-void window_fullscreen(void);
-void window_panscan(void);
-
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride)
-{
- switch (image_format)
- {
- case IMGFMT_RGB32:
- vo_draw_alpha_rgb32(w, h, src, srca, stride, image_data + 4 * (y0 * imgRect.right + x0), 4 * imgRect.right);
- break;
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- vo_draw_alpha_yv12(w, h, src, srca, stride, ((char *)P) + be2me_32(P->componentInfoY.offset) + x0 + y0 * imgRect.right, imgRect.right);
- break;
- case IMGFMT_UYVY:
- vo_draw_alpha_uyvy(w, h, src, srca, stride, ((char *)P) + (x0 + y0 * imgRect.right) * 2, imgRect.right * 2);
- break;
- case IMGFMT_YUY2:
- vo_draw_alpha_yuy2(w, h, src, srca, stride, ((char *)P) + (x0 + y0 * imgRect.right) * 2, imgRect.right * 2);
- break;
- }
-}
-
-//default keyboard event handler
-static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData)
-{
- OSStatus result = noErr;
- UInt32 class = GetEventClass(event);
- UInt32 kind = GetEventKind(event);
-
- result = CallNextEventHandler(nextHandler, event);
-
- if (class == kEventClassKeyboard)
- {
- char macCharCodes;
- UInt32 macKeyCode;
- UInt32 macKeyModifiers;
-
- GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(macCharCodes), NULL, &macCharCodes);
- GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(macKeyCode), NULL, &macKeyCode);
- GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(macKeyModifiers), NULL, &macKeyModifiers);
-
- if (macKeyModifiers != 256)
- {
- if (kind == kEventRawKeyRepeat || kind == kEventRawKeyDown)
- {
- int key = convert_key(macKeyCode, macCharCodes);
-
- if (key != -1)
- mplayer_put_key(key);
- }
- }
- else if (macKeyModifiers == 256)
- {
- switch (macCharCodes)
- {
- case '[': SetWindowAlpha(theWindow, winAlpha -= 0.05); break;
- case ']': SetWindowAlpha(theWindow, winAlpha += 0.05); break;
- }
- }
- else
- result = eventNotHandledErr;
- }
-
- return result;
-}
-
-//default mouse event handler
-static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData)
-{
- OSStatus result = noErr;
- UInt32 class = GetEventClass(event);
- UInt32 kind = GetEventKind(event);
-
- result = CallNextEventHandler(nextHandler, event);
-
- if (class == kEventClassMouse)
- {
- WindowPtr tmpWin;
- Point mousePos;
- Point winMousePos;
-
- GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(mousePos), 0, &mousePos);
- GetEventParameter(event, kEventParamWindowMouseLocation, typeQDPoint, 0, sizeof(winMousePos), 0, &winMousePos);
-
- switch (kind)
- {
- case kEventMouseMoved:
- {
- if (vo_quartz_fs)
- {
- CGDisplayShowCursor(displayId);
- mouseHide = FALSE;
- }
- }
- break;
-
- case kEventMouseWheelMoved:
- {
- int wheel;
- short part;
-
- GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(wheel), 0, &wheel);
-
- part = FindWindow(mousePos, &tmpWin);
-
- if (part == inContent)
- {
- if (wheel > 0)
- mplayer_put_key(MOUSE_BTN3);
- else
- mplayer_put_key(MOUSE_BTN4);
- }
- }
- break;
-
- case kEventMouseDown:
- case kEventMouseUp:
- {
- EventMouseButton button;
- short part;
- Rect bounds;
-
- GetWindowPortBounds(theWindow, &bounds);
- GetEventParameter(event, kEventParamMouseButton, typeMouseButton, 0, sizeof(button), 0, &button);
-
- part = FindWindow(mousePos, &tmpWin);
- if (kind == kEventMouseUp)
- {
- if (part != inContent)
- break;
- switch (button)
- {
- case kEventMouseButtonPrimary:
- mplayer_put_key(MOUSE_BTN0);
- break;
- case kEventMouseButtonSecondary:
- mplayer_put_key(MOUSE_BTN2);
- break;
- case kEventMouseButtonTertiary:
- mplayer_put_key(MOUSE_BTN1);
- break;
-
- default:
- result = eventNotHandledErr;
- break;
- }
- break;
- }
- if (winMousePos.h > bounds.right - 15 && winMousePos.v > bounds.bottom)
- {
- if (!vo_quartz_fs)
- {
- Rect newSize;
-
- ResizeWindow(theWindow, mousePos, NULL, &newSize);
- }
- }
- else if (part == inMenuBar)
- {
- MenuSelect(mousePos);
- HiliteMenu(0);
- }
- else if (part == inContent)
- {
- switch (button)
- {
- case kEventMouseButtonPrimary:
- mplayer_put_key(MOUSE_BTN0 | MP_KEY_DOWN);
- break;
- case kEventMouseButtonSecondary:
- mplayer_put_key(MOUSE_BTN2 | MP_KEY_DOWN);
- break;
- case kEventMouseButtonTertiary:
- mplayer_put_key(MOUSE_BTN1 | MP_KEY_DOWN);
- break;
-
- default:
- result = eventNotHandledErr;
- break;
- }
- }
- }
- break;
-
- case kEventMouseDragged:
- break;
-
- default:
- result = eventNotHandledErr;
- break;
- }
- }
-
- return result;
-}
-
-static void set_winSizeMult(float mult)
-{
- int d_width, d_height;
- aspect(&d_width, &d_height, A_NOZOOM);
-
- if (vo_quartz_fs)
- {
- vo_fs = !vo_fs;
- window_fullscreen();
- }
-
- winSizeMult = mult;
- SizeWindow(theWindow, d_width * mult, d_height * mult, 1);
- window_resized();
-}
-
-//default window event handler
-static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData)
-{
- OSStatus result = noErr;
- UInt32 class = GetEventClass(event);
- UInt32 kind = GetEventKind(event);
-
- result = CallNextEventHandler(nextHandler, event);
-
- if (class == kEventClassCommand)
- {
- HICommand theHICommand;
-
- GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(theHICommand), NULL, &theHICommand);
-
- switch (theHICommand.commandID)
- {
- case kHICommandQuit:
- mplayer_put_key(KEY_CLOSE_WIN);
- break;
-
- case kHalfScreenCmd:
- set_winSizeMult(0.5);
- break;
-
- case kNormalScreenCmd:
- set_winSizeMult(1);
- break;
-
- case kDoubleScreenCmd:
- set_winSizeMult(2);
- break;
-
- case kFullScreenCmd:
- vo_fs = !vo_fs;
- window_fullscreen();
- break;
-
- case kKeepAspectCmd:
- vo_keepaspect = !vo_keepaspect;
- CheckMenuItem(aspectMenu, 1, vo_keepaspect);
- window_resized();
- break;
-
- case kAspectOrgCmd:
- change_movie_aspect(-1);
- break;
-
- case kAspectFullCmd:
- change_movie_aspect(4.0 / 3.0);
- break;
-
- case kAspectWideCmd:
- change_movie_aspect(16.0 / 9.0);
- break;
-
- case kPanScanCmd:
- vo_panscan = !vo_panscan;
- CheckMenuItem(aspectMenu, 2, vo_panscan);
- window_panscan();
- window_resized();
- break;
-
- default:
- result = eventNotHandledErr;
- break;
- }
- }
- else if (class == kEventClassWindow)
- {
- WindowRef window;
- Rect rectWindow = { 0, 0, 0, 0 };
-
- GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(window), NULL, &window);
-
- if (window)
- {
- GetWindowBounds(window, kWindowGlobalPortRgn, &rectWindow);
- }
-
- switch (kind)
- {
- case kEventWindowClosed:
- theWindow = NULL;
- mplayer_put_key(KEY_CLOSE_WIN);
- break;
-
- // resize window
- case kEventWindowZoomed:
- case kEventWindowBoundsChanged:
- window_resized();
- flip_page();
- window_resized();
- break;
-
- default:
- result = eventNotHandledErr;
- break;
- }
- }
-
- return result;
-}
-
-static void quartz_CreateWindow(uint32_t d_width, uint32_t d_height, WindowAttributes windowAttrs)
-{
- CFStringRef titleKey;
- CFStringRef windowTitle;
- OSStatus result;
-
- MenuItemIndex index;
- CFStringRef movMenuTitle;
- CFStringRef aspMenuTitle;
-
- const EventTypeSpec win_events[] = {
- {kEventClassWindow, kEventWindowClosed},
- {kEventClassWindow, kEventWindowBoundsChanged},
- {kEventClassCommand, kEventCommandProcess}
- };
-
- const EventTypeSpec key_events[] = {
- {kEventClassKeyboard, kEventRawKeyDown},
- {kEventClassKeyboard, kEventRawKeyRepeat}
- };
-
- const EventTypeSpec mouse_events[] = {
- {kEventClassMouse, kEventMouseMoved},
- {kEventClassMouse, kEventMouseWheelMoved},
- {kEventClassMouse, kEventMouseDown},
- {kEventClassMouse, kEventMouseUp},
- {kEventClassMouse, kEventMouseDragged}
- };
-
- SetRect(&winRect, 0, 0, d_width, d_height);
- SetRect(&oldWinRect, 0, 0, d_width, d_height);
- SetRect(&dstRect, 0, 0, d_width, d_height);
-
- // Clear Menu Bar
- ClearMenuBar();
-
- // Create Window Menu
- CreateStandardWindowMenu(0, &windMenu);
- InsertMenu(windMenu, 0);
-
- // Create Movie Menu
- CreateNewMenu(1004, 0, &movMenu);
- movMenuTitle = CFSTR("Movie");
- SetMenuTitleWithCFString(movMenu, movMenuTitle);
-
- AppendMenuItemTextWithCFString(movMenu, CFSTR("Half Size"), 0, kHalfScreenCmd, &index);
- SetMenuItemCommandKey(movMenu, index, 0, '0');
-
- AppendMenuItemTextWithCFString(movMenu, CFSTR("Normal Size"), 0, kNormalScreenCmd, &index);
- SetMenuItemCommandKey(movMenu, index, 0, '1');
-
- AppendMenuItemTextWithCFString(movMenu, CFSTR("Double Size"), 0, kDoubleScreenCmd, &index);
- SetMenuItemCommandKey(movMenu, index, 0, '2');
-
- AppendMenuItemTextWithCFString(movMenu, CFSTR("Full Size"), 0, kFullScreenCmd, &index);
- SetMenuItemCommandKey(movMenu, index, 0, 'F');
-
- AppendMenuItemTextWithCFString(movMenu, NULL, kMenuItemAttrSeparator, 0, &index);
-
- AppendMenuItemTextWithCFString(movMenu, CFSTR("Aspect Ratio"), 0, 0, &index);
-
- //// Create Aspect Ratio Sub Menu
- CreateNewMenu(0, 0, &aspectMenu);
- aspMenuTitle = CFSTR("Aspect Ratio");
- SetMenuTitleWithCFString(aspectMenu, aspMenuTitle);
- SetMenuItemHierarchicalMenu(movMenu, 6, aspectMenu);
-
- AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Keep"), 0, kKeepAspectCmd, &index);
- CheckMenuItem(aspectMenu, 1, vo_keepaspect);
- AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Pan-Scan"), 0, kPanScanCmd, &index);
- CheckMenuItem(aspectMenu, 2, vo_panscan);
- AppendMenuItemTextWithCFString(aspectMenu, NULL, kMenuItemAttrSeparator, 0, &index);
- AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Original"), 0, kAspectOrgCmd, &index);
- AppendMenuItemTextWithCFString(aspectMenu, CFSTR("4:3"), 0, kAspectFullCmd, &index);
- AppendMenuItemTextWithCFString(aspectMenu, CFSTR("16:9"), 0, kAspectWideCmd, &index);
-
- InsertMenu(movMenu, GetMenuID(windMenu)); //insert before Window menu
-
- DrawMenuBar();
-
- // create window
- CreateNewWindow(kDocumentWindowClass, windowAttrs, &winRect, &theWindow);
-
- CreateWindowGroup(0, &winGroup);
- SetWindowGroup(theWindow, winGroup);
-
- // Set window title
- titleKey = CFSTR("MPlayer - The Movie Player");
- windowTitle = CFCopyLocalizedString(titleKey, NULL);
- result = SetWindowTitleWithCFString(theWindow, windowTitle);
- CFRelease(titleKey);
- CFRelease(windowTitle);
-
- // Install event handler
- InstallApplicationEventHandler(NewEventHandlerUPP(KeyEventHandler), GetEventTypeCount(key_events), key_events, NULL, NULL);
- InstallApplicationEventHandler(NewEventHandlerUPP(MouseEventHandler), GetEventTypeCount(mouse_events), mouse_events, NULL, NULL);
- InstallWindowEventHandler(theWindow, NewEventHandlerUPP(WindowEventHandler), GetEventTypeCount(win_events), win_events, theWindow, NULL);
-}
-
-static void update_screen_info(void)
-{
- CGRect displayRect;
- CGDisplayCount displayCount;
- CGDirectDisplayID *displays;
- // Display IDs might not be consecutive, get the list of all devices up to # device_id
- displayCount = device_id + 1;
- displays = malloc(sizeof(*displays) * displayCount);
- if (kCGErrorSuccess != CGGetActiveDisplayList(displayCount, displays, &displayCount) || displayCount < device_id + 1) {
- mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Device ID %d do not exist, falling back to main device.\n", device_id);
- displayId = kCGDirectMainDisplay;
- device_id = 0;
- }
- else
- {
- displayId = displays[device_id];
- }
- free(displays);
-
- displayRect = CGDisplayBounds(displayId);
- xinerama_x = displayRect.origin.x;
- xinerama_y = displayRect.origin.y;
- vo_screenwidth = displayRect.size.width;
- vo_screenheight = displayRect.size.height;
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
-}
-
-static void free_video_specific(void)
-{
- if (seqId) CDSequenceEnd(seqId);
- seqId = 0;
- free(image_data);
- image_data = NULL;
- free(P);
- P = NULL;
- CGDataProviderRelease(dataProviderRef);
- dataProviderRef = NULL;
- CGImageRelease(image);
- image = NULL;
-}
-
-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)
-{
- WindowAttributes windowAttrs;
- OSErr qterr;
- CGRect tmpBounds;
-
- free_video_specific();
-
- vo_dwidth = d_width *= winSizeMult;
- vo_dheight = d_height *= winSizeMult;
- config_movie_aspect((float)d_width / d_height);
-
- // misc mplayer setup/////////////////////////////////////////////////////
- SetRect(&imgRect, 0, 0, width, height);
- switch (image_format)
- {
- case IMGFMT_RGB32:
- image_depth = 32;
- break;
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- case IMGFMT_UYVY:
- case IMGFMT_YUY2:
- image_depth = 16;
- break;
- }
- image_size = (imgRect.right * imgRect.bottom * image_depth + 7) / 8;
-
- image_data = malloc(image_size);
-
- // Create player window//////////////////////////////////////////////////
- windowAttrs = kWindowStandardDocumentAttributes
- | kWindowStandardHandlerAttribute
- | kWindowLiveResizeAttribute;
-
- windowAttrs &= ~kWindowResizableAttribute;
-
- if (theWindow == NULL)
- {
- CGContextRef context;
-
- quartz_CreateWindow(d_width, d_height, windowAttrs);
-
- if (theWindow == NULL)
- {
- mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Couldn't create window !!!!!\n");
- return -1;
- }
- tmpBounds = CGRectMake(0, 0, winRect.right, winRect.bottom);
- QDBeginCGContext(GetWindowPort(theWindow), &context);
- CGContextFillRect(context, tmpBounds);
- QDEndCGContext(GetWindowPort(theWindow), &context);
- }
- else
- {
- HideWindow(theWindow);
- ChangeWindowAttributes(theWindow, ~windowAttrs, windowAttrs);
- SetRect(&winRect, 0, 0, d_width, d_height);
- SetRect(&oldWinRect, 0, 0, d_width, d_height);
- SizeWindow(theWindow, d_width, d_height, 1);
- }
-
- switch (image_format)
- {
- case IMGFMT_RGB32:
- {
- CGContextRef context;
-
- QDBeginCGContext(GetWindowPort(theWindow), &context);
-
- dataProviderRef = CGDataProviderCreateWithData(0, image_data, imgRect.right * imgRect.bottom * 4, 0);
-
- image = CGImageCreate(imgRect.right,
- imgRect.bottom,
- 8,
- image_depth,
- (imgRect.right * 32 + 7) / 8,
- CGColorSpaceCreateDeviceRGB(),
- kCGImageAlphaNoneSkipFirst,
- dataProviderRef, 0, 1, kCGRenderingIntentDefault);
-
- QDEndCGContext(GetWindowPort(theWindow), &context);
- break;
- }
-
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- case IMGFMT_UYVY:
- case IMGFMT_YUY2:
- {
- get_image_done = 0;
-
- if (!EnterMoviesDone)
- {
- qterr = EnterMovies();
- EnterMoviesDone = 1;
- }
- else
- qterr = 0;
-
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: EnterMovies (%d)\n", qterr);
- return -1;
- }
-
-
- SetIdentityMatrix(&matrix);
-
- if (d_width != width || d_height != height)
- {
- ScaleMatrix(&matrix, FixDiv(Long2Fix(d_width), Long2Fix(width)), FixDiv(Long2Fix(d_height), Long2Fix(height)), 0, 0);
- }
-
- yuv_qt_stuff.desc = (ImageDescriptionHandle) NewHandleClear(sizeof(ImageDescription));
-
- yuv_qt_stuff.extension_colr = NewHandleClear(sizeof(NCLCColorInfoImageDescriptionExtension));
- ((NCLCColorInfoImageDescriptionExtension *) (*yuv_qt_stuff.extension_colr))->colorParamType = kVideoColorInfoImageDescriptionExtensionType;
- ((NCLCColorInfoImageDescriptionExtension *) (*yuv_qt_stuff.extension_colr))->primaries = 2;
- ((NCLCColorInfoImageDescriptionExtension *) (*yuv_qt_stuff.extension_colr))->transferFunction = 2;
- ((NCLCColorInfoImageDescriptionExtension *) (*yuv_qt_stuff.extension_colr))->matrix = 2;
-
- yuv_qt_stuff.extension_fiel = NewHandleClear(sizeof(FieldInfoImageDescriptionExtension));
- ((FieldInfoImageDescriptionExtension *) (*yuv_qt_stuff.extension_fiel))->fieldCount = 1;
- ((FieldInfoImageDescriptionExtension *) (*yuv_qt_stuff.extension_fiel))->fieldOrderings = 0;
-
- yuv_qt_stuff.extension_clap = NewHandleClear(sizeof(CleanApertureImageDescriptionExtension));
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->cleanApertureWidthN = imgRect.right;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->cleanApertureWidthD = 1;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->cleanApertureHeightN = imgRect.bottom;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->cleanApertureHeightD = 1;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->horizOffN = 0;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->horizOffD = 1;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->vertOffN = 0;
- ((CleanApertureImageDescriptionExtension *) (*yuv_qt_stuff.extension_clap))->vertOffD = 1;
-
- yuv_qt_stuff.extension_pasp = NewHandleClear(sizeof(PixelAspectRatioImageDescriptionExtension));
- ((PixelAspectRatioImageDescriptionExtension *) (*yuv_qt_stuff.extension_pasp))->hSpacing = 1;
- ((PixelAspectRatioImageDescriptionExtension *) (*yuv_qt_stuff.extension_pasp))->vSpacing = 1;
-
- (*yuv_qt_stuff.desc)->idSize = sizeof(ImageDescription);
- (*yuv_qt_stuff.desc)->cType = image_qtcodec;
- (*yuv_qt_stuff.desc)->version = 2;
- (*yuv_qt_stuff.desc)->revisionLevel = 0;
- (*yuv_qt_stuff.desc)->vendor = 'mpla';
- (*yuv_qt_stuff.desc)->width = imgRect.right;
- (*yuv_qt_stuff.desc)->height = imgRect.bottom;
- (*yuv_qt_stuff.desc)->hRes = Long2Fix(72);
- (*yuv_qt_stuff.desc)->vRes = Long2Fix(72);
- (*yuv_qt_stuff.desc)->temporalQuality = 0;
- (*yuv_qt_stuff.desc)->spatialQuality = codecLosslessQuality;
- (*yuv_qt_stuff.desc)->frameCount = 1;
- (*yuv_qt_stuff.desc)->dataSize = 0;
- (*yuv_qt_stuff.desc)->depth = 24;
- (*yuv_qt_stuff.desc)->clutID = -1;
-
- qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_colr, kColorInfoImageDescriptionExtension);
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [colr] (%d)\n", qterr);
- }
-
- qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_fiel, kFieldInfoImageDescriptionExtension);
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [fiel] (%d)\n", qterr);
- }
-
- qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_clap, kCleanApertureImageDescriptionExtension);
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [clap] (%d)\n", qterr);
- }
-
- qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_pasp, kCleanApertureImageDescriptionExtension);
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [pasp] (%d)\n", qterr);
- }
- P = calloc(sizeof(PlanarPixmapInfoYUV420) + image_size, 1);
- switch (image_format)
- {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- P->componentInfoY.offset = be2me_32(sizeof(PlanarPixmapInfoYUV420));
- P->componentInfoCb.offset = be2me_32(be2me_32(P->componentInfoY.offset) + image_size / 2);
- P->componentInfoCr.offset = be2me_32(be2me_32(P->componentInfoCb.offset) + image_size / 4);
- P->componentInfoY.rowBytes = be2me_32(imgRect.right);
- P->componentInfoCb.rowBytes = be2me_32(imgRect.right / 2);
- P->componentInfoCr.rowBytes = be2me_32(imgRect.right / 2);
- image_buffer_size = image_size + sizeof(PlanarPixmapInfoYUV420);
- break;
- case IMGFMT_UYVY:
- case IMGFMT_YUY2:
- image_buffer_size = image_size;
- break;
- }
-
- qterr = DecompressSequenceBeginS(&seqId,
- yuv_qt_stuff.desc,
- (char *)P,
- image_buffer_size,
- GetWindowPort(theWindow),
- NULL,
- NULL,
- d_width != width || d_height != height ?
- &matrix : NULL,
- srcCopy,
- NULL,
- 0,
- codecLosslessQuality,
- bestSpeedCodec);
-
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: DecompressSequenceBeginS (%d)\n", qterr);
- return -1;
- }
- }
- break;
- }
-
- // Show window
- RepositionWindow(theWindow, NULL, kWindowCenterOnMainScreen);
- ShowWindow(theWindow);
-
- if (vo_fs)
- window_fullscreen();
-
- if (vo_ontop)
- window_ontop();
-
- if (vo_rootwin)
- {
- vo_fs = TRUE;
- winLevel = 0;
- SetWindowGroupLevel(winGroup, CGWindowLevelForKey(levelList[winLevel]));
- window_fullscreen();
- }
-
- window_resized();
-
- return 0;
-}
-
-static void check_events(void)
-{
- EventRef theEvent;
- EventTargetRef theTarget;
- OSStatus theErr;
-
- // Get event
- theTarget = GetEventDispatcherTarget();
- theErr = ReceiveNextEvent(0, 0, kEventDurationNoWait, true, &theEvent);
- if (theErr == noErr && theEvent != NULL)
- {
- SendEventToEventTarget(theEvent, theTarget);
- ReleaseEvent(theEvent);
- }
-}
-
-static void draw_osd(void)
-{
- vo_draw_text(imgRect.right, imgRect.bottom, draw_alpha);
-}
-
-static void flip_page(void)
-{
- int curTime;
-
- if (theWindow == NULL)
- return;
-
- switch (image_format)
- {
- case IMGFMT_RGB32:
- {
- CGContextRef context;
-
- QDBeginCGContext(GetWindowPort(theWindow), &context);
- CGContextDrawImage(context, bounds, image);
- QDEndCGContext(GetWindowPort(theWindow), &context);
- }
- break;
-
- case IMGFMT_YV12: