summaryrefslogtreecommitdiffstats
path: root/libvo/cocoa_common.m
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2011-12-11 12:26:00 +0100
committerUoti Urpala <uau@mplayer2.org>2012-04-26 21:03:10 +0300
commitd12b9b611aa7030047e6556714e859dd2bfd38fc (patch)
tree6df7a9b89ae07f5235310c5b952189c81c753236 /libvo/cocoa_common.m
parent237f44db44b5479c78c90c1a045e0123a2f9c2b8 (diff)
downloadmpv-d12b9b611aa7030047e6556714e859dd2bfd38fc.tar.bz2
mpv-d12b9b611aa7030047e6556714e859dd2bfd38fc.tar.xz
vo_corevideo: use cocoa_common to display the window
Change vo_corevideo to use cocoa_common to create and manage the window. This doesn't affect external OSX GUIs, since they don't use vo_corevideo window management, but only read the image data from the shared buffer.
Diffstat (limited to 'libvo/cocoa_common.m')
-rw-r--r--libvo/cocoa_common.m15
1 files changed, 13 insertions, 2 deletions
diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m
index f5ad7a0943..af2f4adaaf 100644
--- a/libvo/cocoa_common.m
+++ b/libvo/cocoa_common.m
@@ -54,6 +54,7 @@ struct vo_cocoa_state {
NSAutoreleasePool *pool;
GLMPlayerWindow *window;
NSOpenGLContext *glContext;
+ NSOpenGLPixelFormat *pixelFormat;
NSSize current_video_size;
NSSize previous_video_size;
@@ -212,8 +213,8 @@ int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
(NSOpenGLPixelFormatAttribute)0
};
- NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
- s->glContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
+ s->pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] autorelease];
+ s->glContext = [[NSOpenGLContext alloc] initWithFormat:s->pixelFormat shareContext:nil];
create_menu();
@@ -345,6 +346,16 @@ int vo_cocoa_swap_interval(int enabled)
return 0;
}
+void *vo_cocoa_cgl_context(void)
+{
+ return [s->glContext CGLContextObj];
+}
+
+void *vo_cocoa_cgl_pixel_format(void)
+{
+ return [s->pixelFormat CGLPixelFormatObj];
+}
+
void create_menu()
{
NSMenu *menu;