2005-04-29 11:05:16 +00:00
|
|
|
/*
|
2009-02-08 03:27:30 +00:00
|
|
|
* MPlayer Mac OS X video output driver
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005 Nicolas Plourde <nicolasplourde@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2005-04-29 11:05:16 +00:00
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <QuartzCore/QuartzCore.h>
|
2005-05-02 18:05:59 +00:00
|
|
|
#import <QuickTime/QuickTime.h>
|
2005-04-29 11:05:16 +00:00
|
|
|
|
2007-11-28 00:01:35 +00:00
|
|
|
// 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
|
|
|
|
|
2005-06-02 14:10:52 +00:00
|
|
|
@interface MPlayerOpenGLView : NSOpenGLView
|
2005-04-29 11:05:16 +00:00
|
|
|
{
|
|
|
|
//Cocoa
|
|
|
|
NSWindow *window;
|
|
|
|
NSOpenGLContext *glContext;
|
|
|
|
NSEvent *event;
|
|
|
|
|
|
|
|
//CoreVideo
|
2007-11-30 04:20:38 +00:00
|
|
|
CVPixelBufferRef frameBuffers[2];
|
2005-04-29 11:05:16 +00:00
|
|
|
CVOpenGLTextureCacheRef textureCache;
|
|
|
|
CVOpenGLTextureRef texture;
|
2005-06-15 21:49:50 +00:00
|
|
|
NSRect textureFrame;
|
2005-04-29 11:05:16 +00:00
|
|
|
|
|
|
|
GLfloat lowerLeft[2];
|
|
|
|
GLfloat lowerRight[2];
|
|
|
|
GLfloat upperRight[2];
|
|
|
|
GLfloat upperLeft[2];
|
|
|
|
|
|
|
|
BOOL mouseHide;
|
2005-06-29 21:54:48 +00:00
|
|
|
float winSizeMult;
|
2005-05-25 23:38:59 +00:00
|
|
|
|
|
|
|
//menu command id
|
|
|
|
NSMenuItem *kQuitCmd;
|
|
|
|
NSMenuItem *kHalfScreenCmd;
|
|
|
|
NSMenuItem *kNormalScreenCmd;
|
|
|
|
NSMenuItem *kDoubleScreenCmd;
|
|
|
|
NSMenuItem *kFullScreenCmd;
|
|
|
|
NSMenuItem *kKeepAspectCmd;
|
|
|
|
NSMenuItem *kAspectOrgCmd;
|
|
|
|
NSMenuItem *kAspectFullCmd;
|
|
|
|
NSMenuItem *kAspectWideCmd;
|
|
|
|
NSMenuItem *kPanScanCmd;
|
2008-11-27 11:34:26 +00:00
|
|
|
|
|
|
|
//timestamps for disabling screensaver and mouse hiding
|
|
|
|
int lastMouseHide;
|
|
|
|
int lastScreensaverUpdate;
|
2005-04-29 11:05:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) acceptsFirstResponder;
|
|
|
|
- (BOOL) becomeFirstResponder;
|
|
|
|
- (BOOL) resignFirstResponder;
|
|
|
|
|
|
|
|
//window & rendering
|
2007-08-18 10:30:15 +00:00
|
|
|
- (void) preinit;
|
|
|
|
- (void) config;
|
2005-04-29 11:05:16 +00:00
|
|
|
- (void) prepareOpenGL;
|
|
|
|
- (void) render;
|
|
|
|
- (void) reshape;
|
|
|
|
- (void) setCurrentTexture;
|
|
|
|
- (void) drawRect: (NSRect *) bounds;
|
2005-06-02 14:10:52 +00:00
|
|
|
|
|
|
|
//vo control
|
2005-04-29 11:05:16 +00:00
|
|
|
- (void) fullscreen: (BOOL) animate;
|
|
|
|
- (void) ontop;
|
|
|
|
- (void) panscan;
|
2005-05-02 18:05:59 +00:00
|
|
|
- (void) rootwin;
|
2005-04-29 11:05:16 +00:00
|
|
|
|
2005-06-02 14:10:52 +00:00
|
|
|
//menu
|
|
|
|
- (void) initMenu;
|
|
|
|
- (void) menuAction:(id)sender;
|
|
|
|
|
2005-04-29 11:05:16 +00:00
|
|
|
//event
|
|
|
|
- (void) keyDown: (NSEvent *) theEvent;
|
|
|
|
- (void) mouseMoved: (NSEvent *) theEvent;
|
|
|
|
- (void) mouseDown: (NSEvent *) theEvent;
|
2007-08-18 22:46:29 +00:00
|
|
|
- (void) mouseUp: (NSEvent *) theEvent;
|
2005-04-29 11:05:16 +00:00
|
|
|
- (void) rightMouseDown: (NSEvent *) theEvent;
|
2007-08-18 22:46:29 +00:00
|
|
|
- (void) rightMouseUp: (NSEvent *) theEvent;
|
2005-04-29 11:05:16 +00:00
|
|
|
- (void) otherMouseDown: (NSEvent *) theEvent;
|
2007-08-18 22:46:29 +00:00
|
|
|
- (void) otherMouseUp: (NSEvent *) theEvent;
|
2005-04-29 11:05:16 +00:00
|
|
|
- (void) scrollWheel: (NSEvent *) theEvent;
|
|
|
|
- (void) mouseEvent: (NSEvent *) theEvent;
|
|
|
|
- (void) check_events;
|
2007-08-18 10:29:31 +00:00
|
|
|
@end
|