[vlc-devel] [PATCH] vlc: minimal_macosx fix

James Bates james.h.bates at gmail.com
Sat Oct 6 15:18:11 CEST 2012


---
 modules/gui/Modules.am                         |    2 +-
 modules/gui/minimal_macosx/Modules.am          |    2 -
 modules/gui/minimal_macosx/VLCOpenGLVoutView.h |   19 ++-
 modules/gui/minimal_macosx/VLCOpenGLVoutView.m |  206 ++++++------------------
 modules/gui/minimal_macosx/intf.m              |    7 +-
 modules/gui/minimal_macosx/macosx.c            |   16 +-
 modules/gui/minimal_macosx/voutgl.h            |    7 +
 modules/gui/minimal_macosx/voutgl.m            |   80 ++++-----
 8 files changed, 103 insertions(+), 236 deletions(-)

diff --git a/modules/gui/Modules.am b/modules/gui/Modules.am
index 3f9ec39..8979bca 100644
--- a/modules/gui/Modules.am
+++ b/modules/gui/Modules.am
@@ -2,7 +2,7 @@ DIST_SUBDIRS = macosx minimal_macosx qt4 skins2 macosx_dialog_provider
 SUBDIRS =
 
 if HAVE_DARWIN
-SUBDIRS += macosx macosx_dialog_provider
+SUBDIRS += macosx macosx_dialog_provider minimal_macosx
 endif
 if ENABLE_QT4
 SUBDIRS += qt4
diff --git a/modules/gui/minimal_macosx/Modules.am b/modules/gui/minimal_macosx/Modules.am
index cf22105..cf3b0ec 100644
--- a/modules/gui/minimal_macosx/Modules.am
+++ b/modules/gui/minimal_macosx/Modules.am
@@ -9,12 +9,10 @@ SOURCES_minimal_macosx = \
 	VLCMinimalVoutWindow.m \
 	VLCOpenGLVoutView.m \
 	voutgl.m \
-	voutagl.m \
 	$(NULL)
 
 noinst_HEADERS = \
 	intf.h \
 	VLCMinimalVoutWindow.h \
 	VLCOpenGLVoutView.h \
-	voutagl.h \
 	voutgl.h
diff --git a/modules/gui/minimal_macosx/VLCOpenGLVoutView.h b/modules/gui/minimal_macosx/VLCOpenGLVoutView.h
index 3045843..d6a9ab8 100644
--- a/modules/gui/minimal_macosx/VLCOpenGLVoutView.h
+++ b/modules/gui/minimal_macosx/VLCOpenGLVoutView.h
@@ -33,15 +33,17 @@
 #include <OpenGL/gl.h>
 
 #include <vlc_common.h>
+#include <vlc_vout_window.h>
 
 /* Entry point */
-int  cocoaglvoutviewInit( vout_thread_t * p_vout );
-void cocoaglvoutviewEnd( vout_thread_t * p_vout );
-int  cocoaglvoutviewManage( vout_thread_t * p_vout );
+int  cocoaglvoutviewInit( vout_window_t * p_vout, const vout_window_cfg_t *cfg );
+void cocoaglvoutviewEnd( vout_window_t * p_vout );
+/*int  cocoaglvoutviewManage( vout_thread_t * p_vout );
 int  cocoaglvoutviewControl( vout_thread_t *p_vout, int i_query, va_list args );
 void cocoaglvoutviewSwap( vout_thread_t * p_vout );
 int  cocoaglvoutviewLock( vout_thread_t * p_vout );
 void cocoaglvoutviewUnlock( vout_thread_t * p_vout );
+*/
 
 /* To commmunicate with the VLC.framework */
 @protocol VLCOpenGLVoutEmbedding <NSObject>
@@ -57,23 +59,20 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout );
 @end
 
 /* VLCOpenGLVoutView */
