Commit e8dcec0c authored by James Bates's avatar James Bates Committed by Jean-Baptiste Kempf

Updated and reactivated minimal_macosx gui module, which is

 needed by the npapi browser plugin on OS X
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 12baf681
......@@ -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
......
......@@ -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
......@@ -33,15 +33,11 @@
#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 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 );
int cocoaglvoutviewInit( vout_window_t * p_vout, const vout_window_cfg_t *cfg );
void cocoaglvoutviewEnd( vout_window_t * p_vout );
/* To commmunicate with the VLC.framework */
@protocol VLCOpenGLVoutEmbedding <NSObject>
......@@ -57,23 +53,20 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout );
@end
/* VLCOpenGLVoutView */
@interface VLCOpenGLVoutView : NSOpenGLView
@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
......@@ -54,7 +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;
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
......@@ -64,7 +64,6 @@ 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;
return VLC_SUCCESS;
}
......@@ -110,8 +109,6 @@ 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" );
/* We are dead, terminate */
[NSApp terminate: nil];
[o_pool release];
......
......@@ -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 ()
/*****************************************************************************
* voutagl.h: MacOS X agl OpenGL provider (used by webbrowser.plugin)
*****************************************************************************
* Copyright (C) 2001-2004 the VideoLAN team
* $Id$
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
* Damien Fouilleul <damienf at videolan dot org>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <AGL/agl.h>
#include <vlc_common.h>
int aglInit ( vout_thread_t * p_vout );
void aglEnd ( vout_thread_t * p_vout );
int aglManage ( vout_thread_t * p_vout );
int aglControl( vout_thread_t *, int, va_list );
void aglSwap ( vout_thread_t * p_vout );
int aglLock ( vout_thread_t * p_vout );
void aglUnlock ( vout_thread_t * p_vout );
This diff is collapsed.
......@@ -27,7 +27,6 @@
#import <Cocoa/Cocoa.h>
#import "VLCOpenGLVoutView.h"
#import "voutagl.h"
struct vout_sys_t
{
......@@ -39,12 +38,16 @@ struct vout_sys_t
/* Mozilla plugin-related variables */
bool b_embedded;
AGLContext agl_ctx;
AGLDrawable agl_drawable;
int i_offx, i_offy;
int i_width, i_height;
WindowRef theWindow;
WindowGroupRef winGroup;
bool b_clipped_out;
Rect clipBounds, viewBounds;
};
struct vout_window_sys_t
{
NSAutoreleasePool *o_pool;
};
......@@ -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 );
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment