Commit d0166d2b authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: added basic 'vout window nsobject' capabilities with a test window

not fully functional yet
parent 2b9cd401
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
IBOutlet id o_playlist_view; IBOutlet id o_playlist_view;
IBOutlet id o_playlist_table; IBOutlet id o_playlist_table;
IBOutlet id o_vlc_main; IBOutlet id o_vlc_main;
IBOutlet id o_video_view;
NSImage * o_img_play; NSImage * o_img_play;
NSImage * o_img_play_pressed; NSImage * o_img_play_pressed;
...@@ -82,6 +83,8 @@ ...@@ -82,6 +83,8 @@
- (void)controlTintChanged; - (void)controlTintChanged;
- (id)videoView;
- (void)setTime: (NSString *)o_arg_ime position: (float)f_position; - (void)setTime: (NSString *)o_arg_ime position: (float)f_position;
- (id)getPgbar; - (id)getPgbar;
- (void)playStatusUpdated: (int)i_status; - (void)playStatusUpdated: (int)i_status;
......
...@@ -141,6 +141,8 @@ ...@@ -141,6 +141,8 @@
/* we don't want this window to be restored on relaunch */ /* we don't want this window to be restored on relaunch */
if ([self respondsToSelector:@selector(setRestorable:)]) if ([self respondsToSelector:@selector(setRestorable:)])
[self setRestorable:NO]; [self setRestorable:NO];
[self makeKeyAndOrderFront: self];
} }
- (void)controlTintChanged - (void)controlTintChanged
...@@ -181,6 +183,11 @@ ...@@ -181,6 +183,11 @@
[super dealloc]; [super dealloc];
} }
- (id)videoView
{
return o_video_view;
}
- (void)setTime:(NSString *)o_arg_time position:(float)f_position - (void)setTime:(NSString *)o_arg_time position:(float)f_position
{ {
[o_time setStringValue: o_arg_time]; [o_time setStringValue: o_arg_time];
......
...@@ -208,6 +208,7 @@ struct intf_sys_t ...@@ -208,6 +208,7 @@ struct intf_sys_t
- (id)info; - (id)info;
- (id)wizard; - (id)wizard;
- (id)embeddedList; - (id)embeddedList;
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
- (id)coreDialogProvider; - (id)coreDialogProvider;
- (id)mainIntfPgbar; - (id)mainIntfPgbar;
- (id)controllerWindow; - (id)controllerWindow;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <vlc_url.h> #include <vlc_url.h>
#include <vlc_modules.h> #include <vlc_modules.h>
#include <vlc_aout_intf.h> #include <vlc_aout_intf.h>
#include <vlc_vout_window.h>
#include <unistd.h> /* execl() */ #include <unistd.h> /* execl() */
#import "intf.h" #import "intf.h"
...@@ -106,6 +107,53 @@ void CloseIntf ( vlc_object_t *p_this ) ...@@ -106,6 +107,53 @@ void CloseIntf ( vlc_object_t *p_this )
free( p_intf->p_sys ); free( p_intf->p_sys );
} }
static int WindowControl( vout_window_t *, int i_query, va_list );
int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf) {
msg_Err( p_wnd, "Mac OS X interface not found" );
return VLC_EGENERIC;
}
msg_Dbg( p_wnd, "looking for video view" );
int i_x = cfg->x;
int i_y = cfg->y;
unsigned i_width = cfg->width;
unsigned i_height = cfg->height;
p_wnd->handle.nsobject = [[VLCMain sharedInstance] getVideoViewAtPositionX: &i_x Y: &i_y withWidth: &i_width andHeight: &i_height];
if ( !p_wnd->handle.nsobject ) {
msg_Err( p_wnd, "got no video view from the interface" );
return VLC_EGENERIC;
}
p_wnd->control = WindowControl;
p_wnd->sys = (vout_window_sys_t *)VLCIntf;
return VLC_SUCCESS;
}
static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
{
/* TODO */
if( i_query == VOUT_WINDOW_SET_STATE )
NSLog( @"WindowControl:VOUT_WINDOW_SET_STATE" );
else if( i_query == VOUT_WINDOW_SET_SIZE )
NSLog( @"WindowControl:VOUT_WINDOW_SET_SIZE" );
else if( i_query == VOUT_WINDOW_SET_FULLSCREEN )
NSLog( @"WindowControl:VOUT_WINDOW_SET_FULLSCREEN" );
else
NSLog( @"WindowControl: unknown query" );
return VLC_SUCCESS;
}
void WindowClose( vout_window_t *p_wnd )
{
NSLog( @"Window Close" );
// tell the interface to get rid of the video, TODO
}
/***************************************************************************** /*****************************************************************************
* Run: main loop * Run: main loop
*****************************************************************************/ *****************************************************************************/
...@@ -1183,6 +1231,22 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1183,6 +1231,22 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return o_wizard; return o_wizard;
} }
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height
{
id videoView = [o_embedded_window videoView];
NSRect videoRect = [videoView frame];
int i_x = (int)videoRect.origin.x;
int i_y = (int)videoRect.origin.y;
unsigned int i_width = (int)videoRect.size.width;
unsigned int i_height = (int)videoRect.size.height;
pi_x = (int *)i_x;
pi_y = (int *)i_y;
pi_width = (unsigned int*)i_width;
pi_height = (unsigned int*)i_height;
msg_Dbg( VLCIntf, "returning videoview with x=%i, y=%i, width=%i, height=%i", i_x, i_y, i_width, i_height );
return videoView;
}
- (id)embeddedList - (id)embeddedList
{ {
if( o_embedded_list ) if( o_embedded_list )
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_vout_window.h>
/***************************************************************************** /*****************************************************************************
* External prototypes * External prototypes
...@@ -45,6 +46,9 @@ ...@@ -45,6 +46,9 @@
int OpenIntf ( vlc_object_t * ); int OpenIntf ( vlc_object_t * );
void CloseIntf ( vlc_object_t * ); void CloseIntf ( vlc_object_t * );
int WindowOpen ( vout_window_t *, const vout_window_cfg_t * );
void WindowClose ( vout_window_t * );
int OpenVideoGL ( vlc_object_t * ); int OpenVideoGL ( vlc_object_t * );
void CloseVideoGL ( vlc_object_t * ); void CloseVideoGL ( vlc_object_t * );
...@@ -117,11 +121,9 @@ vlc_module_begin () ...@@ -117,11 +121,9 @@ vlc_module_begin ()
false ) false )
add_submodule () add_submodule ()
set_description( "Mac OS X OpenGL" ) set_description( "Mac OS X Video Output Provider" )
set_capability( "opengl provider", 100 ) set_capability( "vout window nsobject", 100 )
set_category( CAT_VIDEO) set_callbacks( WindowOpen, WindowClose )
set_subcategory( SUBCAT_VIDEO_VOUT )
// set_callbacks( OpenVideoGL, CloseVideoGL )
add_integer( "macosx-vdev", 0, VDEV_TEXT, VDEV_LONGTEXT, add_integer( "macosx-vdev", 0, VDEV_TEXT, VDEV_LONGTEXT,
false ) false )
......
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