From c8fd9e50e47838bbdb0dc5e0b974091312cb8833 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 31 Mar 2013 11:03:04 +0200 Subject: [PATCH] remove Apple Remote related code The OSX part of the Apple Remote was unmaintained for a long time and was not working anymore. I tried to update the cookies to what the current versions of OS X expect without much luck. I decided to remove it since Apple is not including the IR receiver anymore in new hardware and it's clear that wifi based remotes are the way to go. A third party iOS app should be used in it's place. In the future we could look into having a dedicated iOS Remote Control app like VLC and XBMC do. The Linux side (`appleir.c`) was relatively tidy but it looks like LIRC can be configured to work with any version of Apple Remote [1] and is more maintained. [1] LIRC Apple Remote configs: http://lirc.sourceforge.net/remotes/apple/ --- DOCS/man/en/options.rst | 3 - Makefile | 2 - configure | 65 ------ core/defaultopts.c | 3 - core/input/appleir.c | 153 ------------- core/input/ar.c | 463 ---------------------------------------- core/input/ar.h | 35 --- core/input/input.c | 22 -- core/options.h | 1 - 9 files changed, 747 deletions(-) delete mode 100644 core/input/appleir.c delete mode 100644 core/input/ar.c delete mode 100644 core/input/ar.h diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 98019c0333..d64cbe8f80 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -103,9 +103,6 @@ configuration files specifying a list of fallbacks may make sense. See `audio_outputs` for details and descriptions of available drivers. ---ar, --no-ar - Enable/disable AppleIR remote support. Enabled by default. - --aspect= Override movie aspect ratio, in case aspect information is incorrect or missing in the file being played. See also ``--no-aspect``. diff --git a/Makefile b/Makefile index f15bb6849d..9bf761aa1f 100644 --- a/Makefile +++ b/Makefile @@ -80,8 +80,6 @@ SOURCES-$(DUMMY_OSD) += sub/osd_dummy.c SOURCES-$(LIBASS_OSD) += sub/osd_libass.c SOURCES-$(ALSA) += audio/out/ao_alsa.c -SOURCES-$(APPLE_IR) += core/input/appleir.c -SOURCES-$(APPLE_REMOTE) += core/input/ar.c SOURCES-$(CACA) += video/out/vo_caca.c SOURCES-$(SDL) += audio/out/ao_sdl.c SOURCES-$(SDL2) += video/out/vo_sdl.c diff --git a/configure b/configure index 875c1b91f0..7a3b9e786f 100755 --- a/configure +++ b/configure @@ -298,8 +298,6 @@ Optional features: --enable-lirc enable LIRC (remote control) support [autodetect] --enable-lircc enable LIRCCD (LIRC client daemon) input [autodetect] --enable-joystick enable joystick support [disable] - --enable-apple-remote enable Apple Remote input (Mac OS X only) [autodetect] - --enable-apple-ir enable Apple IR Remote input (Linux only) [autodetect] --disable-vm disable X video mode extensions [autodetect] --disable-xf86keysym disable support for multimedia keys [autodetect] --enable-radio enable radio interface [disable] @@ -468,8 +466,6 @@ _libquvi=auto _joystick=no _lirc=auto _lircc=auto -_apple_remote=auto -_apple_ir=auto _termcap=auto _termios=auto _shm=auto @@ -678,10 +674,6 @@ for ac_option do --disable-lirc) _lirc=no ;; --enable-lircc) _lircc=yes ;; --disable-lircc) _lircc=no ;; - --enable-apple-remote) _apple_remote=yes ;; - --disable-apple-remote) _apple_remote=no ;; - --enable-apple-ir) _apple_ir=yes ;; - --disable-apple-ir) _apple_ir=no ;; --enable-termcap) _termcap=yes ;; --disable-termcap) _termcap=no ;; --enable-termios) _termios=yes ;; @@ -1686,60 +1678,8 @@ if test "$_macosx_bundle" = yes ; then fi echores "$_macosx_bundle" -echocheck "Apple Remote" -if test "$_apple_remote" = auto ; then - _apple_remote=no - cat > $TMPC < -#include -int main(void) { - io_iterator_t hidObjectIterator = (io_iterator_t)NULL; - CFMutableDictionaryRef hidMatchDictionary; - IOReturn ioReturnValue; - - // Set up a matching dictionary to search the I/O Registry by class. - // name for all HID class devices - hidMatchDictionary = IOServiceMatching("AppleIRController"); - - // Now search I/O Registry for matching devices. - ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault, - hidMatchDictionary, &hidObjectIterator); - - // If search is unsuccessful, return nonzero. - if (ioReturnValue != kIOReturnSuccess || - !IOIteratorIsValid(hidObjectIterator)) { - return 1; - } - return 0; -} -EOF - cc_check -framework IOKit && _apple_remote=yes -fi -if test "$_apple_remote" = yes ; then - def_apple_remote='#define CONFIG_APPLE_REMOTE 1' - libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa" -else - def_apple_remote='#undef CONFIG_APPLE_REMOTE' -fi -echores "$_apple_remote" - fi #if darwin -if linux; then - -echocheck "Apple IR" -if test "$_apple_ir" = auto ; then - _apple_ir=no - statement_check linux/input.h 'struct input_event ev; struct input_id id' && _apple_ir=yes -fi -if test "$_apple_ir" = yes ; then - def_apple_ir='#define CONFIG_APPLE_IR 1' -else - def_apple_ir='#undef CONFIG_APPLE_IR' -fi -echores "$_apple_ir" -fi #if linux - echocheck "pkg-config" if $($_pkg_config --version > /dev/null 2>&1); then if test "$_ld_static"; then @@ -3063,9 +3003,6 @@ NEED_SHMEM = $need_shmem # features ALSA = $_alsa -APPLE_IR = $_apple_ir -APPLE_REMOTE = $_apple_remote -AUDIO_INPUT = $_audio_input CACA = $_caca CDDA = $_cdda CDDB = $_cddb @@ -3277,8 +3214,6 @@ $def_libbs2b /* input */ -$def_apple_ir -$def_apple_remote $def_joystick $def_lirc $def_lircc diff --git a/core/defaultopts.c b/core/defaultopts.c index 36170df725..6c00af9a92 100644 --- a/core/defaultopts.c +++ b/core/defaultopts.c @@ -94,9 +94,6 @@ void set_default_mplayer_options(struct MPOpts *opts) .use_joystick = 1, .use_lirc = 1, .use_lircc = 1, -#ifdef CONFIG_APPLE_REMOTE - .use_ar = 1, -#endif .default_bindings = 1, } }; diff --git a/core/input/appleir.c b/core/input/appleir.c deleted file mode 100644 index e645ba736a..0000000000 --- a/core/input/appleir.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Linux Apple IR Remote input interface - * - * Copyright (C) 2008 Benjamin Zores - * - * 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. - */ - -#include "config.h" - -#include "ar.h" -#include "input.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "core/mp_msg.h" - -#include "keycodes.h" - -#define EVDEV_MAX_EVENTS 32 - -/* ripped from AppleIR driver */ -#define USB_VENDOR_APPLE 0x05ac -#define USB_DEV_APPLE_IR 0x8240 -#define USB_DEV_APPLE_IR_2 0x8242 - -/* Apple IR Remote evdev mapping */ -#define APPLE_IR_MINUS KEY_VOLUMEDOWN -#define APPLE_IR_PLUS KEY_VOLUMEUP -#define APPLE_IR_MENU KEY_MENU -#define APPLE_IR_FORWARD KEY_NEXTSONG -#define APPLE_IR_PLAY KEY_PLAYPAUSE -#define APPLE_IR_BACKWARD KEY_PREVIOUSSONG - -static const struct { - int linux_keycode; - int value; - int mp_keycode; -} apple_ir_mapping[] = { - { APPLE_IR_PLAY, 1, MP_AR_PLAY }, - { APPLE_IR_PLAY, 2, MP_AR_PLAY_HOLD }, - { APPLE_IR_FORWARD, 1, MP_AR_NEXT }, - { APPLE_IR_FORWARD, 2, MP_AR_NEXT_HOLD }, - { APPLE_IR_BACKWARD, 1, MP_AR_PREV }, - { APPLE_IR_BACKWARD, 2, MP_AR_PREV_HOLD }, - { APPLE_IR_MENU, 1, MP_AR_MENU }, - { APPLE_IR_MENU, 2, MP_AR_MENU_HOLD }, - { APPLE_IR_PLUS, 1, MP_AR_VUP }, - { APPLE_IR_MINUS, 1, MP_AR_VDOWN }, - { -1, -1, -1 } -}; - -int mp_input_appleir_init (char *dev) -{ - int i, fd; - - if (dev) - { - mp_tmsg (MSGT_INPUT, MSGL_V, "Initializing Apple IR on %s\n", dev); - fd = open (dev, O_RDONLY | O_NONBLOCK); - if (fd < 0) - { - mp_tmsg (MSGT_INPUT, MSGL_ERR, - "Can't open Apple IR device: %s\n", strerror (errno)); - return -1; - } - - return fd; - } - else - { - /* look for a valid AppleIR device on system */ - for (i = 0; i < EVDEV_MAX_EVENTS; i++) - { - struct input_id id; - char file[64]; - - sprintf (file, "/dev/input/event%d", i); - fd = open (file, O_RDONLY | O_NONBLOCK); - if (fd < 0) - continue; - - ioctl (fd, EVIOCGID, &id); - if (id.bustype == BUS_USB && - id.vendor == USB_VENDOR_APPLE && - (id.product == USB_DEV_APPLE_IR ||id.product == USB_DEV_APPLE_IR_2)) - { - mp_tmsg (MSGT_INPUT, MSGL_V, "Detected Apple IR on %s\n", file); - return fd; - } - close (fd); - } - - mp_tmsg (MSGT_INPUT, MSGL_ERR, - "Can't open Apple IR device: %s\n", strerror (errno)); - } - - return -1; -} - -int mp_input_appleir_read(void *ctx, int fd) -{ - struct input_event ev; - int i, r; - - r = read (fd, &ev, sizeof (struct input_event)); - if (r <= 0 || r < sizeof (struct input_event)) - return MP_INPUT_NOTHING; - - /* check for key press only */ - if (ev.type != EV_KEY) - return MP_INPUT_NOTHING; - - /* EvDev Key values: - * 0: key release - * 1: key press - * 2: key auto-repeat - */ - if (ev.value == 0) - return MP_INPUT_NOTHING; - - /* find Linux evdev -> MPlayer keycode mapping */ - for (i = 0; apple_ir_mapping[i].linux_keycode != -1; i++) - if (apple_ir_mapping[i].linux_keycode == ev.code && - apple_ir_mapping[i].value == ev.value) - return apple_ir_mapping[i].mp_keycode; - - return MP_INPUT_NOTHING; -} diff --git a/core/input/ar.c b/core/input/ar.c deleted file mode 100644 index c8b62bf8ca..0000000000 --- a/core/input/ar.c +++ /dev/null @@ -1,463 +0,0 @@ -/* - * Apple Remote input interface - * - * Copyright (C) 2007 Zoltan Ponekker - * - * (modified a bit by Ulion ) - * - * 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. - */ - -#include -#include -#include - -#include -#include - -#include "input.h" -#include "ar.h" -#include "keycodes.h" - -extern const double NSAppKitVersionNumber; - -typedef struct cookie_keycode_map { - char *cookies; - int seq_len; - int keycode; -} cookie_keycode_map_t; - -/* On tiger, 5 always follows 6; on leopard, 18 always follows 19. - * On leopard, there seems to be no cookie value of 5 or 6. - * Following is the shortened cookie sequence list - * keycode cookies_on_tiger cookies_on_leopard *down_state - * AR_PREV_HOLD 14+6+3+2 31+19+3+2 yes - * AR_NEXT_HOLD 14+6+4+2 31+19+4+2 yes - * AR_MENU_HOLD 14+6+14+6 31+19+31+19 - * AR_VUP 14+12+11+6 31+29+28+19 yes - * AR_VDOWN 14+13+11+6 31+30+28+19 yes - * AR_MENU 14+7+6+14+7+6 31+20+19+31+20+19 - * AR_PLAY 14+8+6+14+8+6 31+21+19+31+21+19 - * AR_NEXT 14+9+6+14+9+6 31+22+19+31+22+19 - * AR_PREV 14+10+6+14+10+6 31+23+19+31+23+19 - * AR_PLAY_HOLD 18+14+6+18+14+6 35+31+19+35+31+19 - * - * *down_state: A button with this feature has a pressed event and - * a released event, with which we can trace the state of the button. - * A button without this feature will only return one release event. - * - * hidden keys currently not implemented: - * hold for 5 secs - * MENU_NEXT_HOLD 15+14+6+15+14+6 - * MENU_PREV_HOLD 16+14+6+16+14+6 - * MENU_VUP_HOLD 20+14+6+20+14+6 - * MENU_VDOWN_HOLD 19+14+6+19+14+6 - * - * It seems that pressing 'menu' and 'play' on the Apple Remote for - * 5 seconds will trigger the make-pair function of the remote. - * MENU_PLAY_HOLD 21+15+14+6+15+14+6 - */ - -static const cookie_keycode_map_t ar_codes_tiger[] = { - { "\x0E\x06\x03\x02", 4, MP_AR_PREV_HOLD }, - { "\x0E\x06\x04\x02", 4, MP_AR_NEXT_HOLD }, - { "\x0E\x06\x0E\x06", 4, MP_AR_MENU_HOLD }, - { "\x0E\x0C\x0B\x06", 4, MP_AR_VUP }, - { "\x0E\x0D\x0B\x06", 4, MP_AR_VDOWN }, - { "\x0E\x07\x06\x0E\x07\x06", 6, MP_AR_MENU }, - { "\x0E\x08\x06\x0E\x08\x06", 6, MP_AR_PLAY }, - { "\x0E\x09\x06\x0E\x09\x06", 6, MP_AR_NEXT }, - { "\x0E\x0A\x06\x0E\x0A\x06", 6, MP_AR_PREV }, - { "\x12\x0E\x06\x12\x0E\x06", 6, MP_AR_PLAY_HOLD }, - { NULL, 0, MP_INPUT_NOTHING }, -}; - -static const cookie_keycode_map_t ar_codes_leopard[] = { - { "\x1F\x13\x03\x02", 4, MP_AR_PREV_HOLD }, - { "\x1F\x13\x04\x02", 4, MP_AR_NEXT_HOLD }, - { "\x1F\x13\x1F\x13", 4, MP_AR_MENU_HOLD }, - { "\x1F\x1D\x1C\x13", 4, MP_AR_VUP }, - { "\x1F\x1E\x1C\x13", 4, MP_AR_VDOWN }, - { "\x1F\x14\x13\x1F\x14\x13", 6, MP_AR_MENU }, - { "\x1F\x15\x13\x1F\x15\x13", 6, MP_AR_PLAY }, - { "\x1F\x16\x13\x1F\x16\x13", 6, MP_AR_NEXT }, - { "\x1F\x17\x13\x1F\x17\x13", 6, MP_AR_PREV }, - { "\x23\x1F\x13\x23\x1F\x13", 6, MP_AR_PLAY_HOLD }, - { NULL, 0, MP_INPUT_NOTHING }, -}; - -static int is_leopard; -static const cookie_keycode_map_t *ar_codes; - -static IOHIDQueueInterface **queue; -static IOHIDDeviceInterface **hidDeviceInterface = NULL; -static int initialized = 0; -static int hidDeviceIsOpen; - -/* Maximum number of elements in queue before oldest elements - in queue begin to be lost. Set to 16 to hold at least 2 events. */ -static const int MAX_QUEUE_SIZE = 16; - - -static int FindHIDDevices(mach_port_t masterPort, - io_iterator_t *hidObjectIterator) -{ - CFMutableDictionaryRef hidMatchDictionary; - IOReturn ioReturnValue; - - // Set up a matching dictionary to search the I/O Registry - // by class name for all HID class devices. - hidMatchDictionary = IOServiceMatching("AppleIRController"); - - // Now search I/O Registry for matching devices. - ioReturnValue = IOServiceGetMatchingServices(masterPort, - hidMatchDictionary, - hidObjectIterator); - - // If search is unsuccessful, print message and hang. - if (ioReturnValue != kIOReturnSuccess || - !IOIteratorIsValid(*hidObjectIterator)) { - return -1; - } - return 0; -} - -static int getHIDCookies(IOHIDDeviceInterface122 **handle, - IOHIDElementCookie **cookies, - int *nr_cookies) -{ - CFTypeRef object; - long number; - CFArrayRef elements; - CFDictionaryRef element; - CFIndex i; - - *nr_cookies = 0; - - if (!handle || !(*handle)) - return -1; - - // Copy all elements, since we're grabbing most of the elements - // for this device anyway, and thus, it's faster to iterate them - // ourselves. When grabbing only one or two elements, a matching - // dictionary should be passed in here instead of NULL. - if (((*handle)->copyMatchingElements(handle, NULL, &elements)) != kIOReturnSuccess) - return -1; - - // No elements, still a valid result. - if (CFArrayGetCount(elements)==0) - return 0; - - *cookies = calloc(CFArrayGetCount(elements), sizeof(IOHIDElementCookie)); - if (*cookies == NULL) - return -1; - - for (i=0; iQueryInterface(plugInInterface, - CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), - (LPVOID)hidDeviceInterface) != S_OK - || *hidDeviceInterface == NULL || **hidDeviceInterface == NULL) { - (*plugInInterface)->Release(plugInInterface); - return -1; - } - - (*plugInInterface)->Release(plugInInterface); - - return 0; -} - -int mp_input_ar_init(void) -{ - io_iterator_t hidObjectIterator; - io_object_t hidDevice; - int i; - IOHIDElementCookie *cookies = NULL; - int nr_cookies = 0; - - if (initialized) - mp_input_ar_close(-1); - - if (floor(NSAppKitVersionNumber) <= 824 /* NSAppKitVersionNumber10_4 */) { - ar_codes = &ar_codes_tiger[0]; - is_leopard = 0; - } - else { - ar_codes = &ar_codes_leopard[0]; - is_leopard = 1; - } - - if (FindHIDDevices(kIOMasterPortDefault, &hidObjectIterator)) - return -1; - - // Multiple controls could be found, we only use the first usable one. - while ((hidDevice = IOIteratorNext(hidObjectIterator))) { - if (CreateHIDDeviceInterface(hidDevice, &hidDeviceInterface) < 0) { - hidDeviceInterface = NULL; - IOObjectRelease(hidDevice); - continue; - } - if (getHIDCookies((IOHIDDeviceInterface122 **)hidDeviceInterface, - &cookies, - &nr_cookies) < 0) { - (*hidDeviceInterface)->Release(hidDeviceInterface); - hidDeviceInterface = NULL; - IOObjectRelease(hidDevice); - continue; - } - IOObjectRelease(hidDevice); - break; - } - if (hidDeviceInterface == NULL) - goto mp_input_ar_init_error; - - // Open the device. - if ((*hidDeviceInterface)->open(hidDeviceInterface, - kIOHIDOptionsTypeSeizeDevice) != kIOReturnSuccess) - goto mp_input_ar_init_error; - hidDeviceIsOpen = 1; - - if ((queue = (*hidDeviceInterface)->allocQueue(hidDeviceInterface)) == NULL - || *queue == NULL) - goto mp_input_ar_init_error; - - // Create the queue. - (*queue)->create(queue, 0, MAX_QUEUE_SIZE); - - // Add elements to the queue to make the queue work. - // On tiger, it's a sequence from 1 to 21, - // maybe it's the range of cookie values. - for (i = 0;i < nr_cookies;i++) - (*queue)->addElement(queue, cookies[i], 0); - - // not used anymore - free(cookies); - - // Start data delivery to the queue. - (*queue)->start(queue); - - // not useful anymore - IOObjectRelease(hidObjectIterator); - - initialized = 1; - return 0; - -mp_input_ar_init_error: - free(cookies); - if (hidDeviceInterface != NULL) { - if (*hidDeviceInterface != NULL) { - (*hidDeviceInterface)->close(hidDeviceInterface); - (*hidDeviceInterface)->Release(hidDeviceInterface); - } - hidDeviceInterface = NULL; - } - IOObjectRelease(hidObjectIterator); - return -1; -} - -static int is_mplayer_front(void) -{ - ProcessSerialNumber myProc, frProc; - Boolean sameProc; - - if (GetFrontProcess(&frProc) == noErr - && GetCurrentProcess(&myProc) == noErr - && SameProcess(&frProc, &myProc, &sameProc) == noErr) { - if (sameProc) - return 1; - } - return 0; -} - -int mp_input_ar_read(void *ctx, int fd) -{ - int i, down = 0; - int ret = MP_INPUT_NOTHING; - AbsoluteTime zeroTime = {0,0}; - IOHIDEventStruct event; - static int prev_event = 0; - IOReturn result = kIOReturnSuccess; - - const cookie_keycode_map_t *ar_code; - int cookie_nr = 0; - char cookie_queue[MAX_QUEUE_SIZE]; - int value_queue[MAX_QUEUE_SIZE]; - - if (initialized == 0) - return MP_INPUT_NOTHING; - - while ((result = (*queue)->getNextEvent(queue, &event, zeroTime, 0)) == kIOReturnSuccess) { -#ifdef TEST - printf(" - event cookie: %d, value: %d, long value: %d\n", - (int)event.elementCookie, (int)event.value, (int)event.longValue); -#endif - // Shorten cookie sequence by removing cookies value 5 and 18, - // since 5 always follows 6 (on tiger), 18 follows 19 (on leopard). - if ((int)event.elementCookie == 5 - || ((int)event.elementCookie == 18 && is_leopard)) - continue; - // Check valid cookie range. - if ((int)event.elementCookie > 35 || (int)event.elementCookie < 2) { - cookie_nr = 0; - continue; - } - cookie_queue[cookie_nr] = (char)(int)event.elementCookie; - value_queue[cookie_nr++] = event.value; - // 4 cookies are necessary to make up a valid sequence. - if (cookie_nr>=4) { - // Find matching sequence. - ar_code = ar_codes; - while (ar_code->cookies != NULL && - (cookie_nr < ar_code->seq_len || - 0 != memcmp(ar_code->cookies, - &cookie_queue[cookie_nr-ar_code->seq_len], - ar_code->seq_len))) - ++ar_code; - if (ar_code->cookies != NULL) { - ret = ar_code->keycode; - switch (ret) { - // For these 4 keys, the remote can keep a hold state. - case MP_AR_VUP: - case MP_AR_VDOWN: - case MP_AR_NEXT_HOLD: - case MP_AR_PREV_HOLD: - for (i = cookie_nr-ar_code->seq_len; i < cookie_nr; ++i) { - if (value_queue[i]) { - down = MP_KEY_STATE_DOWN; - break; - } - } - break; - default: - down = 0; - } - } - } - } - - if (!is_mplayer_front()) { - if (hidDeviceIsOpen) { - (*hidDeviceInterface)->close(hidDeviceInterface); - hidDeviceIsOpen = 0; - - // Read out all pending events. - while (result == kIOReturnSuccess) - result = (*queue)->getNextEvent(queue, &event, zeroTime, 0); - } - return MP_INPUT_NOTHING; - } - // If we are switched from running as a foreground process to a - // background process and back again, re-open the device to make - // sure we are not affected by the system or other applications - // using the Apple Remote. - else if (!hidDeviceIsOpen) { - if ((*hidDeviceInterface)->open(hidDeviceInterface, - kIOHIDOptionsTypeSeizeDevice) == kIOReturnSuccess) - hidDeviceIsOpen = 1; - } - - if (ret > 0) - prev_event = ret; - return ret | down; -} - -int mp_input_ar_close(int fd) -{ - if (initialized == 0) - return 0; - - // Close the device. - (*hidDeviceInterface)->close(hidDeviceInterface); - - // Stop data delivery to queue. - (*queue)->stop(queue); - // Dispose of queue. - (*queue)->dispose(queue); - // Release the queue we allocated. - (*queue)->Release(queue); - - // Release the interface. - (*hidDeviceInterface)->Release(hidDeviceInterface); - - initialized = 0; - return 0; -} - -#ifdef TEST -int main(void) -{ - int ret; - - if (mp_input_ar_init() < 0) { - printf("Unable to initialize Apple Remote.\n"); - return 1; - } - - while (1) { - switch ((ret = mp_input_ar_read(NULL, 0)) & ~MP_KEY_STATE_DOWN) { - case MP_AR_PLAY: printf(" - MP_AR_PLAY."); break; - case MP_AR_PLAY_HOLD: printf(" - MP_AR_PLAY_HOLD."); break; - case MP_AR_NEXT: printf(" - MP_AR_NEXT."); break; - case MP_AR_NEXT_HOLD: printf(" - MP_AR_NEXT_HOLD."); break; - case MP_AR_PREV: printf(" - MP_AR_PREV."); break; - case MP_AR_PREV_HOLD: printf(" - MP_AR_PREV_HOLD."); break; - case MP_AR_MENU: printf(" - MP_AR_MENU."); break; - case MP_AR_MENU_HOLD: printf(" - MP_AR_MENU_HOLD."); break; - case MP_AR_VUP: printf(" - MP_AR_VUP."); break; - case MP_AR_VDOWN: printf(" - MP_AR_VDOWN."); break; - } - if ((ret > 0 )&&(ret & MP_KEY_STATE_DOWN)) - printf(" [hold]"); - if (ret > 0) - printf("\n"); - } - - mp_input_ar_close(0); - return 0; -} -#endif diff --git a/core/input/ar.h b/core/input/ar.h deleted file mode 100644 index dff6d12f8a..0000000000 --- a/core/input/ar.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Apple Remote input interface - * - * Copyright (C) 2007 Zoltan Ponekker - * - * 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. - */ - -#ifndef MPLAYER_AR_H -#define MPLAYER_AR_H - -/* MacOSX Driver */ -int mp_input_ar_init(void); -int mp_input_ar_read(void *ctx, int fd); -int mp_input_ar_close(int fd); - -/* Linux Driver */ -int mp_input_appleir_init(char* dev); -int mp_input_appleir_read(void *ctx, int fd); - -#endif /* MPLAYER_AR_H */ diff --git a/core/input/input.c b/core/input/input.c index 142740706a..275ab586b6 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -540,7 +540,6 @@ static const m_option_t mp_input_opts[] = { OPT_FLAG("joystick", input.use_joystick, CONF_GLOBAL), OPT_FLAG("lirc", input.use_lirc, CONF_GLOBAL), OPT_FLAG("lircc", input.use_lircc, CONF_GLOBAL), - OPT_FLAG("ar", input.use_ar, CONF_GLOBAL), { NULL, NULL, 0, 0, 0, 0, NULL} }; @@ -1779,27 +1778,6 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, } #endif -#ifdef CONFIG_APPLE_REMOTE - if (input_conf->use_ar) { - if (mp_input_ar_init() < 0) - mp_tmsg(MSGT_INPUT, MSGL_ERR, "Can't init Apple Remote.\n"); - else - mp_input_add_key_fd(ictx, -1, 0, mp_input_ar_read, - mp_input_ar_close, NULL); - } -#endif - -#ifdef CONFIG_APPLE_IR - if (input_conf->use_ar) { - int fd = mp_input_appleir_init(input_conf->ar_dev); - if (fd < 0) - mp_tmsg(MSGT_INPUT, MSGL_ERR, "Can't init Apple Remote.\n"); - else - mp_input_add_key_fd(ictx, fd, 1, mp_input_appleir_read, - close, NULL); - } -#endif - if (input_conf->in_file) { int mode = O_RDONLY; #ifndef __MINGW32__ diff --git a/core/options.h b/core/options.h index 4291f2d872..999f3439e9 100644 --- a/core/options.h +++ b/core/options.h @@ -219,7 +219,6 @@ typedef struct MPOpts { int use_joystick; int use_lirc; int use_lircc; - int use_ar; // apple remote int default_bindings; int test; } input;