- at interface VLCOpenGLVoutView : NSOpenGLView
+ at interface VLCOpenGLVoutView : NSView
 {
     id <VLCOpenGLVoutEmbedding> container;
-    vout_thread_t * p_vout;
+    vout_window_t * p_wnd;
     NSLock        * objectLock;
 }
 /* Init a new gl view and register it to both the framework and the
  * vout_thread_t. Must be called from main thread */
 + (void) autoinitOpenGLVoutViewIntVoutWithContainer: (NSData *) args;
 
-- (id) initWithVout: (vout_thread_t *) vout container: (id <VLCOpenGLVoutEmbedding>) container;
+- (id) initWithVoutWindow: (vout_window_t *) p_wnd container: (id <VLCOpenGLVoutEmbedding>) container;
 
-- (void) detachFromVout;
+- (void) detachFromVoutWindow;
 - (id <VLCOpenGLVoutEmbedding>) container;
 
-- (void) reshape;
-- (void) update;
-- (void) drawRect: (NSRect) rect;
 @end
 
diff --git a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
index 4fa69c1..83c969d 100644
--- a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
+++ b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
@@ -39,80 +39,80 @@
 #include <OpenGL/OpenGL.h>
 #include <OpenGL/gl.h>
 
+
 /*****************************************************************************
  * cocoaglvoutviewInit
  *****************************************************************************/
