Commit f3ccaec1 authored by Benjamin Pracht's avatar Benjamin Pracht

* Apply changed made to the 0.8.5 branch to trunk.

* Embedded Vout should work now
* To create an embedded vout, just create a custom view of type VLCEmbeddedVoutView in interface builder
* Just make sure you define the view as resizeable
* Hotkeys and mose events should work
* Tests with the mozilla plugin are welcome

parent 3371c10f
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
OUTLETS = {"o_btn_fullscreen" = id; "o_main" = id; "o_volumeslider" = id; }; OUTLETS = {"o_btn_fullscreen" = id; "o_main" = id; "o_volumeslider" = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{CLASS = VLCEmbeddedVoutView; LANGUAGE = ObjC; SUPERCLASS = VLCVoutView; },
{ {
ACTIONS = { ACTIONS = {
bandSliderUpdated = id; bandSliderUpdated = id;
...@@ -287,7 +288,8 @@ ...@@ -287,7 +288,8 @@
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; } {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
{CLASS = VLCVoutView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
); );
IBVersion = 1; IBVersion = 1;
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
* Derk-Jan Hartman <hartman at videolan dot org> * Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan doit org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -268,18 +269,31 @@ ...@@ -268,18 +269,31 @@
if( p_vout != NULL ) if( p_vout != NULL )
{ {
id o_embedded_vout_list = [[VLCMain sharedInstance] getEmbeddedList];
while ((o_window = [o_enumerator nextObject])) while ((o_window = [o_enumerator nextObject]))
{ {
if( [[o_window className] isEqualToString: @"VLCWindow"] ) id o_vout_view = nil;
/* We have an embedded vout */
if( [o_embedded_vout_list windowContainsEmbedded: o_window] )
{
o_vout_view = [o_embedded_vout_list getViewForWindow: o_window];
}
/* We have a detached Vout */
else if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
o_vout_view = [o_window getVoutView];
}
if( o_vout_view )
{ {
if( [o_title isEqualToString: _NS("Half Size") ] ) if( [o_title isEqualToString: _NS("Half Size") ] )
[o_window scaleWindowWithFactor: 0.5]; [o_vout_view scaleWindowWithFactor: 0.5];
else if( [o_title isEqualToString: _NS("Normal Size") ] ) else if( [o_title isEqualToString: _NS("Normal Size") ] )
[o_window scaleWindowWithFactor: 1.0]; [o_vout_view scaleWindowWithFactor: 1.0];
else if( [o_title isEqualToString: _NS("Double Size") ] ) else if( [o_title isEqualToString: _NS("Double Size") ] )
[o_window scaleWindowWithFactor: 2.0]; [o_vout_view scaleWindowWithFactor: 2.0];
else if( [o_title isEqualToString: _NS("Float on Top") ] ) else if( [o_title isEqualToString: _NS("Float on Top") ] )
[o_window toggleFloatOnTop]; [o_vout_view toggleFloatOnTop];
else if( [o_title isEqualToString: _NS("Fit to Screen") ] ) else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
{ {
if( ![o_window isZoomed] ) if( ![o_window isZoomed] )
...@@ -287,11 +301,11 @@ ...@@ -287,11 +301,11 @@
} }
else if( [o_title isEqualToString: _NS("Snapshot") ] ) else if( [o_title isEqualToString: _NS("Snapshot") ] )
{ {
[o_window snapshot]; [o_vout_view snapshot];
} }
else else
{ {
[o_window toggleFullscreen]; [o_vout_view toggleFullscreen];
} }
break; break;
} }
...@@ -640,7 +654,9 @@ ...@@ -640,7 +654,9 @@
while( (o_window = [o_enumerator nextObject])) while( (o_window = [o_enumerator nextObject]))
{ {
if( [[o_window className] isEqualToString: @"VLCWindow"] ) if( [[o_window className] isEqualToString: @"VLCWindow"] ||
[[[VLCMain sharedInstance] getEmbeddedList]
windowContainsEmbedded: o_window])
{ {
bEnabled = TRUE; bEnabled = TRUE;
break; break;
......
...@@ -79,6 +79,7 @@ struct intf_sys_t ...@@ -79,6 +79,7 @@ struct intf_sys_t
/* The messages window */ /* The messages window */
msg_subscription_t * p_sub; msg_subscription_t * p_sub;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -93,6 +94,7 @@ struct intf_sys_t ...@@ -93,6 +94,7 @@ struct intf_sys_t
id o_wizard; /* VLCWizard */ id o_wizard; /* VLCWizard */
id o_extended; /* VLCExtended */ id o_extended; /* VLCExtended */
id o_bookmarks; /* VLCBookmarks */ id o_bookmarks; /* VLCBookmarks */
id o_embedded_list; /* VLCEmbeddedList*/
id o_sfilters; /* VLCsFilters */ id o_sfilters; /* VLCsFilters */
/*id o_update; VLCUpdate */ /*id o_update; VLCUpdate */
BOOL nib_main_loaded; /* reference to the main-nib */ BOOL nib_main_loaded; /* reference to the main-nib */
...@@ -278,6 +280,7 @@ struct intf_sys_t ...@@ -278,6 +280,7 @@ struct intf_sys_t
- (id)getInfo; - (id)getInfo;
- (id)getWizard; - (id)getWizard;
- (id)getBookmarks; - (id)getBookmarks;
- (id)getEmbeddedList;
- (void)terminate; - (void)terminate;
- (NSString *)localizedString:(char *)psz; - (NSString *)localizedString:(char *)psz;
- (char *)delocalizeString:(NSString *)psz; - (char *)delocalizeString:(NSString *)psz;
......
...@@ -304,6 +304,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -304,6 +304,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_wizard = [[VLCWizard alloc] init]; o_wizard = [[VLCWizard alloc] init];
o_extended = nil; o_extended = nil;
o_bookmarks = [[VLCBookmarks alloc] init]; o_bookmarks = [[VLCBookmarks alloc] init];
o_embedded_list = [[VLCEmbeddedList alloc] init];
o_sfilters = nil; o_sfilters = nil;
/*o_update = [[VLCUpdate alloc] init];*/ /*o_update = [[VLCUpdate alloc] init];*/
...@@ -804,6 +805,15 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -804,6 +805,15 @@ static VLCMain *_o_sharedMainInstance = nil;
return nil; return nil;
} }
- (id)getEmbeddedList
{
if( o_embedded_list )
{
return o_embedded_list;
}
return nil;
}
- (void)manage - (void)manage
{ {
playlist_t * p_playlist; playlist_t * p_playlist;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
* Eric Petit <titer@m0k.org> * Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -25,35 +26,99 @@ ...@@ -25,35 +26,99 @@
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* VLCWindow interface * VLCEmbeddedList interface
*****************************************************************************/ *****************************************************************************/
@interface VLCWindow : NSWindow @interface VLCEmbeddedList : NSObject
{
NSMutableArray * o_embedded_array;
}
- (id)getEmbeddedVout;
- (void)releaseEmbeddedVout: (id)o_vout_view;
- (void)addEmbeddedVout: (id)o_vout_view;
- (BOOL)windowContainsEmbedded: (id)o_window;
- (id)getViewForWindow: (id)o_window;
@end
/*****************************************************************************
* VLCVoutView interface
*****************************************************************************/
@interface VLCVoutView : NSView
{ {
vout_thread_t * p_vout; vout_thread_t * p_vout;
NSView * o_view; NSView * o_view;
NSRect * s_frame; NSRect * s_frame;
vout_thread_t * p_real_vout; vout_thread_t * p_real_vout;
Ptr p_fullscreen_state; id o_window;
mtime_t i_time_mouse_last_moved;
vlc_bool_t b_init_ok;
} }
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
- (id) initWithVout: (vout_thread_t *) p_vout view: (NSView *) view frame: (NSRect *) s_arg_frame;
frame: (NSRect *) s_frame; - (void)closeVout;
- (id) initReal: (id) sender;
- (void) close;
- (id) closeReal: (id) sender;
- (void)setOnTop:(BOOL)b_on_top;
- (void)hideMouse:(BOOL)b_hide;
- (void)manage; - (void)manage;
- (void)scaleWindowWithFactor: (float)factor; - (void)scaleWindowWithFactor: (float)factor;
- (void)setOnTop:(BOOL)b_on_top;
- (void)toggleFloatOnTop; - (void)toggleFloatOnTop;
- (void)toggleFullscreen; - (void)toggleFullscreen;
- (BOOL)isFullscreen; - (BOOL)isFullscreen;
- (void)snapshot; - (void)snapshot;
- (id)getWindow;
+ (id)getVoutView: (vout_thread_t *)p_vout subView: (NSView *) view
frame: (NSRect *) s_frame;
+ (vout_thread_t *)getRealVout: (vout_thread_t *)p_vout;
@end
/*****************************************************************************
* VLCVoutDetachedView interface
*****************************************************************************/
@interface VLCDetachedVoutView : VLCVoutView
{
mtime_t i_time_mouse_last_moved;
}
- (void)hideMouse: (BOOL)b_hide;
@end
/*****************************************************************************
* VLCEmbeddedView interface
*****************************************************************************/
@interface VLCEmbeddedVoutView : VLCVoutView
{
BOOL b_used;
}
- (void)setUsed: (BOOL)b_new_used;
- (BOOL)isUsed;
@end
/*****************************************************************************
* VLCWindow interface
*****************************************************************************/
@interface VLCWindow : NSWindow
{
vout_thread_t * p_vout;
VLCVoutView * o_view;
NSRect * s_frame;
vout_thread_t * p_real_vout;
Ptr p_fullscreen_state;
vlc_bool_t b_init_ok;
}
- (id) initWithVout: (vout_thread_t *) p_vout view: (VLCVoutView *) view
frame: (NSRect *) s_frame;
- (id)initReal: (id) sender;
- (void)close;
- (void)closeWindow;
- (id)closeReal: (id) sender;
- (id)getVoutView;
- (void)updateTitle; - (void)updateTitle;
- (BOOL)windowShouldClose:(id)sender; - (BOOL)windowShouldClose:(id)sender;
......
This diff is collapsed.
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org> * Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org> * Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -54,8 +55,8 @@ ...@@ -54,8 +55,8 @@
struct vout_sys_t struct vout_sys_t
{ {
NSAutoreleasePool * o_pool; NSAutoreleasePool * o_pool;
VLCWindow * o_window;
VLCGLView * o_glview; VLCGLView * o_glview;
VLCVoutView * o_vout_view;
vlc_bool_t b_saved_frame; vlc_bool_t b_saved_frame;
NSRect s_frame; NSRect s_frame;
vlc_bool_t b_got_frame; vlc_bool_t b_got_frame;
...@@ -102,14 +103,15 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this ) ...@@ -102,14 +103,15 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
[p_vout->p_sys->o_glview autorelease]; [p_vout->p_sys->o_glview autorelease];
/* Spawn the window */ /* Spawn the window */
p_vout->p_sys->b_got_frame = VLC_FALSE;
p_vout->p_sys->o_window = [[VLCWindow alloc] initWithVout: p_vout if( !(p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
view: p_vout->p_sys->o_glview frame: nil]; subView: p_vout->p_sys->o_glview frame: nil]) )
if( !p_vout->p_sys->o_window )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_vout->p_sys->b_got_frame = VLC_FALSE;
p_vout->pf_init = Init; p_vout->pf_init = Init;
p_vout->pf_end = End; p_vout->pf_end = End;
p_vout->pf_manage = Manage; p_vout->pf_manage = Manage;
...@@ -127,7 +129,7 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this ) ...@@ -127,7 +129,7 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this )
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
/* Close the window */ /* Close the window */
[p_vout->p_sys->o_window close]; [p_vout->p_sys->o_vout_view closeVout];
/* Clean up */ /* Clean up */
vlc_mutex_destroy( &p_vout->p_sys->lock ); vlc_mutex_destroy( &p_vout->p_sys->lock );
...@@ -156,12 +158,12 @@ static int Manage( vout_thread_t * p_vout ) ...@@ -156,12 +158,12 @@ static int Manage( vout_thread_t * p_vout )
{ {
/* Save window size and position */ /* Save window size and position */
p_vout->p_sys->s_frame.size = p_vout->p_sys->s_frame.size =
[[p_vout->p_sys->o_window contentView] frame].size; [p_vout->p_sys->o_vout_view frame].size;
p_vout->p_sys->s_frame.origin = p_vout->p_sys->s_frame.origin =
[p_vout->p_sys->o_window frame].origin; [[p_vout->p_sys->o_vout_view getWindow ]frame].origin;
p_vout->p_sys->b_saved_frame = VLC_TRUE; p_vout->p_sys->b_saved_frame = VLC_TRUE;
} }
[p_vout->p_sys->o_window close]; [p_vout->p_sys->o_vout_view closeVout];
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
...@@ -171,14 +173,15 @@ static int Manage( vout_thread_t * p_vout ) ...@@ -171,14 +173,15 @@ static int Manage( vout_thread_t * p_vout )
if( p_vout->p_sys->b_saved_frame ) if( p_vout->p_sys->b_saved_frame )
{ {
p_vout->p_sys->o_window = [[VLCWindow alloc] p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
initWithVout: p_vout view: o_glview subView: o_glview
frame: &p_vout->p_sys->s_frame]; frame: &p_vout->p_sys->s_frame];
} }
else else
{ {
p_vout->p_sys->o_window = [[VLCWindow alloc] p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
initWithVout: p_vout view: o_glview frame: nil]; subView: o_glview frame: nil];
} }
[[o_glview openGLContext] makeCurrentContext]; [[o_glview openGLContext] makeCurrentContext];
...@@ -188,7 +191,7 @@ static int Manage( vout_thread_t * p_vout ) ...@@ -188,7 +191,7 @@ static int Manage( vout_thread_t * p_vout )
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
} }
[p_vout->p_sys->o_window manage]; [p_vout->p_sys->o_vout_view manage];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -203,7 +206,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -203,7 +206,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{ {
case VOUT_SET_STAY_ON_TOP: case VOUT_SET_STAY_ON_TOP:
b_arg = va_arg( args, vlc_bool_t ); b_arg = va_arg( args, vlc_bool_t );
[p_vout->p_sys->o_window setOnTop: b_arg]; [p_vout->p_sys->o_vout_view setOnTop: b_arg];
return VLC_SUCCESS; return VLC_SUCCESS;
case VOUT_CLOSE: case VOUT_CLOSE:
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
struct vout_sys_t struct vout_sys_t
{ {
NSAutoreleasePool *o_pool; NSAutoreleasePool *o_pool;
VLCWindow * o_window;
VLCQTView * o_qtview; VLCQTView * o_qtview;
VLCVoutView * o_vout_view;
vlc_bool_t b_saved_frame; vlc_bool_t b_saved_frame;
vlc_bool_t b_altivec; vlc_bool_t b_altivec;
...@@ -215,9 +215,9 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this ) ...@@ -215,9 +215,9 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
else else
{ {
/* Spawn window */ /* Spawn window */
p_vout->p_sys->o_window = [[VLCWindow alloc] p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
initWithVout: p_vout view: o_qtview frame: nil]; subView: o_qtview frame: nil];
if( !p_vout->p_sys->o_window ) if( !p_vout->p_sys->o_vout_view )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -251,7 +251,7 @@ void E_(CloseVideoQT) ( vlc_object_t *p_this ) ...@@ -251,7 +251,7 @@ void E_(CloseVideoQT) ( vlc_object_t *p_this )
vout_thread_t * p_vout = (vout_thread_t *)p_this; vout_thread_t * p_vout = (vout_thread_t *)p_this;
if( !p_vout->p_sys->b_embedded ) if( !p_vout->p_sys->b_embedded )
[p_vout->p_sys->o_window close]; [p_vout->p_sys->o_vout_view closeVout];
/* Clean Up Quicktime environment */ /* Clean Up Quicktime environment */
ExitMovies(); ExitMovies();
...@@ -386,7 +386,7 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -386,7 +386,7 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout->i_changes &= ~VOUT_SIZE_CHANGE; p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
} }
[p_vout->p_sys->o_window manage]; [p_vout->p_sys->o_vout_view manage];
return( 0 ); return( 0 );
} }
...@@ -463,7 +463,7 @@ static int ControlVideo( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -463,7 +463,7 @@ static int ControlVideo( vout_thread_t *p_vout, int i_query, va_list args )
{ {
case VOUT_SET_STAY_ON_TOP: case VOUT_SET_STAY_ON_TOP:
b_arg = va_arg( args, vlc_bool_t ); b_arg = va_arg( args, vlc_bool_t );
[p_vout->p_sys->o_window setOnTop: b_arg]; [p_vout->p_sys->o_vout_view setOnTop: b_arg];
return VLC_SUCCESS; return VLC_SUCCESS;
case VOUT_CLOSE: case VOUT_CLOSE:
...@@ -488,12 +488,12 @@ static int CoToggleFullscreen( vout_thread_t *p_vout ) ...@@ -488,12 +488,12 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
{ {
/* Save window size and position */ /* Save window size and position */
p_vout->p_sys->s_frame.size = p_vout->p_sys->s_frame.size =
[[p_vout->p_sys->o_window contentView] frame].size; [p_vout->p_sys->o_vout_view frame].size;
p_vout->p_sys->s_frame.origin = p_vout->p_sys->s_frame.origin =
[p_vout->p_sys->o_window frame].origin; [[p_vout->p_sys->o_vout_view getWindow] frame].origin;
p_vout->p_sys->b_saved_frame = VLC_TRUE; p_vout->p_sys->b_saved_frame = VLC_TRUE;
} }
[p_vout->p_sys->o_window close]; [p_vout->p_sys->o_vout_view closeVout];
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
...@@ -503,14 +503,14 @@ static int CoToggleFullscreen( vout_thread_t *p_vout ) ...@@ -503,14 +503,14 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
if( p_vout->p_sys->b_saved_frame ) if( p_vout->p_sys->b_saved_frame )
{ {
p_vout->p_sys->o_window = [[VLCWindow alloc] p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
initWithVout: p_vout view: o_qtview subView: o_qtview
frame: &p_vout->p_sys->s_frame]; frame: &p_vout->p_sys->s_frame];
} }
else else
{ {
p_vout->p_sys->o_window = [[VLCWindow alloc] p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
initWithVout: p_vout view: o_qtview frame: nil]; subView: o_qtview frame: nil];
} }
/* Retrieve the QuickDraw port */ /* Retrieve the QuickDraw port */
......
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