mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
After killing the non functional AR support in c8fd9e5 I got much complaints so
this adds AR support back in (and it works). I am using the HIDRemote class by
Felix Schwarz and that part of the code is under the BSD license. I slightly
modified it replacing [NSApplication sharedApplication] with NSApp. The code
of the class is quite complex (probably because it had to deal with all the
edge cases with IOKit) but it works nicely as a black box.
In a later commit I'll remove the deprecation warnings caused by HIDRemote's
usage of Gestalt.
Check out `etc/input.conf` for the default bindings.
Apple Remote functionality is automatically compiled in when cocoa is enabled.
It can be disabled at runtime with the `--no-ar` option.
54 lines
1.8 KiB
Objective-C
54 lines
1.8 KiB
Objective-C
/*
|
|
* This file is part of mpv.
|
|
*
|
|
* mpv 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.
|
|
*
|
|
* mpv 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 mpv; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import "ar/HIDRemote.h"
|
|
#include "osdep/macosx_application.h"
|
|
|
|
struct cocoa_input_queue;
|
|
|
|
@interface InputQueue : NSObject
|
|
- (void)push:(int)keycode;
|
|
- (int) pop;
|
|
@end
|
|
|
|
@interface EventsResponder : NSObject <HIDRemoteDelegate>
|
|
- (void)handleMediaKey:(int)key;
|
|
- (NSEvent *)handleKeyDown:(NSEvent *)event;
|
|
- (void)startAppleRemote;
|
|
- (void)stopAppleRemote;
|
|
@property(nonatomic, retain) HIDRemote *remote;
|
|
@end
|
|
|
|
@interface Application : NSApplication
|
|
- (void)initialize_menu;
|
|
- (void)registerSelector:(SEL)selector forKey:(MPMenuKey)key;
|
|
- (void)stopPlayback;
|
|
|
|
@property(nonatomic, assign) struct input_ctx *inputContext;
|
|
@property(nonatomic, assign) struct mp_fifo *keyFIFO;
|
|
@property(nonatomic, retain) InputQueue *iqueue;
|
|
@property(nonatomic, retain) EventsResponder *eventsResponder;
|
|
@property(nonatomic, retain) NSMutableDictionary *menuItems;
|
|
@property(nonatomic, retain) NSArray *files;
|
|
@property(nonatomic, retain) NSMutableArray *argumentsList;
|
|
@property(nonatomic, assign) BOOL willStopOnOpenEvent;
|
|
@end
|
|
|
|
Application *mpv_shared_app(void);
|