-int cocoaglvoutviewInit( vout_thread_t * p_vout )
+int cocoaglvoutviewInit( vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
 {
     vlc_value_t value_drawable;
     id <VLCOpenGLVoutEmbedding> o_cocoaglview_container;
 
-    msg_Dbg( p_vout, "Mac OS X Vout is opening" );
+    msg_Dbg( p_wnd, "Mac OS X Vout is opening" );
 
-    var_Create( p_vout, "drawable-nsobject", VLC_VAR_DOINHERIT );
-    var_Get( p_vout, "drawable-nsobject", &value_drawable );
+    var_Create( p_wnd, "drawable-nsobject", VLC_VAR_DOINHERIT );
+    var_Get( p_wnd, "drawable-nsobject", &value_drawable );
 
-    p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
+    p_wnd->sys->o_pool = [[NSAutoreleasePool alloc] init];
 
     /* This will be released in cocoaglvoutviewEnd(), on
      * main thread, after we are done using it. */
     o_cocoaglview_container = [(id) value_drawable.p_address retain];
     if (!o_cocoaglview_container)
     {
-        msg_Warn( p_vout, "No drawable!, spawing a window" );
+        msg_Warn( p_wnd, "No drawable!, spawing a window" );
     }
 
-    p_vout->p_sys->b_embedded = false;
+    //p_vout->p_sys->b_embedded = false;
 
 
     /* Create the GL view */
-    struct args { vout_thread_t * p_vout; id <VLCOpenGLVoutEmbedding> container; } args = { p_vout, o_cocoaglview_container };
+    struct args { vout_window_t *p_wnd; vout_window_cfg_t *cfg; id <VLCOpenGLVoutEmbedding> container; } args = { p_wnd, cfg, o_cocoaglview_container };
 
     [VLCOpenGLVoutView performSelectorOnMainThread:@selector(autoinitOpenGLVoutViewIntVoutWithContainer:)
                         withObject:[NSData dataWithBytes: &args length: sizeof(struct args)] waitUntilDone:YES];
 
-    [[p_vout->p_sys->o_glview openGLContext] makeCurrentContext];
     return VLC_SUCCESS;
 }
 
 /*****************************************************************************
  * cocoaglvoutviewEnd
  *****************************************************************************/
-void cocoaglvoutviewEnd( vout_thread_t * p_vout )
+void cocoaglvoutviewEnd( vout_window_t * p_wnd )
 {
     id <VLCOpenGLVoutEmbedding> o_cocoaglview_container;
 
-    if (!p_vout->p_sys->o_glview)
+    if (!p_wnd->handle.nsobject)
         return;
 
-    msg_Dbg( p_vout, "Mac OS X Vout is closing" );
-    var_Destroy( p_vout, "drawable-nsobject" );
+    msg_Dbg( p_wnd, "Mac OS X Vout is closing" );
+    var_Destroy( p_wnd, "drawable-nsobject" );
 
-    o_cocoaglview_container = [p_vout->p_sys->o_glview container];
+    o_cocoaglview_container = [(VLCOpenGLVoutView  *)p_wnd->handle.nsobject container];
 
     /* Make sure our view won't request the vout now */
-    [p_vout->p_sys->o_glview detachFromVout];
-    msg_Dbg( p_vout, "Mac OS X Vout is closing" );
+    [(VLCOpenGLVoutView  *)p_wnd->handle.nsobject detachFromVoutWindow];
+    msg_Dbg( p_wnd, "Mac OS X Vout is closing" );
 
     if( [(id)o_cocoaglview_container respondsToSelector:@selector(removeVoutSubview:)] )
-        [o_cocoaglview_container performSelectorOnMainThread:@selector(removeVoutSubview:) withObject:p_vout->p_sys->o_glview waitUntilDone:NO];
+        [o_cocoaglview_container performSelectorOnMainThread:@selector(removeVoutSubview:) withObject:p_wnd->handle.nsobject waitUntilDone:NO];
 
     /* Let the view go and release it, _without_blocking_ */
-    [p_vout->p_sys->o_glview performSelectorOnMainThread:@selector(removeFromSuperviewAndRelease) withObject:nil waitUntilDone:NO];
-    p_vout->p_sys->o_glview = nil;
+    [p_wnd->handle.nsobject performSelectorOnMainThread:@selector(removeFromSuperviewAndRelease) withObject:nil waitUntilDone:NO];
+    p_wnd->handle.nsobject = nil;
 
     /* Release the container now that we don't use it */
     [o_cocoaglview_container performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
 
-    [p_vout->p_sys->o_pool release];
-    p_vout->p_sys->o_pool = nil;
+    [p_wnd->sys->o_pool release];
+    p_wnd->sys->o_pool = nil;
  
 }
 
 /*****************************************************************************
  * cocoaglvoutviewManage
  *****************************************************************************/
-int cocoaglvoutviewManage( vout_thread_t * p_vout )
+/*int cocoaglvoutviewManage( vout_thread_t * p_vout )
 {
     if( p_vout->i_changes & VOUT_ASPECT_CHANGE )
     {
@@ -144,11 +144,11 @@ int cocoaglvoutviewManage( vout_thread_t * p_vout )
     //[[p_vout->p_sys->o_glview container] manage];
     return VLC_SUCCESS;
 }
-
+*/
 /*****************************************************************************
  * cocoaglvoutviewControl: control facility for the vout
  *****************************************************************************/
-int cocoaglvoutviewControl( vout_thread_t *p_vout, int i_query, va_list args )
+/*int cocoaglvoutviewControl( vout_thread_t *p_vout, int i_query, va_list args )
 {
     bool b_arg;
 
@@ -163,20 +163,20 @@ int cocoaglvoutviewControl( vout_thread_t *p_vout, int i_query, va_list args )
             return VLC_EGENERIC;
     }
 }
-
+*/
 /*****************************************************************************
  * cocoaglvoutviewSwap
  *****************************************************************************/
-void cocoaglvoutviewSwap( vout_thread_t * p_vout )
+/*void cocoaglvoutviewSwap( vout_thread_t * p_vout )
 {
     p_vout->p_sys->b_got_frame = true;
     [[p_vout->p_sys->o_glview openGLContext] flushBuffer];
 }
-
+*/
 /*****************************************************************************
  * cocoaglvoutviewLock
  *****************************************************************************/
-int cocoaglvoutviewLock( vout_thread_t * p_vout )
+/*int cocoaglvoutviewLock( vout_thread_t * p_vout )
 {
     if( kCGLNoError == CGLLockContext([[p_vout->p_sys->o_glview openGLContext] CGLContextObj]) )
     {
@@ -185,15 +185,15 @@ int cocoaglvoutviewLock( vout_thread_t * p_vout )
     }
     return 1;
 }
-
+*/
 /*****************************************************************************
  * cocoaglvoutviewUnlock
  *****************************************************************************/
-void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
+/*void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
 {
     CGLUnlockContext([[p_vout->p_sys->o_glview openGLContext] CGLContextObj]);
 }
-
+*/
 /*****************************************************************************
  * VLCOpenGLVoutView implementation
  *****************************************************************************/
@@ -203,22 +203,22 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
  * vout_thread_t. Must be called from main thread. */
 + (void) autoinitOpenGLVoutViewIntVoutWithContainer: (NSData *) argsAsData
 {
-    NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
-    struct args { vout_thread_t * p_vout; id <VLCOpenGLVoutEmbedding> container; } *
+    //NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
+    struct args { vout_window_t *p_wnd; vout_window_cfg_t *cfg; id <VLCOpenGLVoutEmbedding> container; } *
         args = (struct args *)[argsAsData bytes];
     VLCOpenGLVoutView * oglview;
 
     if( !args->container )
     {
-        args->container = [[VLCMinimalVoutWindow alloc] initWithContentRect: NSMakeRect( 0, 0, args->p_vout->i_window_width, args->p_vout->i_window_height )];
+        args->container = [[VLCMinimalVoutWindow alloc] initWithContentRect: NSMakeRect( 0, 0, args->cfg->width, args->cfg->height )];
         [(VLCMinimalVoutWindow *)args->container makeKeyAndOrderFront: nil];
     }
-    oglview = [[VLCOpenGLVoutView alloc] initWithVout: args->p_vout container: args->container];
+    oglview = [[VLCOpenGLVoutView alloc] initWithVoutWindow: args->p_wnd container: args->container];
 
-    args->p_vout->p_sys->o_glview = oglview;
+    args->p_wnd->handle.nsobject = oglview;
     [args->container addVoutSubview: oglview];
 
-    [pool release];
+    //[pool release];
 }
 
 - (void)dealloc
@@ -233,54 +233,22 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
     [self release];
 }
 
-- (id) initWithVout: (vout_thread_t *) vout container: (id <VLCOpenGLVoutEmbedding>) aContainer
+- (id) initWithVoutWindow: (vout_window_t *) wnd container: (id <VLCOpenGLVoutEmbedding>) aContainer
 {
-    NSOpenGLPixelFormatAttribute attribs[] =
+    if( self = [super initWithFrame: NSMakeRect(0,0,10,10)] )
     {
-        NSOpenGLPFADoubleBuffer,
-        NSOpenGLPFAAccelerated,
-        NSOpenGLPFANoRecovery,
-        NSOpenGLPFAColorSize, 24,
-        NSOpenGLPFAAlphaSize, 8,
-        NSOpenGLPFADepthSize, 24,
-        NSOpenGLPFAWindow,
-        0
-    };
-
-    NSOpenGLPixelFormat * fmt = [[NSOpenGLPixelFormat alloc]
-        initWithAttributes: attribs];
-
-    if( !fmt )
-    {
-        msg_Warn( p_vout, "could not create OpenGL video output" );
-        return nil;
-    }
-
-    if( self = [super initWithFrame: NSMakeRect(0,0,10,10) pixelFormat: fmt] )
-    {
-        p_vout = vout;
+        p_wnd = wnd;
         container = aContainer;
         objectLock = [[NSLock alloc] init];
 
-        [fmt release];
-
-        [[self openGLContext] makeCurrentContext];
-        [[self openGLContext] update];
-
-        /* Swap buffers only during the vertical retrace of the monitor.
-        http://developer.apple.com/documentation/GraphicsImaging/
-        Conceptual/OpenGL/chap5/chapter_5_section_44.html */
-        GLint params[] = { 1 };
-        CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval,
-                     params );
     }
     return self;
 }
 
