Commit 02857df0 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

interface.c: Support execution of the interface Run() method on first thread.

parent 88ef1217
...@@ -55,6 +55,7 @@ struct intf_thread_t ...@@ -55,6 +55,7 @@ struct intf_thread_t
/* Thread properties and locks */ /* Thread properties and locks */
vlc_bool_t b_play; vlc_bool_t b_play;
vlc_bool_t b_should_run_on_first_thread;
/* Specific interfaces */ /* Specific interfaces */
intf_console_t * p_console; /** console */ intf_console_t * p_console; /** console */
......
...@@ -41,10 +41,6 @@ ...@@ -41,10 +41,6 @@
#include "vlc_interface.h" #include "vlc_interface.h"
#include "modules/modules.h" // Gruik! #include "modules/modules.h" // Gruik!
#ifdef __APPLE__
# include <Cocoa/Cocoa.h>
#endif
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -55,21 +51,6 @@ static int SwitchIntfCallback( vlc_object_t *, char const *, ...@@ -55,21 +51,6 @@ static int SwitchIntfCallback( vlc_object_t *, char const *,
static int AddIntfCallback( vlc_object_t *, char const *, static int AddIntfCallback( vlc_object_t *, char const *,
vlc_value_t , vlc_value_t , void * ); vlc_value_t , vlc_value_t , void * );
#ifdef __APPLE__
static void Manager( intf_thread_t *p_intf );
/*****************************************************************************
* VLCApplication interface
*****************************************************************************/
@interface VLCApplication : NSApplication
{
libvlc_int_t *o_libvlc;
}
- (void)setVLC: (libvlc_int_t *)p_libvlc;
@end
#endif
/***************************************************************************** /*****************************************************************************
* intf_Create: prepare interface before main loop * intf_Create: prepare interface before main loop
***************************************************************************** *****************************************************************************
...@@ -146,43 +127,16 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module, ...@@ -146,43 +127,16 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module,
*/ */
int intf_RunThread( intf_thread_t *p_intf ) int intf_RunThread( intf_thread_t *p_intf )
{ {
#ifdef __APPLE__
# warning FIXME
#if 0
NSAutoreleasePool * o_pool;
/* If !clivlc, then run as a OS X application */
if( strncmp( p_intf->p_libvlc->psz_object_name, "clivlc", 6) )
{
o_pool = [[NSAutoreleasePool alloc] init];
[VLCApplication sharedApplication];
[NSApp setVLC: p_intf->p_libvlc];
if( p_intf->pf_run )
RunInterface( p_intf );
else
{
[NSApp run];
while( !intf_ShouldDie( p_intf ) )
msleep( INTF_IDLE_SLEEP * 2);
}
vlc_object_kill( p_intf );
return VLC_SUCCESS;
}
#endif
#endif
/* This interface doesn't need to be run */ /* This interface doesn't need to be run */
if( p_intf->pf_run == NULL ) if( p_intf->pf_run == NULL )
return VLC_SUCCESS; return VLC_SUCCESS;
/* Run the interface in a separate thread */ /* Hack to get Mac OS X Cocoa runtime,
if( !strcmp( p_intf->p_module->psz_object_name, "macosx" ) ) * which need access to the main thread */
if( p_intf->b_should_run_on_first_thread )
{ {
msg_Err( p_intf, "You cannot run the MacOS X module as an " RunInterface( p_intf );
"extra interface. Please read the " return VLC_SUCCESS;
"README.MacOSX.rtf file.");
return VLC_EGENERIC;
} }
/* Run the interface in a separate thread */ /* Run the interface in a separate thread */
...@@ -238,29 +192,6 @@ void intf_Destroy( intf_thread_t *p_intf ) ...@@ -238,29 +192,6 @@ void intf_Destroy( intf_thread_t *p_intf )
/* Following functions are local */ /* Following functions are local */
/*****************************************************************************
* Manager: helper thread for blocking OS X
*****************************************************************************/
#ifdef __APPLE__
static void Manager( intf_thread_t *p_intf )
{
while( !p_intf->b_die )
{
msleep( INTF_IDLE_SLEEP );
if( p_intf->p_libvlc->b_die )
{
p_intf->b_die = VLC_TRUE;
if( strncmp( p_intf->p_libvlc->psz_object_name, "clivlc", 6 ) )
{
[NSApp stop: NULL];
}
return;
}
}
}
#endif
/***************************************************************************** /*****************************************************************************
* RunInterface: setups necessary data and give control to the interface * RunInterface: setups necessary data and give control to the interface
*****************************************************************************/ *****************************************************************************/
...@@ -407,23 +338,3 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -407,23 +338,3 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
#ifdef __APPLE__
/*****************************************************************************
* VLCApplication implementation
*****************************************************************************/
@implementation VLCApplication
- (void)setVLC: (libvlc_int_t *) p_libvlc
{
o_libvlc = p_libvlc;
}
- (void)terminate: (id)sender
{
vlc_object_kill( o_libvlc );
[super terminate: sender];
}
@end
#endif
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