mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 18:42:09 +00:00
c5e4538bc4
this is meant to replace the old and not properly working vo_gpu/opengl cocoa backend in the future. the problems are various shortcomings of Apple's opengl implementation and buggy behaviour in certain circumstances that couldn't be properly worked around. there are also certain regressions on newer macOS versions from 10.11 onwards. - awful opengl performance with a none layer backed context - huge amount of dropped frames with an early context flush - flickering of system elements like the dock or volume indicator - double buffering not properly working with a none layer backed context - bad performance in fullscreen because of system optimisations all the problems were caused by using a normal opengl context, that seems somewhat abandoned by apple, and are fixed by using a layer backed opengl context instead. problems that couldn't be fixed could be properly worked around. this has all features our old backend has sans the wid embedding, the possibility to disable the automatic GPU switching and taking screenshots of the window content. the first was deemed unnecessary by me for now, since i just use the libmpv API that others can use anyway. second is technically not possible atm because we have to pre-allocate our opengl context at a time the config isn't read yet, so we can't get the needed property. third one is a bit tricky because of deadlocking and it needed to be in sync, hopefully i can work around that in the future. this also has at least one additional feature or eye-candy. a properly working fullscreen animation with the native fs. also since this is a direct port of the old backend of the parts that could be used, though with adaptions and improvements, this looks a lot cleaner and easier to understand. some credit goes to @pigoz for the initial swift build support which i could improve upon. Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739, #2392, #2217
40 lines
1.2 KiB
Objective-C
40 lines
1.2 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 Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 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 Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#include "osdep/macosx_application.h"
|
|
#import "osdep/macosx_menubar_objc.h"
|
|
|
|
@class CocoaCB;
|
|
struct mpv_event;
|
|
struct mpv_handle;
|
|
|
|
@interface Application : NSApplication
|
|
|
|
- (NSImage *)getMPVIcon;
|
|
- (void)processEvent:(struct mpv_event *)event;
|
|
- (void)queueCommand:(char *)cmd;
|
|
- (void)stopMPV:(char *)cmd;
|
|
- (void)openFiles:(NSArray *)filenames;
|
|
- (void)setMpvHandle:(struct mpv_handle *)ctx;
|
|
- (void)initMPVCore;
|
|
|
|
@property(nonatomic, retain) MenuBar *menuBar;
|
|
@property(nonatomic, assign) size_t openCount;
|
|
@property(nonatomic, retain) CocoaCB *cocoaCB;
|
|
@end
|