-- (void) detachFromVout
+- (void) detachFromVoutWindow
 {
     [objectLock lock];
-    p_vout = NULL;
+    p_wnd = NULL;
     [objectLock unlock];
 }
 
@@ -289,99 +257,17 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
     return container;
 }
 
-- (void) destroyVout
+- (void) destroyVoutWindow
 {
     [objectLock lock];
-    if( p_vout )
+    if( p_wnd )
     {
-        vlc_object_release( p_vout );
-        vlc_object_release( p_vout );
+        vlc_object_release( p_wnd );
+        vlc_object_release( p_wnd );
     }
     [objectLock unlock];
 }
 
-- (void) reshape
-{
-    int x, y;
-    vlc_value_t val;
-
-    [objectLock lock];
-    if( !p_vout )
-    {
-        [objectLock unlock];
-        return;
-    }
-
-    cocoaglvoutviewLock( p_vout );
-    NSRect bounds = [self bounds];
-
-    if( [[self container] stretchesVideo] )
-    {
-        x = bounds.size.width;
-        y = bounds.size.height;
-    }
-    else if( bounds.size.height * p_vout->fmt_in.i_visible_width *
-             p_vout->fmt_in.i_sar_num <
-             bounds.size.width * p_vout->fmt_in.i_visible_height *
-             p_vout->fmt_in.i_sar_den )
-    {
-        x = ( bounds.size.height * p_vout->fmt_in.i_visible_width *
-              p_vout->fmt_in.i_sar_num ) /
-            ( p_vout->fmt_in.i_visible_height * p_vout->fmt_in.i_sar_den);
-
-        y = bounds.size.height;
-    }
-    else
-    {
-        x = bounds.size.width;
-        y = ( bounds.size.width * p_vout->fmt_in.i_visible_height *
-              p_vout->fmt_in.i_sar_den) /
-            ( p_vout->fmt_in.i_visible_width * p_vout->fmt_in.i_sar_num  );
-    }
-
-    glViewport( ( bounds.size.width - x ) / 2,
-                ( bounds.size.height - y ) / 2, x, y );
-
-    if( p_vout->p_sys->b_got_frame )
-    {
-        /* Ask the opengl module to redraw */
-        vout_thread_t * p_parent;
-        p_parent = (vout_thread_t *) p_vout->p_parent;
-        cocoaglvoutviewUnlock( p_vout );
-        if( p_parent && p_parent->pf_display )
-        {
-            p_parent->pf_display( p_parent, NULL );
-        }
-    }
-    else
-    {
-        glClear( GL_COLOR_BUFFER_BIT );
-        cocoaglvoutviewUnlock( p_vout );
-    }
-    [objectLock unlock];
-    [super reshape];
-}
-
-- (void) update
-{
-    if (!p_vout)
-        return;
-    if( kCGLNoError != CGLLockContext([[self openGLContext] CGLContextObj]) )
-        return;
-    [super update];
-    CGLUnlockContext([[p_vout->p_sys->o_glview openGLContext] CGLContextObj]);
-}
-
-- (void) drawRect: (NSRect) rect
-{
-    if (!p_vout)
-        return;
-    if( kCGLNoError != CGLLockContext([[self openGLContext] CGLContextObj]) )
-        return;
-    [[self openGLContext] flushBuffer];
-    [super drawRect:rect];
-    CGLUnlockContext([[p_vout->p_sys->o_glview openGLContext] CGLContextObj]);
-}
 
 - (BOOL)mouseDownCanMoveWindow
 {
diff --git a/modules/gui/minimal_macosx/intf.m b/modules/gui/minimal_macosx/intf.m
index b9a13ef..6def200 100644
--- a/modules/gui/minimal_macosx/intf.m
+++ b/modules/gui/minimal_macosx/intf.m
@@ -54,6 +54,7 @@ static void Run ( intf_thread_t *p_intf );
 int OpenIntf ( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t*) p_this;
+	msg_Dbg( p_intf, "## Opening the Minimal Mac OS X module" );
 
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
@@ -64,7 +65,7 @@ int OpenIntf ( vlc_object_t *p_this )
     memset( p_intf->p_sys, 0, sizeof( *p_intf->p_sys ) );
 
     p_intf->pf_run = Run;
-    p_intf->b_should_run_on_first_thread = true;
+//    p_intf->b_should_run_on_first_thread = true;
 
     return VLC_SUCCESS;
 }
