From 27bc918ffeb095a2e932e373fa718fbb3a3f36c7 Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 4 May 2009 16:55:05 +0000 Subject: Rename macosx video output driver to corevideo. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29252 b3059339-0415-0410-9bf9-f77b7e298cf2 --- AUTHORS | 2 +- DOCS/man/cs/mplayer.1 | 10 +- DOCS/man/de/mplayer.1 | 10 +- DOCS/man/en/mplayer.1 | 12 +- DOCS/man/es/mplayer.1 | 10 +- DOCS/man/fr/mplayer.1 | 12 +- DOCS/man/hu/mplayer.1 | 12 +- DOCS/man/it/mplayer.1 | 10 +- DOCS/man/pl/mplayer.1 | 10 +- DOCS/man/ru/mplayer.1 | 12 +- DOCS/man/zh_CN/mplayer.1 | 12 +- DOCS/tech/MAINTAINERS | 2 +- DOCS/xml/cs/ports.xml | 2 +- DOCS/xml/de/ports.xml | 2 +- DOCS/xml/en/ports.xml | 2 +- DOCS/xml/fr/ports.xml | 2 +- DOCS/xml/hu/ports.xml | 2 +- DOCS/xml/pl/ports.xml | 2 +- DOCS/xml/ru/ports.xml | 2 +- Makefile | 2 +- configure | 4 +- libvo/video_out.c | 4 +- libvo/vo_corevideo.h | 112 +++++ libvo/vo_corevideo.m | 1156 ++++++++++++++++++++++++++++++++++++++++++++++ libvo/vo_macosx.h | 112 ----- libvo/vo_macosx.m | 1156 ---------------------------------------------- 26 files changed, 1337 insertions(+), 1337 deletions(-) create mode 100644 libvo/vo_corevideo.h create mode 100644 libvo/vo_corevideo.m delete mode 100644 libvo/vo_macosx.h delete mode 100644 libvo/vo_macosx.m diff --git a/AUTHORS b/AUTHORS index ff606dee4b..ad1883abf8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -637,7 +637,7 @@ Pietrzak, Dariusz (Eyck) Plourde, Nicolas * quartz video output driver for Mac OS X - * macosx CoreVideo output driver for Mac OS X + * CoreVideo video output driver for Mac OS X * Darwin VCD/SVCD support Poettering, Lennart diff --git a/DOCS/man/cs/mplayer.1 b/DOCS/man/cs/mplayer.1 index 9b5bbc8467..7e128b85d0 100644 --- a/DOCS/man/cs/mplayer.1 +++ b/DOCS/man/cs/mplayer.1 @@ -316,7 +316,7 @@ Nastavení sytosti barev (saturation). .PP .RS (Následující klávesy jsou činné pouze pokud používáte výstupní video rozhraní -Quartz nebo macosx.) +Quartz nebo corevideo.) .RE .PP .PD 0 @@ -3025,14 +3025,14 @@ Navíc pod X11 váš okenní manažer musí rozumět pokynům pro poměr stran o .B "\-ontop\ " Umístí okno přehrávače trvale nad ostatní okna. Podporováno video rozhraními používajícími X11, kromě SDL, -stejně jako directx, macosx, quartz, ggi a gl2. +stejně jako directx, corevideo, quartz, ggi a gl2. . .TP .B \-panscan <0.0\-1.0> Zapne "přibližovací" funkci (pan-and-scan) (oříznutím videa po stranách tak, aby např.\& film 16:9 pokryl obrazovku 4:3 bez černých okrajů). Tato funkce pracuje pouze s video rozhraními xv, xmga, mga, gl, -gl2, quartz, macosx a xvidix. +gl2, quartz, corevideo a xvidix. .br .I POZNÁMKA: Hodnoty mezi \-1 a 0 jsou také povoleny, ale naprosto experimenální @@ -3059,7 +3059,7 @@ Zatím podporování pouze \-vo directx v kombinaci s volbou \-vm. .B \-rootwin (pouze X11) Přehraje film v kořenovém okně (pozadí desktopu). Obrázek na ploše však může překrýt zobrazované video. -Pracuje pouze s video rozhraními x11, xv, xmga, xvidix, quartz, macosx a directx. +Pracuje pouze s video rozhraními x11, xv, xmga, xvidix, quartz, corevideo a directx. . .TP .B \-saturation <\-100\-100> @@ -3375,7 +3375,7 @@ Nastaví rozlišení celoobrazovkového režimu (použitelné pro pomalé systé .PD 1 . .TP -.B macosx (Mac OS X 10.4 nebo 10.3.9 s QuickTime 7) +.B corevideo (Mac OS X 10.4 nebo 10.3.9 s QuickTime 7) Výstupní video rozhraní Mac OS X CoreVideo. .PD 0 .RSs diff --git a/DOCS/man/de/mplayer.1 b/DOCS/man/de/mplayer.1 index 9696f6700d..c3ce690606 100644 --- a/DOCS/man/de/mplayer.1 +++ b/DOCS/man/de/mplayer.1 @@ -328,7 +328,7 @@ Passe S .PP .RS (Die folgenden Tasten sind nur gltig bei Benutzung der Videoausgabetreiber -quartz und macosx.) +quartz und corevideo.) .RE .PP .PD 0 @@ -3322,7 +3322,7 @@ Fenster-Seitenverh .B "\-ontop\ " Sorgt dafr, dass das Abspielfenster oberhalb von anderen Fenstern bleibt. Wird untersttzt von Videoausgabetreibern, die X11 benutzen, auer SDL, -auerdem directx, macosx, quartz, ggi und gl2. +auerdem directx, corevideo, quartz, ggi und gl2. . .TP .B \-panscan <0.0\-1.0> @@ -3330,7 +3330,7 @@ Aktiviert Panscan. Dabei werden z.B.\& bei einem 16:9-Film und einem 4:3-Monitor die Seiten abgeschnitten, damit der komplette Bildbereich ausgefllt wird. Der Bereich kontrolliert, wieviel vom Bild abgeschnitten wird. -Dies funktioniert nur mit den xv-, xmga-, mga-, gl-, gl2, quartz-, macosx- und +Dies funktioniert nur mit den xv-, xmga-, mga-, gl-, gl2, quartz-, corevideo- und xvidix-Videoausgabetreibern. .br .I ANMERKUNG: @@ -3356,7 +3356,7 @@ Momentan nur unterst .B \-rootwin Spielt den Film im Hauptfenster (dem Desktophintergrund) ab. Desktophintergrundbilder knnen den Film allerdings verdecken. -Funktioniert nur mit den x11-, xv-, xmga-, xvidix-, quartz-, macosx- und +Funktioniert nur mit den x11-, xv-, xmga-, xvidix-, quartz-, corevideo- und directx-Videoausgabetreibern. . .TP @@ -3714,7 +3714,7 @@ Gib die Aufl .PD 1 . .TP -.B macosx (Mac OS X 10.4 oder 10.3.9 mit QuickTime 7) +.B corevideo (Mac OS X 10.4 oder 10.3.9 mit QuickTime 7) Mac OS X CoreVideo-Videoausgabetreiber .PD 0 .RSs diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 68d8ee317e..0906523e28 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -312,7 +312,7 @@ Adjust saturation. .PD 1 .PP .RS -(The following keys are valid only when using the quartz or macosx +(The following keys are valid only when using the quartz or corevideo video output driver.) .RE .PP @@ -1041,7 +1041,7 @@ Permit MPlayer to receive pointer events reported by the video output driver. Necessary to select the buttons in DVD menus. Supported for X11 based VOs (x11, xv, xvmc, etc.) and the gl, gl2, direct3d and -macosx VOs. +corevideo VOs. . .TP .B \-noar @@ -3208,14 +3208,14 @@ Furthermore under X11 your window manager has to honor window aspect hints. .B "\-ontop\ " Makes the player window stay on top of other windows. Supported by video output drivers which use X11, except SDL, -as well as directx, macosx, quartz, ggi and gl2. +as well as directx, corevideo, quartz, ggi and gl2. . .TP .B \-panscan <0.0\-1.0> Enables pan-and-scan functionality (cropping the sides of e.g.\& a 16:9 movie to make it fit a 4:3 display without black bands). The range controls how much of the image is cropped. -Only works with the xv, xmga, mga, gl, gl2, quartz, macosx and xvidix +Only works with the xv, xmga, mga, gl, gl2, quartz, corevideo and xvidix video output drivers. .br .I NOTE: @@ -3241,7 +3241,7 @@ Currently only supported by \-vo directx combined with the \-vm option. .B \-rootwin Play movie in the root window (desktop background). Desktop background images may cover the movie window, though. -Only works with the x11, xv, xmga, xvidix, quartz, macosx and directx video output drivers. +Only works with the x11, xv, xmga, xvidix, quartz, corevideo and directx video output drivers. . .TP .B \-saturation <\-100\-100> @@ -3632,7 +3632,7 @@ Specify the fullscreen resolution (useful on slow systems). .PD 1 . .TP -.B macosx (Mac OS X 10.4 or 10.3.9 with QuickTime 7) +.B corevideo (Mac OS X 10.4 or 10.3.9 with QuickTime 7) Mac OS X CoreVideo video output driver .PD 0 .RSs diff --git a/DOCS/man/es/mplayer.1 b/DOCS/man/es/mplayer.1 index 12aec37677..507197df55 100644 --- a/DOCS/man/es/mplayer.1 +++ b/DOCS/man/es/mplayer.1 @@ -313,7 +313,7 @@ Ajusta la saturaci .PD 1 .PP (Las siguientes teclas son vlidas nicamente cuando se usa quartz o el -controlador de vdeo de macosx) +controlador de vdeo de corevideo) .PP .PD 0 .IPs "command + 0" @@ -2882,7 +2882,7 @@ de aspecto de ventana. .TP .B \-ontop Hace que la ventana de reproduccin se quede por encima de las otras ventanas. -Soportado por controladores que usen X11, excepto SDL, as como directx,macosx, +Soportado por controladores que usen X11, excepto SDL, as como directx,corevideo, quartz, ggi y gl2. . .TP @@ -2892,7 +2892,7 @@ pel .br El rango controla cunto de la imagen ser recortado. Slo funciona con los controladores de salida de vdeo xv, xmga, mga, gl, gl2, -quartz, macosx y xvidix. +quartz, corevideo y xvidix. . .TP .B \-panscanrange <\-19.0\-99.0> (experimental) @@ -2915,7 +2915,7 @@ Reproduce la pel Las imgenes del fondo de escritorio pueden cubrir sin embargo a la ventana de la pelcula. Funciona slo con los controladores de salida de vdeo x11, xv, xmga, -xvidix, quartz, macosx y directx. +xvidix, quartz, corevideo y directx. . .TP .B \-saturation <\-100\-100> @@ -3249,7 +3249,7 @@ Especifica la resoluci .PD 1 . .TP -.B macosx (Mac OS X 10.4 o 10.3.9 con QuickTime 7) +.B corevideo (Mac OS X 10.4 o 10.3.9 con QuickTime 7) Controlador de salida de vdeo Mac OS X CoreVideo. .PD 0 .RSs diff --git a/DOCS/man/fr/mplayer.1 b/DOCS/man/fr/mplayer.1 index 74c1e9c8eb..a8ba671003 100644 --- a/DOCS/man/fr/mplayer.1 +++ b/DOCS/man/fr/mplayer.1 @@ -328,7 +328,7 @@ Ajuste la saturation. .PP .RS (Les touches suivantes ne sont valides que lorsque le pilote de sortie -vido quartz ou macosx est utilis.) +vido quartz ou corevideo est utilis.) .RE .PP .PD 0 @@ -1097,7 +1097,7 @@ Permet MPlayer de recevoir des par le pilote de sortie vido. Utilis pour slectioner les boutons des menus DVDs. Gr par par les VOs bass sur X11 (x11, xv, xvmc, etc.) ainsi que les VOs gl, -gl2, direct3d et macosx. +gl2, direct3d et corevideo. . .TP .B \-noar @@ -3386,7 +3386,7 @@ hauteur/\:largeur de fen .B "\-ontop\ " Rend la fentre de lecture toujours visible. Permise par les pilotes de sortie vido qui utilisent X11, except SDL, -aussi bien que directx, macosx, quartz, ggi et gl2. +aussi bien que directx, corevideo, quartz, ggi et gl2. . .TP .B \-panscan <0.0\-1.0> @@ -3394,7 +3394,7 @@ Active la fonctionnalit film 16/\:9e pour qu'il tienne sans bords noirs sur un cran 4/\:3) L'intervalle dfinit quel point l'image sera coupe. Cette option ne fonctionne qu'avec les pilotes de sortie vido xv, xmga, mga, -gl, gl2, quartz, macosx et xvidix. +gl, gl2, quartz, corevideo et xvidix. .br .I NOTE\ : Des valeurs compris entre \-1 et 0 sont aussi permises, mais trs exprimentale, @@ -3421,7 +3421,7 @@ N'est g Joue le film dans la fentre root (le fond du bureau). Les images en fond d'cran peuvent nanmoins cacher le film. Cette option ne fonctionne qu'avec les pilotes de sortie vido x11, xv, xmga, -xvidix, quartz, macosx et directx. +xvidix, quartz, corevideo et directx. . .TP .B \-saturation <\-100\-100> @@ -3821,7 +3821,7 @@ Choisir la r .PD 1 . .TP -.B macosx (Mac OS X 10.4 ou 10.3.9 avec QuickTime 7) +.B corevideo (Mac OS X 10.4 ou 10.3.9 avec QuickTime 7) pilote de sortie vido CoreVideo pour Mac OS X .PD 0 .RSs diff --git a/DOCS/man/hu/mplayer.1 b/DOCS/man/hu/mplayer.1 index 361822da37..b186c586f3 100644 --- a/DOCS/man/hu/mplayer.1 +++ b/DOCS/man/hu/mplayer.1 @@ -314,7 +314,7 @@ Szatur .PD 1 .PP .RS -(A kvetkez billentyk csak quartz vagy macosx vide kimeneten mkdnek.) +(A kvetkez billentyk csak quartz vagy corevideo vide kimeneten mkdnek.) .RE .PP .PD 0 @@ -1041,7 +1041,7 @@ Enged melyeket a vide kimeneti eszkz kld. Szksges a dvd menkben a gombok kivlasztshoz. Az X11 alap VO-kban (x11, xv, xvmc, stb.), a gl, a gl2, a direct3d s a -macosx VO-kban tmogatott. +corevideo VO-kban tmogatott. . .TP .B \-noar @@ -3220,14 +3220,14 @@ Tov .B "\-ontop\ " A lejtszsi ablak folyamatosan a tbbi ablak eltt lesz lthat. Azok a vide kimeneti vezrlk tmogatjk, amelyek X11-et hasznlnak, -kivve az SDL-t, valamint a directx, macosx, quartz, ggi s gl2. +kivve az SDL-t, valamint a directx, corevideo, quartz, ggi s gl2. . .TP .B \-panscan <0.0\-1.0> Pan & Scan funkci bekapcsolsa (pl.\& egy 16:9 arny film szleinek a levgsa, hogy elfrjen egy 4:3 arny kpernyn fekete svok nlkl) A tartomny vezrli, hogy a kpbl mennyi kerl levgsra. -Ez a funkci csak az xv, xmga, mga, gl, gl2, quartz, macosx s xvidix vide +Ez a funkci csak az xv, xmga, mga, gl, gl2, quartz, corevideo s xvidix vide kimeneti meghajtkkal mkdik. .br .I MEGJEGYZS: @@ -3253,7 +3253,7 @@ Jelenleg csak a \-vo directx t .B \-rootwin A film root ablakban (asztal htterben) trtn lejtszsa. Az asztalon lv httrkp kitakarhatja a filmet. -Csak az x11, xv, xmga, xvidix, quartz, macosx s directx vide meghajtk +Csak az x11, xv, xmga, xvidix, quartz, corevideo s directx vide meghajtk tmogatjk. . .TP @@ -3649,7 +3649,7 @@ A teljes k .PD 1 . .TP -.B macosx (Mac OS X 10.4 vagy 10.3.9 QuickTime 7-tel) +.B corevideo (Mac OS X 10.4 vagy 10.3.9 QuickTime 7-tel) Mac OS X CoreVideo kimeneti vide vezrl .PD 0 .RSs diff --git a/DOCS/man/it/mplayer.1 b/DOCS/man/it/mplayer.1 index c66c75ece9..eba3255ce3 100644 --- a/DOCS/man/it/mplayer.1 +++ b/DOCS/man/it/mplayer.1 @@ -330,7 +330,7 @@ Regola la saturazione. .PP .RS (I seguenti tasti sono validi solo quando si utilizza il driver di uscita -video quartz oppure macosx.) +video quartz oppure corevideo.) .RE .PP .PD 0 @@ -3296,7 +3296,7 @@ dell'aspetto finestra. Rende la finestra di visualizzazione del filmato in modalit 'stay on top', stai in cima, alle altre finestre. Supportato dai driver di uscita video che usano X11, SDL esclusa, cos come -da directx, macosx, quartz, ggi e gl2. +da directx, corevideo, quartz, ggi e gl2. . .TP .B \-panscan <0.0\-1.0> @@ -3305,7 +3305,7 @@ filmato in formato 16:9 per adattarlo ad uno schermo 4:3 senza avere bande nere) Il parametro controlla quanto dell'immagine viene tagliato. Questa opzione funziona solo con i driver di uscita video xv, xmga, mga, -gl, gl2, quartz, macosx e xvidix. +gl, gl2, quartz, corevideo e xvidix. .br .I NOTA: Sono permessi anche valori compresi tra \-1 e 0, ma sono altamente sperimentali @@ -3331,7 +3331,7 @@ l'opzione \-vm. .B \-rootwin Visualizza il filmato nella finestra root (lo sfondo del desktop). L'immagine di sfondo del desktop pu per coprire la finestra del filmato. -Funziona solo con i driver di uscita video x11, xv, xmga, xvidix, quartz, macosx e directx. +Funziona solo con i driver di uscita video x11, xv, xmga, xvidix, quartz, corevideo e directx. . .TP .B \-saturation <\-100\-100> @@ -3681,7 +3681,7 @@ Specifica la risoluzione a schermo intero (utile su sistemi lenti). .PD 1 . .TP -.B macosx (Mac OS X 10.4 oppure 10.3.9 con QuickTime 7) +.B corevideo (Mac OS X 10.4 oppure 10.3.9 con QuickTime 7) Driver di uscita video Mac OS X CoreVideo. .PD 0 .RSs diff --git a/DOCS/man/pl/mplayer.1 b/DOCS/man/pl/mplayer.1 index e905822d82..e1d2cf19c9 100644 --- a/DOCS/man/pl/mplayer.1 +++ b/DOCS/man/pl/mplayer.1 @@ -334,7 +334,7 @@ Modyfikuje nasycenie. .PD 1 .PP (Nastpujce klawisze dziaaj tylko ze sterownikiem wyjcia video quartz lub -macosx.) +corevideo.) .PP .PD 0 .RSs @@ -2293,14 +2293,14 @@ Dodatkowo, pod X11 Tw .B "\-ontop\ " Sprawia, e okno zostaje nad innymi oknami. Obsugiwane przez sterowniki wyjcia video uywajce X11, poza SDL -oraz directx, macosx, quartz, ggi i gl2. +oraz directx, corevideo, quartz, ggi i gl2. . .TP .B \-panscan <0.0\-1.0> Wcza tryb panoramiczny (obcina boki filmu np.\& 16:9 tak, by pasowa na ekran 4:3 bez czarnych paskw). Zasig kontroluje jak dua cz obrazu bdzie przycita. -Dziaa tylko ze sterownikami wyjcia video xv, xmga, mga, gl, quartz, macosx i xvidix. +Dziaa tylko ze sterownikami wyjcia video xv, xmga, mga, gl, quartz, corevideo i xvidix. . .TP .B \-refreshrate @@ -2311,7 +2311,7 @@ Obecnie opcja ta jest obs .B \-rootwin Odtwarza film w gwnym oknie (to pulpitu). Jednak obrazki ta na pulpicie mog przesania okno filmu. -Dziaa tylko ze sterownikami wyjcia video x11, xv, xmga, xvidix, quartz, macosx i directx. +Dziaa tylko ze sterownikami wyjcia video x11, xv, xmga, xvidix, quartz, corevideo i directx. . .TP .B \-saturation <\-100\-100> @@ -2621,7 +2621,7 @@ Podaje rozdzielczo .PD 1 . .TP -.B macosx (Mac OS X 10.4 lub 10.3.9 z QuickTime 7) +.B corevideo (Mac OS X 10.4 lub 10.3.9 z QuickTime 7) sterownik wyjcia video Mac OS X CoreVideo .PD 0 .RSs diff --git a/DOCS/man/ru/mplayer.1 b/DOCS/man/ru/mplayer.1 index d719820930..9103d173c3 100644 --- a/DOCS/man/ru/mplayer.1 +++ b/DOCS/man/ru/mplayer.1 @@ -313,7 +313,7 @@ Stop playing (and quit if \-idle is not used). .PD 1 .PP .RS -( quartz macosx). +( quartz corevideo). .RE .PP .PD 0 @@ -1000,7 +1000,7 @@ FIFO . DVD . VO, X11 (x11, xv, xvmc, etc.) - gl, gl2, direct3d macosx. + gl, gl2, direct3d corevideo. . .TP .B \-noar @@ -3175,7 +3175,7 @@ monitoraspect ( .B "\-ontop\ " . , X11, - SDL, directx, macosx, + SDL, directx, corevideo, quartz, ggi gl2. . .TP @@ -3183,7 +3183,7 @@ quartz, ggi pan\-and\-scan ( , , 16:9, 4:3 ). . - xv, xmga, mga, gl, gl2, quartz, macosx xvidix . + xv, xmga, mga, gl, gl2, quartz, corevideo xvidix . .br .I NOTE: \-1 0 , @@ -3209,7 +3209,7 @@ quartz, ggi .B \-rootwin ( ). , . - x11, xv, xmga, xvidix, quartz, macosx directx . + x11, xv, xmga, xvidix, quartz, corevideo directx . . .TP .B \-saturation <\-100\-100> @@ -3625,7 +3625,7 @@ Windows .PD 1 . .TP -.B macosx (Mac OS X 10.4 10.3.9 QuickTime 7) +.B corevideo (Mac OS X 10.4 10.3.9 QuickTime 7) Mac OS X CoreVideo. .PD 0 .RSs diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index 6d6b31f66b..2a04dea749 100644 --- a/DOCS/man/zh_CN/mplayer.1 +++ b/DOCS/man/zh_CN/mplayer.1 @@ -314,7 +314,7 @@ MPlayer 有个完全可配置的, 命令驱动的控制层, .PD 1 .PP .RS -(以下的按键仅适用于 quartz or macosx 视频输出驱动。) +(以下的按键仅适用于 quartz or corevideo 视频输出驱动。) .RE .PP .PD 0 @@ -989,7 +989,7 @@ n 大小的 FIFO 能容纳 (n\-1) 缓冲事件。 .B \-mouse\-movements 允许 MPlayer 接收来自视频输出驱动的指针事件。 必须选择 DVD 菜单中的按钮。 -支持基于 X11 的视频输出(x11、xv、xvmc等)以及 gl、gl2、direct3d 和 macosx 的视频输出 +支持基于 X11 的视频输出(x11、xv、xvmc等)以及 gl、gl2、direct3d 和 corevideo 的视频输出 . .TP .B \-noar @@ -3007,14 +3007,14 @@ gl、gl2、directx、fbdev 和 tdfxfb 视频输出驱动支持。 .TP .B "\-ontop\ " 使得此播放器窗口位于其他窗口之上。 -视频输出驱动使用 X11 的, 除了 SDL, 还有使用 directx, macosx, quartz, +视频输出驱动使用 X11 的, 除了 SDL, 还有使用 directx, corevideo, quartz, ggi 和 gl2 的都支持此功能。 . .TP .B \-panscan <0.0\-1.0> 启用 pan-and-scan 功能 (裁减如 16:9 电影的边适应 4:3 显示不带黑边)。 范围参数值用来控制裁减多少图像。 -只能与 xv, xmga, mga, gl, gl2, quartz, macosx 和 xvidix 的 +只能与 xv, xmga, mga, gl, gl2, quartz, corevideo 和 xvidix 的 视频输出驱动一起工作。 .br .I 注意: @@ -3038,7 +3038,7 @@ ggi 和 gl2 的都支持此功能。 .B \-rootwin 在根窗口(桌面背景)中播放电影。 虽然桌面背景图像可能盖住电影窗口。 -只能与 x11, xv, xmga, xvidix, quartz, macosx 和 directx 的 +只能与 x11, xv, xmga, xvidix, quartz, corevideo 和 directx 的 视频输出驱动一起工作。 . .TP @@ -3397,7 +3397,7 @@ Mac OS X Quartz 视频输出驱动。 .PD 1 . .TP -.B macosx (Mac OS X 10.4 或 10.3.9 的 QuickTime 7) +.B corevideo (Mac OS X 10.4 或 10.3.9 的 QuickTime 7) Mac OS X CoreVideo 视频输出驱动 .PD 0 .RSs diff --git a/DOCS/tech/MAINTAINERS b/DOCS/tech/MAINTAINERS index 198d2711ea..2933001a46 100644 --- a/DOCS/tech/MAINTAINERS +++ b/DOCS/tech/MAINTAINERS @@ -156,6 +156,7 @@ libvo drivers: * vo_aa.c - Alban Bedel * vo_caca.c - Howell Tam (Pigeon) * vo_bl.c - Rik Snel + * vo_corevideo.m - None * vo_cvidix.c - Sascha Sommer * vo_dga.c - None * vo_dfbmga.c - Ville Syrjälä @@ -172,7 +173,6 @@ libvo drivers: * vo_gl2.c - Reimar Döffinger * vo_ivtv.c - Benjamin Zores * vo_jpeg.c - Ivo van Poorten - * vo_macosx.m - None * vo_md5sum.c - Ivo van Poorten * vo_mga.c - Attila Kinali * vo_mpegpes.c - None diff --git a/DOCS/xml/cs/ports.xml b/DOCS/xml/cs/ports.xml index 5e628d3fdd..c6de31b8e2 100644 --- a/DOCS/xml/cs/ports.xml +++ b/DOCS/xml/cs/ports.xml @@ -740,7 +740,7 @@ GCC 3.x a vyšších. Základní prostředí pro kompilaci můžete získat instalací Xcode od Apple. Máte-li Mac OS X 10.3.9 nebo pozdější a QuickTime 7 -můžete použít výstupní video rozhraní . +můžete použít výstupní video rozhraní . diff --git a/DOCS/xml/de/ports.xml b/DOCS/xml/de/ports.xml index c9638a8f02..6e6c85a56d 100644 --- a/DOCS/xml/de/ports.xml +++ b/DOCS/xml/de/ports.xml @@ -718,7 +718,7 @@ Segmentation fault Xcode von Apple installierst. Besitzt du Mac OS X 10.3.9 oder später und QuickTime 7 - kannst du den Videoausgabetreiber verwenden. + kannst du den Videoausgabetreiber verwenden. diff --git a/DOCS/xml/en/ports.xml b/DOCS/xml/en/ports.xml index abf5c17f72..f90cec3332 100644 --- a/DOCS/xml/en/ports.xml +++ b/DOCS/xml/en/ports.xml @@ -694,7 +694,7 @@ GCC 3.x or later. You can get the basic compilation environment by installing Apple's Xcode. If you have Mac OS X 10.3.9 or later and QuickTime 7 -you can use the video output driver. +you can use the video output driver. diff --git a/DOCS/xml/fr/ports.xml b/DOCS/xml/fr/ports.xml index 8d5cb8b9e2..7b628368dd 100644 --- a/DOCS/xml/fr/ports.xml +++ b/DOCS/xml/fr/ports.xml @@ -740,7 +740,7 @@ Le compilateur préféré étant la version Apple de GCC 3.x ou supérieure. Vous pouvez obtenir l'environement de compilation de base en installant Xcode de Apple. Si vous avez Mac OS X 10.3.9 ou supérieur et QuickTime 7 -vous pouvez utiliser le pilote macosx de sortie vidéo. +vous pouvez utiliser le pilote corevideo de sortie vidéo. Malheureusement, cet environement de base ne vous autorise pas à diff --git a/DOCS/xml/hu/ports.xml b/DOCS/xml/hu/ports.xml index 2a52ae9f71..f000f67194 100644 --- a/DOCS/xml/hu/ports.xml +++ b/DOCS/xml/hu/ports.xml @@ -694,7 +694,7 @@ Az alap fordítási környezetet az Apple Xcode telepítésével kapod meg. Ha Mac OS X 10.3.9 vagy régebbi verziód és QuickTime 7-esed van, -használhatod a videó kimeneti vezérlőt is. +használhatod a videó kimeneti vezérlőt is. diff --git a/DOCS/xml/pl/ports.xml b/DOCS/xml/pl/ports.xml index 1495a0394d..9de674c9ea 100644 --- a/DOCS/xml/pl/ports.xml +++ b/DOCS/xml/pl/ports.xml @@ -693,7 +693,7 @@ wyższym. Zalecanym kompilatorem jest GCC 3.x w wersji Apple. Możesz otrzymać podstawowe środowisko do kompilacji, instalując Xcode od Apple. Jeżeli masz Mac OS X 10.3.9 lub późniejszy i QuickTime 7, możesz -skorzystać ze sterownika wyjścia video . +skorzystać ze sterownika wyjścia video . diff --git a/DOCS/xml/ru/ports.xml b/DOCS/xml/ru/ports.xml index 266b3a155d..ce0b6f527d 100644 --- a/DOCS/xml/ru/ports.xml +++ b/DOCS/xml/ru/ports.xml @@ -726,7 +726,7 @@ mplayer dvd://<title> -dvd-device для компиляции, установив Apple'овский Xcode. Если у вас Mac OS X 10.3.9 или выше и QuickTime 7, можете использовать -драйвер видео вывода . +драйвер видео вывода . diff --git a/Makefile b/Makefile index c56aa88e86..7bd546fec1 100644 --- a/Makefile +++ b/Makefile @@ -532,7 +532,7 @@ SRCS_MPLAYER-$(ARTS) += libao2/ao_arts.c SRCS_MPLAYER-$(BL) += libvo/vo_bl.c SRCS_MPLAYER-$(CACA) += libvo/vo_caca.c SRCS_MPLAYER-$(COREAUDIO) += libao2/ao_coreaudio.c -SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_macosx.m +SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_corevideo.m SRCS_MPLAYER-$(DART) += libao2/ao_dart.c SRCS_MPLAYER-$(DFBMGA) += libvo/vo_dfbmga.c SRCS_MPLAYER-$(DGA) += libvo/vo_dga.c diff --git a/configure b/configure index 488783e81b..3e2f1526f6 100755 --- a/configure +++ b/configure @@ -3863,11 +3863,11 @@ EOF cc_check -framework Carbon -framework Cocoa -framework QuartzCore -framework OpenGL && _corevideo=yes fi if test "$_corevideo" = yes ; then - _vomodules="macosx $_vomodules" + _vomodules="corevideo $_vomodules" extra_ldflags="$extra_ldflags -framework Carbon -framework Cocoa -framework QuartzCore -framework OpenGL" def_corevideo='#define CONFIG_COREVIDEO 1' else - _novomodules="macosx $_novomodules" + _novomodules="corevideo $_novomodules" def_corevideo='#undef CONFIG_COREVIDEO' fi echores "$_corevideo" diff --git a/libvo/video_out.c b/libvo/video_out.c index 81f938b301..b7c0ed1f0a 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -128,7 +128,7 @@ extern vo_functions_t video_out_cvidix; extern vo_functions_t video_out_tdfx_vid; extern vo_functions_t video_out_xvr100; extern vo_functions_t video_out_tga; -extern vo_functions_t video_out_macosx; +extern vo_functions_t video_out_corevideo; extern vo_functions_t video_out_quartz; extern vo_functions_t video_out_pnm; extern vo_functions_t video_out_md5sum; @@ -151,7 +151,7 @@ const vo_functions_t* const video_out_drivers[] = &video_out_kva, #endif #ifdef CONFIG_COREVIDEO - &video_out_macosx, + &video_out_corevideo, #endif #ifdef CONFIG_QUARTZ &video_out_quartz, diff --git a/libvo/vo_corevideo.h b/libvo/vo_corevideo.h new file mode 100644 index 0000000000..44c2ad8a89 --- /dev/null +++ b/libvo/vo_corevideo.h @@ -0,0 +1,112 @@ +/* + * CoreVideo video output driver + * + * Copyright (c) 2005 Nicolas Plourde + * + * 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. + */ + +#import +#import +#import + +// MPlayer OS X VO Protocol +@protocol MPlayerOSXVOProto +- (int) startWithWidth: (bycopy int)width + withHeight: (bycopy int)height + withBytes: (bycopy int)bytes + withAspect: (bycopy int)aspect; +- (void) stop; +- (void) render; +- (void) toggleFullscreen; +- (void) ontop; +@end + +@interface MPlayerOpenGLView : NSOpenGLView +{ + //Cocoa + NSWindow *window; + NSOpenGLContext *glContext; + NSEvent *event; + + //CoreVideo + CVPixelBufferRef frameBuffers[2]; + CVOpenGLTextureCacheRef textureCache; + CVOpenGLTextureRef texture; + NSRect textureFrame; + + GLfloat lowerLeft[2]; + GLfloat lowerRight[2]; + GLfloat upperRight[2]; + GLfloat upperLeft[2]; + + BOOL mouseHide; + float winSizeMult; + + //menu command id + NSMenuItem *kQuitCmd; + NSMenuItem *kHalfScreenCmd; + NSMenuItem *kNormalScreenCmd; + NSMenuItem *kDoubleScreenCmd; + NSMenuItem *kFullScreenCmd; + NSMenuItem *kKeepAspectCmd; + NSMenuItem *kAspectOrgCmd; + NSMenuItem *kAspectFullCmd; + NSMenuItem *kAspectWideCmd; + NSMenuItem *kPanScanCmd; + + //timestamps for disabling screensaver and mouse hiding + int lastMouseHide; + int lastScreensaverUpdate; +} + +- (BOOL) acceptsFirstResponder; +- (BOOL) becomeFirstResponder; +- (BOOL) resignFirstResponder; + +//window & rendering +- (void) preinit; +- (void) config; +- (void) prepareOpenGL; +- (void) render; +- (void) reshape; +- (void) setCurrentTexture; +- (void) drawRect: (NSRect *) bounds; + +//vo control +- (void) fullscreen: (BOOL) animate; +- (void) ontop; +- (void) panscan; +- (void) rootwin; + +//menu +- (void) initMenu; +- (void) menuAction:(id)sender; + +//event +- (void) keyDown: (NSEvent *) theEvent; +- (void) mouseMoved: (NSEvent *) theEvent; +- (void) mouseDown: (NSEvent *) theEvent; +- (void) mouseUp: (NSEvent *) theEvent; +- (void) rightMouseDown: (NSEvent *) theEvent; +- (void) rightMouseUp: (NSEvent *) theEvent; +- (void) otherMouseDown: (NSEvent *) theEvent; +- (void) otherMouseUp: (NSEvent *) theEvent; +- (void) scrollWheel: (NSEvent *) theEvent; +- (void) mouseEvent: (NSEvent *) theEvent; +- (void) check_events; +@end diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m new file mode 100644 index 0000000000..71046fdb68 --- /dev/null +++ b/libvo/vo_corevideo.m @@ -0,0 +1,1156 @@ +/* + * CoreVideo video output driver + * Copyright (c) 2005 Nicolas Plourde + * + * 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. + */ + +#import "vo_corevideo.h" +#include +#include +#include +#include +#include +//special workaround for Apple bug #6267445 +//(OSServices Power API disabled in OSServices.h for 64bit systems) +#ifndef __POWER__ +#include +#endif + +//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 "libvo/sub.h" +#include "subopt-helper.h" + +#include "input/input.h" +#include "input/mouse.h" + +#include "osdep/keycodes.h" + +//Cocoa +NSDistantObject *mplayerosxProxy; +id mplayerosxProto; +MPlayerOpenGLView *mpGLView; +NSAutoreleasePool *autoreleasepool; +OSType pixelFormat; + +//shared memory +int shm_fd; +BOOL shared_buffer = false; +#define DEFAULT_BUFFER_NAME "mplayerosx" +static char *buffer_name; + +//Screen +int screen_id = -1; +NSRect screen_frame; +NSScreen *screen_handle; +NSArray *screen_array; + +//image +unsigned char *image_data; +// For double buffering +static uint8_t image_page = 0; +static unsigned char *image_datas[2]; + +static uint32_t image_width; +static uint32_t image_height; +static uint32_t image_depth; +static uint32_t image_bytes; +static uint32_t image_format; + +//vo +static int isFullscreen; +static int isOntop; +static int isRootwin; +extern float monitor_aspect; +extern float movie_aspect; +static float old_movie_aspect; +extern int enable_mouse_movements; + +static float winAlpha = 1; +static int int_pause = 0; + +static BOOL isLeopardOrLater; + +static vo_info_t info = +{ + "Mac OS X Core Video", + "corevideo", + "Nicolas Plourde ", + "" +}; + +LIBVO_EXTERN(corevideo) + +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*image_width+x0),4*image_width); + break; + case IMGFMT_YUY2: + vo_draw_alpha_yuy2(w,h,src,srca,stride,image_data + (x0 + y0 * image_width) * 2,image_width*2); + break; + } +} + +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) +{ + + //init screen + screen_array = [NSScreen screens]; + if(screen_id < (int)[screen_array count]) + { + screen_handle = [screen_array objectAtIndex:(screen_id < 0 ? 0 : screen_id)]; + } + else + { + mp_msg(MSGT_VO, MSGL_INFO, "[vo_corevideo] Device ID %d does not exist, falling back to main device\n", screen_id); + screen_handle = [screen_array objectAtIndex:0]; + screen_id = -1; + } + screen_frame = [screen_handle frame]; + vo_screenwidth = screen_frame.size.width; + vo_screenheight = screen_frame.size.height; + + //misc mplayer setup + image_width = width; + image_height = height; + switch (image_format) + { + case IMGFMT_BGR32: + case IMGFMT_RGB32: + image_depth = 32; + break; + case IMGFMT_YUY2: + image_depth = 16; + break; + } + image_bytes = (image_depth + 7) / 8; + + if(!shared_buffer) + { + image_data = malloc(image_width*image_height*image_bytes); + image_datas[0] = image_data; + if (vo_doublebuffering) + image_datas[1] = malloc(image_width*image_height*image_bytes); + image_page = 0; + + monitor_aspect = (float)screen_frame.size.width/(float)screen_frame.size.height; + + //set aspect + panscan_init(); + aspect_save_orig(width,height); + aspect_save_prescale(d_width,d_height); + aspect_save_screenres(screen_frame.size.width, screen_frame.size.height); + aspect((int *)&d_width,(int *)&d_height,A_NOZOOM); + + movie_aspect = (float)d_width/(float)d_height; + old_movie_aspect = movie_aspect; + + vo_fs = flags & VOFLAG_FULLSCREEN; + + //config OpenGL View + [mpGLView config]; + [mpGLView reshape]; + } + else + { + mp_msg(MSGT_VO, MSGL_INFO, "[vo_corevideo] writing output to a shared buffer " + "named \"%s\"\n",buffer_name); + + movie_aspect = (float)d_width/(float)d_height; + + // create shared memory + shm_fd = shm_open(buffer_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); + if (shm_fd == -1) + { + mp_msg(MSGT_VO, MSGL_FATAL, + "[vo_corevideo] failed to open shared memory. Error: %s\n", strerror(errno)); + return 1; + } + + + if (ftruncate(shm_fd, image_width*image_height*image_bytes) == -1) + { + mp_msg(MSGT_VO, MSGL_FATAL, + "[vo_corevideo] failed to size shared memory, possibly already in use. Error: %s\n", strerror(errno)); + shm_unlink(buffer_name); + return 1; + } + + image_data = mmap(NULL, image_width*image_height*image_bytes, + PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + + if (image_data == MAP_FAILED) + { + mp_msg(MSGT_VO, MSGL_FATAL, + "[vo_corevideo] failed to map shared memory. Error: %s\n", strerror(errno)); + shm_unlink(buffer_name); + return 1; + } + + //connect to mplayerosx + mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:[NSString stringWithCString:buffer_name] host:nil]; + if ([mplayerosxProxy conformsToProtocol:@protocol(MPlayerOSXVOProto)]) { + [mplayerosxProxy setProtocolForProxy:@protocol(MPlayerOSXVOProto)]; + mplayerosxProto = (id )mplayerosxProxy; + [mplayerosxProto startWithWidth: image_width withHeight: image_height withBytes: image_bytes withAspect:(int)(movie_aspect*100)]; + } + else { + [mplayerosxProxy release]; + mplayerosxProxy = nil; + mplayerosxProto = nil; + } + } + return 0; +} + +static void check_events(void) +{ + [mpGLView check_events]; +} + +static void draw_osd(void) +{ + vo_draw_text(image_width, image_height, draw_alpha); +} + +static void flip_page(void) +{ + if(shared_buffer) + [mplayerosxProto render]; + else { + [mpGLView setCurrentTexture]; + [mpGLView render]; + if (vo_doublebuffering) { + image_page = 1 - image_page; + image_data = image_datas[image_page]; + } + } +} + +static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) +{ + return 0; +} + + +static int draw_frame(uint8_t *src[]) +{ + switch (image_format) + { + case IMGFMT_BGR32: + case IMGFMT_RGB32: + fast_memcpy(image_data, src[0], image_width*image_height*image_bytes); + break; + + case IMGFMT_YUY2: + memcpy_pic(image_data, src[0], image_width * 2, image_height, image_width * 2, image_width * 2); + break; + } + + return 0; +} + +static int query_format(uint32_t format) +{ + image_format = format; + + switch(format) + { + case IMGFMT_YUY2: + pixelFormat = kYUVSPixelFormat; + return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; + + case IMGFMT_RGB32: + case IMGFMT_BGR32: + pixelFormat = k32ARGBPixelFormat; + return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; + } + return 0; +} + +static void uninit(void) +{ + if(shared_buffer) + { + [mplayerosxProto stop]; + mplayerosxProto = nil; + [mplayerosxProxy release]; + mplayerosxProxy = nil; + + if (munmap(image_data, image_width*image_height*image_bytes) == -1) + mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] uninit: munmap failed. Error: %s\n", strerror(errno)); + + if (shm_unlink(buffer_name) == -1) + mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] uninit: shm_unlink failed. Error: %s\n", strerror(errno)); + + } + + SetSystemUIMode( kUIModeNormal, 0); + CGDisplayShowCursor(kCGDirectMainDisplay); + + if(mpGLView) + { + NSAutoreleasePool *finalPool; + mpGLView = nil; + [autoreleasepool release]; + finalPool = [[NSAutoreleasePool alloc] init]; + [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; + [finalPool release]; + } + if (!shared_buffer) + { + free(image_datas[0]); + if (vo_doublebuffering) + free(image_datas[1]); + image_datas[0] = NULL; + image_datas[1] = NULL; + image_data = NULL; + } + + if (buffer_name) free(buffer_name); + buffer_name = NULL; +} + +static opt_t subopts[] = { +{"device_id", OPT_ARG_INT, &screen_id, NULL}, +{"shared_buffer", OPT_ARG_BOOL, &shared_buffer, NULL}, +{"buffer_name", OPT_ARG_MSTRZ,&buffer_name, NULL}, +{NULL} +}; + +static int preinit(const char *arg) +{ + + // set defaults + screen_id = -1; + shared_buffer = false; + buffer_name = NULL; + + if (subopt_parse(arg, subopts) != 0) { + mp_msg(MSGT_VO, MSGL_FATAL, + "\n-vo corevideo command line help:\n" + "Example: mplayer -vo corevideo:device_id=1:shared_buffer:buffer_name=mybuff\n" + "\nOptions:\n" + " device_id=<0-...>\n" + " Set screen device ID for fullscreen.\n" + " shared_buffer\n" + " Write output to a shared memory buffer instead of displaying it.\n" + " buffer_name=\n" + " Name of the shared buffer created with shm_open() as well as\n" + " the name of the NSConnection MPlayer will try to open.\n" + " Setting buffer_name implicitly enables shared_buffer.\n" + "\n" ); + return -1; + } + + NSApplicationLoad(); + autoreleasepool = [[NSAutoreleasePool alloc] init]; + NSApp = [NSApplication sharedApplication]; + isLeopardOrLater = floor(NSAppKitVersionNumber) > 824; + + if (!buffer_name) + buffer_name = strdup(DEFAULT_BUFFER_NAME); + else + shared_buffer = true; + + if(!shared_buffer) + { + #if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL) + //this chunk of code is heavily based off SDL_macosx.m from SDL + ProcessSerialNumber myProc, frProc; + Boolean sameProc; + + if (GetFrontProcess(&frProc) == noErr) + { + if (GetCurrentProcess(&myProc) == noErr) + { + if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc) + { + TransformProcessType(&myProc, kProcessTransformToForegroundApplication); + } + SetFrontProcess(&myProc); + } + } + #endif + + if(!mpGLView) + { + mpGLView = [[MPlayerOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) pixelFormat:[MPlayerOpenGLView defaultPixelFormat]]; + [mpGLView autorelease]; + } + + [mpGLView display]; + [mpGLView preinit]; + } + + return 0; +} + +static int control(uint32_t request, void *data, ...) +{ + switch (request) + { + case VOCTRL_PAUSE: return int_pause = 1; + case VOCTRL_RESUME: return int_pause = 0; + case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); + case VOCTRL_ONTOP: vo_ontop = (!(vo_ontop)); if(!shared_buffer){ [mpGLView ontop]; } else { [mplayerosxProto ontop]; } return VO_TRUE; + case VOCTRL_ROOTWIN: vo_rootwin = (!(vo_rootwin)); [mpGLView rootwin]; return VO_TRUE; + case VOCTRL_FULLSCREEN: vo_fs = (!(vo_fs)); if(!shared_buffer){ [mpGLView fullscreen: NO]; } else { [mplayerosxProto toggleFullscreen]; } return VO_TRUE; + case VOCTRL_GET_PANSCAN: return VO_TRUE; + case VOCTRL_SET_PANSCAN: [mpGLView panscan]; return VO_TRUE; + } + return VO_NOTIMPL; +} + +////////////////////////////////////////////////////////////////////////// +// NSOpenGLView Subclass +////////////////////////////////////////////////////////////////////////// +@implementation MPlayerOpenGLView +- (void) preinit +{ + //init menu + [self initMenu]; + + //create window + window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100) + styleMask:NSTitledWindowMask|NSTexturedBackgroundWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask + backing:NSBackingStoreBuffered defer:NO]; + + [window autorelease]; + [window setDelegate:mpGLView]; + [window setContentView:mpGLView]; + [window setInitialFirstResponder:mpGLView]; + [window setAcceptsMouseMovedEvents:YES]; + [window setTitle:@"MPlayer - The Movie Player"]; + + isFullscreen = 0; + winSizeMult = 1; +} + +- (void) config +{ + uint32_t d_width; + uint32_t d_height; + + GLint swapInterval = 1; + + NSRect frame; + CVReturn error = kCVReturnSuccess; + + //config window + aspect((int *)&d_width, (int *)&d_height,A_NOZOOM); + frame = NSMakeRect(0, 0, d_width, d_height); + [window setContentSize: frame.size]; + + //create OpenGL Context + glContext = [[NSOpenGLContext alloc] initWithFormat:[NSOpenGLView defaultPixelFormat] shareContext:nil]; + + [self setOpenGLContext:glContext]; + [glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; + [glContext setView:self]; + [glContext makeCurrentContext]; + + error = CVPixelBufferCreateWithBytes(NULL, image_width, image_height, pixelFormat, image_datas[0], image_width*image_bytes, NULL, NULL, NULL, &frameBuffers[0]); + if(error != kCVReturnSuccess) + mp_msg(MSGT_VO, MSGL_ERR,"[vo_corevideo] Failed to create Pixel Buffer(%d)\n", error); + if (vo_doublebuffering) { + error = CVPixelBufferCreateWithBytes(NULL, image_width, image_height, pixelFormat, image_datas[1], image_width*image_bytes, NULL, NULL, NULL, &frameBuffers[1]); + if(error != kCVReturnSuccess) + mp_msg(MSGT_VO, MSGL_ERR,"[vo_corevideo] Failed to create Pixel Double Buffer(%d)\n", error); + } + + error = CVOpenGLTextureCacheCreate(NULL, 0, [glContext CGLContextObj], [[self pixelFormat] CGLPixelFormatObj], 0, &textureCache); + if(error != kCVReturnSuccess) + mp_msg(MSGT_VO, MSGL_ERR,"[vo_corevideo] Failed to create OpenGL texture Cache(%d)\n", error); + + error = CVOpenGLTextureCacheCreateTextureFromImage(NULL, textureCache, frameBuffers[image_page], 0, &texture); + if(error != kCVReturnSuccess) + mp_msg(MSGT_VO, MSGL_ERR,"[vo_corevideo] Failed to create OpenGL texture(%d)\n", error); + + //show window + [window center]; + [window makeKeyAndOrderFront:mpGLView]; + + if(vo_rootwin) + [mpGLView rootwin]; + + if(vo_fs) + [mpGLView fullscreen: NO]; + + if(vo_ontop) + [mpGLView ontop]; +} + +/* + Init Menu +*/ +- (void)initMenu +{ + NSMenu *menu, *aspectMenu; + NSMenuItem *menuItem; + + [NSApp setMainMenu:[[NSMenu alloc] init]]; + +//Create Movie Menu + menu = [[NSMenu alloc] initWithTitle:@"Movie"]; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Half Size" action:@selector(menuAction:) keyEquivalent:@"0"]; [menu addItem:menuItem]; + kHalfScreenCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Normal Size" action:@selector(menuAction:) keyEquivalent:@"1"]; [menu addItem:menuItem]; + kNormalScreenCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Double Size" action:@selector(menuAction:) keyEquivalent:@"2"]; [menu addItem:menuItem]; + kDoubleScreenCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Full Size" action:@selector(menuAction:) keyEquivalent:@"f"]; [menu addItem:menuItem]; + kFullScreenCmd = menuItem; + menuItem = (NSMenuItem *)[NSMenuItem separatorItem]; [menu addItem:menuItem]; + + aspectMenu = [[NSMenu alloc] initWithTitle:@"Aspect Ratio"]; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Keep" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem]; + if(vo_keepaspect) [menuItem setState:NSOnState]; + kKeepAspectCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Pan-Scan" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem]; + if(vo_panscan) [menuItem setState:NSOnState]; + kPanScanCmd = menuItem; + menuItem = (NSMenuItem *)[NSMenuItem separatorItem]; [aspectMenu addItem:menuItem]; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Original" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem]; + kAspectOrgCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"4:3" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem]; + kAspectFullCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"16:9" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem]; + kAspectWideCmd = menuItem; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Aspect Ratio" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:aspectMenu]; + [menu addItem:menuItem]; + [aspectMenu release]; + + //Add to menubar + menuItem = [[NSMenuItem alloc] initWithTitle:@"Movie" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:menu]; + [[NSApp mainMenu] addItem:menuItem]; + +//Create Window Menu + menu = [[NSMenu alloc] initWithTitle:@"Window"]; + + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [menu addItem:menuItem]; + menuItem = [[NSMenuItem alloc] initWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""]; [menu addItem:menuItem]; + + //Add to menubar + menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:menu]; + [[NSApp mainMenu] addItem:menuItem]; + [NSApp setWindowsMenu:menu]; + + [menu release]; + [menuItem release]; +} + +/* + Menu Action + */ +- (void)menuAction:(id)sender +{ + uint32_t d_width; + uint32_t d_height; + NSRect frame; + + aspect((int *)&d_width, (int *)&d_height,A_NOZOOM); + + if(sender == kQuitCmd) + { + mplayer_put_key(KEY_ESC); + } + + if(sender == kHalfScreenCmd) + { + if(isFullscreen) { + vo_fs = (!(vo_fs)); [self fullscreen:NO]; + } + + winSizeMult = 0.5; + frame.size.width = (d_width*winSizeMult); + frame.size.height = ((d_width/movie_aspect)*winSizeMult); + [window setContentSize: frame.size]; + [self reshape]; + } + if(sender == kNormalScreenCmd) + { + if(isFullscreen) { + vo_fs = (!(vo_fs)); [self fullscreen:NO]; + } + + winSizeMult = 1; + frame.size.width = d_width; + frame.size.height = d_width/movie_aspect; + [window setContentSize: frame.size]; + [self reshape]; + } + if(sender == kDoubleScreenCmd) + { + if(isFullscreen) { + vo_fs = (!(vo_fs)); [self fullscreen:NO]; + } + + winSizeMult = 2; + frame.size.width = d_width*winSizeMult; + frame.size.height = (d_width/movie_aspect)*winSizeMult; + [window setContentSize: frame.size]; + [self reshape]; + } + if(sender == kFullScreenCmd) + { + vo_fs = (!(vo_fs)); + [self fullscreen:NO]; + } + + if(sender == kKeepAspectCmd) + { + vo_keepaspect = (!(vo_keepaspect)); + if(vo_keepaspect) + [kKeepAspectCmd setState:NSOnState]; + else + [kKeepAspectCmd setState:NSOffState]; + + [self reshape]; + } + + if(sender == kPanScanCmd) + { + vo_panscan = (!(vo_panscan)); + if(vo_panscan) + [kPanScanCmd setState:NSOnState]; + else + [kPanScanCmd setState:NSOffState]; + + [self panscan]; + } + + if(sender == kAspectOrgCmd) + { + movie_aspect = old_movie_aspect; + + if(isFullscreen) + { + [self reshape]; + } + else + { + frame.size.width = d_width*winSizeMult; + frame.size.height = (d_width/movie_aspect)*winSizeMult; + [window setContentSize: frame.size]; + [self reshape]; + } + } + + if(sender == kAspectFullCmd) + { + movie_aspect = 4.0f/3.0f; + + if(isFullscreen) + { + [self reshape]; + } + else + { + frame.size.width = d_width*winSizeMult; + frame.size.height = (d_width/movie_aspect)*winSizeMult; + [window setContentSize: frame.size]; + [self reshape]; + } + } + + if(sender == kAspectWideCmd) + { + movie_aspect = 16.0f/9.0f; + + if(isFullscreen) + { + [self reshape]; + } + else + { + frame.size.width = d_width*winSizeMult; + frame.size.height = (d_width/movie_aspect)*winSizeMult; + [window setContentSize: frame.size]; + [self reshape]; + } + } +} + +/* + Setup OpenGL +*/ +- (void)prepareOpenGL +{ + glEnable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + glDepthMask(GL_FALSE); + glDisable(GL_CULL_FACE); + [self reshape]; +} + +/* + reshape OpenGL viewport +*/ +- (void)reshape +{ + uint32_t d_width; + uint32_t d_height; + float aspectX; + float aspectY; + int padding = 0; + + NSRect frame = [self frame]; + + glViewport(0, 0, frame.size.width, frame.size.height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, frame.size.width, frame.size.height, 0, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + //set texture frame + if(vo_keepaspect) + { + aspect( (int *)&d_width, (int *)&d_height, A_NOZOOM); + d_height = ((float)d_width/movie_aspect); + + aspectX = (float)((float)frame.size.width/(float)d_width); + aspectY = (float)((float)(frame.size.height)/(float)d_height); + + if((d_height*aspectX)>(frame.size.height)) + { + padding = (frame.size.width - d_width*aspectY)/2; + textureFrame = NSMakeRect(padding, 0, d_width*aspectY, d_height*aspectY); + } + else + { + padding = ((frame.size.height) - d_height*aspectX)/2; + textureFrame = NSMakeRect(0, padding, d_width*aspectX, d_height*aspectX); + } + } + else + { + textureFrame = frame; + } + vo_dwidth = textureFrame.size.width; + vo_dheight = textureFrame.size.height; +} + +/* + Render frame +*/ +- (void) render +{ + int curTime; + + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(CVOpenGLTextureGetTarget(texture)); + glBindTexture(CVOpenGLTextureGetTarget(texture), CVOpenGLTextureGetName(texture)); + + glColor3f(1,1,1); + glBegin(GL_QUADS); + glTexCoord2f(upperLeft[0], upperLeft[1]); glVertex2i( textureFrame.origin.x-(vo_panscan_x >> 1), textureFrame.origin.y-(vo_panscan_y >> 1)); + glTexCoord2f(lowerLeft[0], lowerLeft[1]); glVertex2i(textureFrame.origin.x-(vo_panscan_x >> 1), NSMaxY(textureFrame)+(vo_panscan_y >> 1)); + glTexCoord2f(lowerRight[0], lowerRight[1]); glVertex2i(NSMaxX(textureFrame)+(vo_panscan_x >> 1), NSMaxY(textureFrame)+(vo_panscan_y >> 1)); + glTexCoord2f(upperRight[0], upperRight[1]); glVertex2i(NSMaxX(textureFrame)+(vo_panscan_x >> 1), textureFrame.origin.y-(vo_panscan_y >> 1)); + glEnd(); + glDisable(CVOpenGLTextureGetTarget(texture)); + + //render resize box + if(!isFullscreen) + { + NSRect frame = [self frame]; + + glBegin(GL_LINES); + glColor4f(0.2, 0.2, 0.2, 0.5); + glVertex2i(frame.size.width-1, frame.size.height-1); glVertex2i(frame.size.width-1, frame.size.height-1); + glVertex2i(frame.size.width-1, frame.size.height-5); glVertex2i(frame.size.width-5, frame.size.height-1); + glVertex2i(frame.size.width-1, frame.size.height-9); glVertex2i(frame.size.width-9, frame.size.height-1); + + glColor4f(0.4, 0.4, 0.4, 0.5); + glVertex2i(frame.size.width-1, frame.size.height-2); glVertex2i(frame.size.width-2, frame.size.height-1); + glVertex2i(frame.size.width-1, frame.size.height-6); glVertex2i(frame.size.width-6, frame.size.height-1); + glVertex2i(frame.size.width-1, frame.size.height-10); glVertex2i(frame.size.width-10, frame.size.height-1); + + glColor4f(0.6, 0.6, 0.6, 0.5); + glVertex2i(frame.size.width-1, frame.size.height-3); glVertex2i(frame.size.width-3, frame.size.height-1); + glVertex2i(frame.size.width-1, frame.size.height-7); glVertex2i(frame.size.width-7, frame.size.height-1); + glVertex2i(frame.size.width-1, frame.size.height-11); glVertex2i(frame.size.width-11, frame.size.height-1); + glEnd(); + } + + glFlush(); + + curTime = TickCount()/60; + + //automatically hide mouse cursor (and future on-screen control?) + if(isFullscreen && !mouseHide && !isRootwin) + { + if( ((curTime - lastMouseHide) >= 5) || (lastMouseHide == 0) ) + { + CGDisplayHideCursor(kCGDirectMainDisplay); + mouseHide = TRUE; + lastMouseHide = curTime; + } + } + + //update activity every 30 seconds to prevent + //screensaver from starting up. + if( ((curTime - lastScreensaverUpdate) >= 30) || (lastScreensaverUpdate == 0) ) + { + UpdateSystemActivity(UsrActivity); + lastScreensaverUpdate = curTime; + } +} + +/* + Create OpenGL texture from current frame & set texco +*/ +- (void) setCurrentTexture +{ + CVReturn error = kCVReturnSuccess; + + CVOpenGLTextureRelease(texture); + error = CVOpenGLTextureCacheCreateTextureFromImage(NULL, textureCache, frameBuffers[image_page], 0, &texture); + if(error != kCVReturnSuccess) + mp_msg(MSGT_VO, MSGL_ERR,"[vo_corevideo] Failed to create OpenGL texture(%d)\n", error); + + CVOpenGLTextureGetCleanTexCoords(texture, lowerLeft, lowerRight, upperRight, upperLeft); +} + +/* + redraw win rect +*/ +- (void) drawRect: (NSRect *) bounds +{ + [self render]; +} + +/* + Toggle Fullscreen +*/ +- (void) fullscreen: (BOOL) animate +{ + static NSRect old_frame; + static NSRect old_view_frame; + + panscan_calc(); + + //go fullscreen + if(vo_fs) + { + if(!isRootwin) + { + SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); + CGDisplayHideCursor(kCGDirectMainDisplay); + mouseHide = YES; + } + + old_frame = [window frame]; //save main window size & position + if(screen_id >= 0) + screen_frame = [screen_handle frame]; + else { + screen_frame = [[window screen] frame]; + vo_screenwidth = screen_frame.size.width; + vo_screenheight = screen_frame.size.height; + } + + [window setFrame:screen_frame display:YES animate:animate]; //zoom-in window with nice useless sfx + old_view_frame = [self bounds]; + + //fix origin for multi screen setup + screen_frame.origin.x = 0; + screen_frame.origin.y = 0; + [self setFrame:screen_frame]; + [self setNeedsDisplay:YES]; + [window setHasShadow:NO]; + isFullscreen = 1; + } + else + { + SetSystemUIMode( kUIModeNormal, 0); + + isFullscreen = 0; + CGDisplayShowCursor(kCGDirectMainDisplay); + mouseHide = NO; + + //revert window to previous setting + [self setFrame:old_view_frame]; + [self setNeedsDisplay:YES]; + [window setHasShadow:YES]; + [window setFrame:old_frame display:YES animate:animate];//zoom-out window with nice useless sfx + } +} + +/* + Toggle ontop +*/ +- (void) ontop +{ + if(vo_ontop) + { + [window setLevel:NSScreenSaverWindowLevel]; + isOntop = YES; + } + else + { + [window setLevel:NSNormalWindowLevel]; + isOntop = NO; + } +} + +/* + Toggle panscan +*/ +- (void) panscan +{ + panscan_calc(); +} + +/* + Toggle rootwin + */ +- (void) rootwin +{ + if(vo_rootwin) + { + [window setLevel:CGWindowLevelForKey(kCGDesktopWindowLevelKey)]; + [window orderBack:self]; + isRootwin = YES; + } + else + { + [window setLevel:NSNormalWindowLevel]; + isRootwin = NO; + } +} + +/* + Check event for new event +*/ +- (void) check_events +{ + event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0.0001] inMode:NSEventTrackingRunLoopMode dequeue:YES]; + if (event == nil) + return; + [NSApp sendEvent:event]; + // Without SDL's bootstrap code (include SDL.h in mplayer.c), + // on Leopard, we have trouble to get the play window automatically focused + // when the app is actived. The Following code fix this problem. +#ifndef CONFIG_SDL + if (isLeopardOrLater && [event type] == NSAppKitDefined + && [event subtype] == NSApplicationActivatedEventType) { + [window makeMainWindow]; + [window makeKeyAndOrderFront:mpGLView]; + } +#endif +} + +/* + From NSView, respond to key equivalents. +*/ +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent +{ + switch([theEvent keyCode]) + { + case 0x21: [window setAlphaValue: winAlpha-=0.05]; return YES; + case 0x1e: [window setAlphaValue: winAlpha+=0.05]; return YES; + } + return NO; +} + +/* + Process key event +*/ +- (void) keyDown: (NSEvent *) theEvent +{ + unsigned int key; + + switch([theEvent keyCode]) + { + case 0x34: + case 0x24: key = KEY_ENTER; break; + case 0x35: key = KEY_ESC; break; + case 0x33: key = KEY_BACKSPACE; break; + case 0x3A: key = KEY_BACKSPACE; break; + case 0x3B: key = KEY_BACKSPACE; break; + case 0x38: key = KEY_BACKSPACE; break; + case 0x7A: key = KEY_F+1; break; + case 0x78: key = KEY_F+2; break; + case 0x63: key = KEY_F+3; break; + case 0x76: key = KEY_F+4; break; + case 0x60: key = KEY_F+5; break; + case 0x61: key = KEY_F+6; break; + case 0x62: key = KEY_F+7; break; + case 0x64: key = KEY_F+8; break; + case 0x65: key = KEY_F+9; break; + case 0x6D: key = KEY_F+10; break; + case 0x67: key = KEY_F+11; break; + case 0x6F: key = KEY_F+12; break; + case 0x72: key = KEY_INSERT; break; + case 0x75: key = KEY_DELETE; break; + case 0x73: key = KEY_HOME; break; + case 0x77: key = KEY_END; break; + case 0x45: key = '+'; break; + case 0x4E: key = '-'; break; + case 0x30: key = KEY_TAB; break; + case 0x74: key = KEY_PAGE_UP; break; + case 0x79: key = KEY_PAGE_DOWN; break; + case 0x7B: key = KEY_LEFT; break; + case 0x7C: key = KEY_RIGHT; break; + case 0x7D: key = KEY_DOWN; break; + case 0x7E: key = KEY_UP; break; + case 0x43: key = '*'; break; + case 0x4B: key = '/'; break; + case 0x4C: key = KEY_KPENTER; break; + case 0x41: key = KEY_KPDEC; break; + case 0x52: key = KEY_KP0; break; + case 0x53: key = KEY_KP1; break; + case 0x54: key = KEY_KP2; break; + case 0x55: key = KEY_KP3; break; + case 0x56: key = KEY_KP4; break; + case 0x57: key = KEY_KP5; break; + case 0x58: key = KEY_KP6; break; + case 0x59: key = KEY_KP7; break; + case 0x5B: key = KEY_KP8; break; + case 0x5C: key = KEY_KP9; break; + default: key = *[[theEvent characters] UTF8String]; break; + } + mplayer_put_key(key); +} + +/* + Process mouse button event +*/ +- (void) mouseMoved: (NSEvent *) theEvent +{ + if(isFullscreen && !isRootwin) + { + CGDisplayShowCursor(kCGDirectMainDisplay); + mouseHide = NO; + } + if (enable_mouse_movements && !isRootwin) { + NSPoint p =[self convertPoint:[theEvent locationInWindow] fromView:nil]; + if ([self mouse:p inRect:textureFrame]) { + char cmdstr[40]; + snprintf(cmdstr, sizeof(cmdstr), "set_mouse_pos %i %i", + (int)(vo_fs ? p.x : (p.x - textureFrame.origin.x)), + (int)(vo_fs ? [self frame].size.height - p.y: (NSMaxY(textureFrame) - p.y))); + mp_input_queue_cmd(mp_input_parse_cmd(cmdstr)); + } + } +} + +- (void) mouseDown: (NSEvent *) theEvent +{ + [self mouseEvent: theEvent]; +} + +- (void) mouseUp: (NSEvent *) theEvent +{ + [self mouseEvent: theEvent]; +} + +- (void) rightMouseDown: (NSEvent *) theEvent +{ + [self mouseEvent: theEvent]; +} + +- (void) rightMouseUp: (NSEvent *) theEvent +{ + [self mouseEvent: theEvent]; +} + +- (void) otherMouseDown: (NSEvent *) theEvent +{ + [self mouseEvent: theEvent]; +} + +- (void) otherMouseUp: (NSEvent *) theEvent +{ + [self mouseEvent: theEvent]; +} + +- (void) scrollWheel: (NSEvent *) theEvent +{ + if([theEvent deltaY] > 0) + mplayer_put_key(MOUSE_BTN3); + else + mplayer_put_key(MOUSE_BTN4); +} + +- (void) mouseEvent: (NSEvent *) theEvent +{ + if ( [theEvent buttonNumber] >= 0 && [theEvent buttonNumber] <= 9 ) + { + int buttonNumber = [theEvent buttonNumber]; + // Fix to mplayer defined button order: left, middle, right + if (buttonNumber == 1) + buttonNumber = 2; + else if (buttonNumber == 2) + buttonNumber = 1; + switch([theEvent type]) + { + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + mplayer_put_key((MOUSE_BTN0 + buttonNumber) | MP_KEY_DOWN); + break; + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + mplayer_put_key(MOUSE_BTN0 + buttonNumber); + break; + } + } +} + +/* + NSResponder +*/ +- (BOOL) acceptsFirstResponder +{ + return YES; +} + +- (BOOL) becomeFirstResponder +{ + return YES; +} + +- (BOOL) resignFirstResponder +{ + return YES; +} + +- (void)windowWillClose:(NSNotification *)aNotification +{ + mpGLView = NULL; + mplayer_put_key(KEY_ESC); +} +@end diff --git a/libvo/vo_macosx.h b/libvo/vo_macosx.h deleted file mode 100644 index 1384d24040..0000000000 --- a/libvo/vo_macosx.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * MPlayer Mac OS X video output driver - * - * Copyright (c) 2005 Nicolas Plourde - * - * 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. - */ - -#import -#import -#import - -// MPlayer OS X VO Protocol -@protocol MPlayerOSXVOProto -- (int) startWithWidth: (bycopy int)width - withHeight: (bycopy int)height - withBytes: (bycopy int)bytes - withAspect: (bycopy int)aspect; -- (void) stop; -- (void) render; -- (void) toggleFullscreen; -- (void) ontop; -@end - -@interface MPlayerOpenGLView : NSOpenGLView -{ - //Cocoa - NSWindow *window; - NSOpenGLContext *glContext; - NSEvent *event; - - //CoreVideo - CVPixelBufferRef frameBuffers[2]; - CVOpenGLTextureCacheRef textureCache; - CVOpenGLTextureRef texture; - NSRect textureFrame; - - GLfloat lowerLeft[2]; - GLfloat lowerRight[2]; - GLfloat upperRight[2]; - GLfloat upperLeft[2]; - - BOOL mouseHide; - float winSizeMult; - - //menu command id - NSMenuItem *kQuitCmd; - NSMenuItem *kH