@@ -110,7 +111,7 @@ static void * KillerThread( void *user_data )
     vlc_mutex_destroy( &p_intf->p_sys->lock );
     vlc_cond_destroy( &p_intf->p_sys->wait );
 
-    msg_Dbg( p_intf, "Killing the Minimal Mac OS X module" );
+    msg_Dbg( p_intf, "## Killing the Minimal Mac OS X module" );
 
     /* We are dead, terminate */
     [NSApp terminate: nil];
@@ -123,6 +124,8 @@ static void * KillerThread( void *user_data )
  *****************************************************************************/
 static void Run( intf_thread_t *p_intf )
 {
+	msg_Dbg( p_intf, "## Running the Minimal Mac OS X module" );
+
     sigset_t set;
 
     /* Make sure the "force quit" menu item does quit instantly.
diff --git a/modules/gui/minimal_macosx/macosx.c b/modules/gui/minimal_macosx/macosx.c
index 59133a1..a8140b7 100644
--- a/modules/gui/minimal_macosx/macosx.c
+++ b/modules/gui/minimal_macosx/macosx.c
@@ -36,6 +36,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
+#include <vlc_vout_window.h>
 
 /*****************************************************************************
  * External prototypes
@@ -43,8 +44,8 @@
 int  OpenIntf     ( vlc_object_t * );
 void CloseIntf    ( vlc_object_t * );
 
-int  OpenVideoGL  ( vlc_object_t * );
-void CloseVideoGL ( vlc_object_t * );
+int  WindowOpen   ( vout_window_t *, const vout_window_cfg_t * );
+void WindowClose  ( vout_window_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -61,12 +62,9 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INTERFACE_MAIN )
 
     add_submodule ()
-        /* Will be loaded even without interface module. see voutgl.m */
-        add_shortcut( "minimal_macosx", "miosx" )
-        set_description( N_("Minimal Mac OS X OpenGL video output (opens a borderless window)") )
-        set_capability( "opengl provider", 50 )
-        set_category( CAT_VIDEO)
-        set_subcategory( SUBCAT_VIDEO_VOUT )
-        set_callbacks( OpenVideoGL, CloseVideoGL )
+    /* Will be loaded even without interface module. see voutgl.m */
+        set_description( "Minimal Mac OS X Video Output Provider" )
+        set_capability( "vout window nsobject", 100 )
+        set_callbacks( WindowOpen, WindowClose )
 vlc_module_end ()
 
diff --git a/modules/gui/minimal_macosx/voutgl.h b/modules/gui/minimal_macosx/voutgl.h
index 3e51ea0..edac8a5 100644
--- a/modules/gui/minimal_macosx/voutgl.h
+++ b/modules/gui/minimal_macosx/voutgl.h
@@ -48,3 +48,10 @@ struct vout_sys_t
     bool                b_clipped_out;
     Rect                clipBounds, viewBounds;
 };
+
+struct vout_window_sys_t
+{
+    NSAutoreleasePool *o_pool;
+};
+
+
diff --git a/modules/gui/minimal_macosx/voutgl.m b/modules/gui/minimal_macosx/voutgl.m
index 96792fa..7bc8e09 100644
--- a/modules/gui/minimal_macosx/voutgl.m
+++ b/modules/gui/minimal_macosx/voutgl.m
@@ -33,72 +33,48 @@
 #include "intf.h"
 #include "voutgl.h"
 
-int OpenVideoGL  ( vlc_object_t * p_this )
-{
-    vout_thread_t * p_vout = (vout_thread_t *) p_this;
-    int i_drawable_agl;
-    int i_drawable_gl;
 
-    if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) )
-    {
-        msg_Warn( p_vout, "No OpenGL hardware acceleration found. "
-                          "Video display will be slow" );
+static int WindowControl( vout_window_t *, int i_query, va_list );
+
+int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
+{
+    p_wnd->sys = malloc( sizeof( vout_window_sys_t ) );
+    if( p_wnd->sys == NULL )
         return( 1 );
-    }
 
-    msg_Dbg( p_vout, "display is Quartz Extreme accelerated" );
+    memset( p_wnd->sys, 0, sizeof( vout_window_sys_t ) );
 
-    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
-    if( p_vout->p_sys == NULL )
-        return( 1 );
 
-    memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
+    if (cocoaglvoutviewInit(p_wnd, cfg)) {
+        msg_Err( p_wnd, "Mac OS X VoutGLView couldnt be initialized" );
+        return VLC_EGENERIC;
+    }
 
-    i_drawable_agl = var_GetInteger( p_vout->p_libvlc, "drawable-agl" );
-    i_drawable_gl = var_GetInteger( p_vout->p_libvlc, "drawable-gl" );
+    p_wnd->control = WindowControl;
+    return VLC_SUCCESS;
+}
 
-    /* Are we in the mozilla plugin, which isn't 64bit compatible ? */
-#ifndef __x86_64__
-    if( i_drawable_agl > 0 )
+static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
+{
+    /* TODO */
+    if( i_query == VOUT_WINDOW_SET_STATE )
+        msg_Dbg( p_wnd, "WindowControl:VOUT_WINDOW_SET_STATE" );
+    else if( i_query == VOUT_WINDOW_SET_SIZE )
     {
-        p_vout->pf_init             = aglInit;
-        p_vout->pf_end              = aglEnd;
-        p_vout->pf_manage           = aglManage;
-        p_vout->pf_control          = aglControl;
-        p_vout->pf_swap             = aglSwap;
-        p_vout->pf_lock             = aglLock;
-        p_vout->pf_unlock           = aglUnlock;
+         msg_Dbg( p_wnd, "WindowControl:VOUT_WINDOW_SET_SIZE" );
     }
-    else /*if( i_drawable_gl > 0 )*/
+    else if( i_query == VOUT_WINDOW_SET_FULLSCREEN )
     {
-        /* Let's use the VLCOpenGLVoutView.m class */
-        p_vout->pf_init   = cocoaglvoutviewInit;
-        p_vout->pf_end    = cocoaglvoutviewEnd;
-        p_vout->pf_manage = cocoaglvoutviewManage;
-        p_vout->pf_control= cocoaglvoutviewControl;
-        p_vout->pf_swap   = cocoaglvoutviewSwap;
-        p_vout->pf_lock   = cocoaglvoutviewLock;
-        p_vout->pf_unlock = cocoaglvoutviewUnlock;
+        msg_Dbg( p_wnd, "WindowControl:VOUT_WINDOW_SET_FULLSCREEN" );
     }
-#else
-    /* Let's use the VLCOpenGLVoutView.m class */
-    p_vout->pf_init   = cocoaglvoutviewInit;
-    p_vout->pf_end    = cocoaglvoutviewEnd;
-    p_vout->pf_manage = cocoaglvoutviewManage;
-    p_vout->pf_control= cocoaglvoutviewControl;
-    p_vout->pf_swap   = cocoaglvoutviewSwap;
-    p_vout->pf_lock   = cocoaglvoutviewLock;
-    p_vout->pf_unlock = cocoaglvoutviewUnlock;
-#endif
-    p_vout->p_sys->b_got_frame = false;
-
+    else
+        msg_Dbg( p_wnd, "WindowControl: unknown query" );
     return VLC_SUCCESS;
 }
 
-void CloseVideoGL ( vlc_object_t * p_this )
+void WindowClose( vout_window_t *p_wnd )
 {
-    vout_thread_t * p_vout = (vout_thread_t *) p_this;
-    cocoaglvoutviewEnd( p_vout );
+    cocoaglvoutviewEnd( p_wnd );
     /* Clean up */
-    free( p_vout->p_sys );
+    free( p_wnd->sys );
 }
-- 
1.7.9.6 (Apple Git-31.1)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4364 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20121006/27861e60/attachment.bin>


More information about the vlc-devel mailing list