Commit bf680e8f authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* OSX lowlevel work

  - The VLCApplication is now launched at the vlc.c level instead of at the module level. Allows VLC to be a more valid Mac application, also removes the vout intf dependancy (use ncurses to disp. video :).
    This wasn't done at the libvlc level, because a mozilla plugin would no longer be able to function properly.
  - Some functionality of the macosx vout may not work without the OS X GUI, and not all of this is checked yet.
  - There is a symlink in VLC.app/Contents/Mac called clivlc that will force it back to a fullblown cli app when you want, so it can still be run by a user who isn't logged in via GUI.
  - there are some autorelease leaks which need to be tackled.
  - moved a lot of the VLCApplication func. to the VLCMain class.
  - VLCMain is a +sharedInstance now.
  - the complete OS X interface is still badly broken because of the many API changes lately. any volunteers?

Examples:
VLC.app/Contents/MacOS/VLC [-I macosx]
launches VLC as before (requires you to be logged in via GUI)

VLC.app/Contents/MacOS/VLC -I ncurses
launch vlc with a ncurses intf and display video on your mac
(requires you to be logged in via GUI)

VLC.app/Contents/MacOS/clivlc -I telnet -d
launch vlm remotely trough ssh in daemon mode, on a GUI'less server for instance, and stream your vids

Now how is that for combining GUI and cli in one application on the mac?!!? :)
jlj? I finally understand now how the OS X interface works !
parent 7b5375e2
...@@ -492,6 +492,7 @@ VLC.app: vlc ...@@ -492,6 +492,7 @@ VLC.app: vlc
$(INSTALL) -d $(top_builddir)/VLC.app/Contents/MacOS $(INSTALL) -d $(top_builddir)/VLC.app/Contents/MacOS
$(INSTALL) $(top_builddir)/vlc \ $(INSTALL) $(top_builddir)/vlc \
$(top_builddir)/VLC.app/Contents/MacOS/VLC $(top_builddir)/VLC.app/Contents/MacOS/VLC
ln -sf ./VLC $(top_builddir)/VLC.app/Contents/MacOS/clivlc
$(INSTALL) -d $(top_builddir)/VLC.app/Contents/MacOS/modules $(INSTALL) -d $(top_builddir)/VLC.app/Contents/MacOS/modules
for i in "" `$(VLC_CONFIG) --target plugin` ; do \ for i in "" `$(VLC_CONFIG) --target plugin` ; do \
if test -n "$$i" ; \ if test -n "$$i" ; \
......
...@@ -183,6 +183,13 @@ Description: DVB info in NIT ...@@ -183,6 +183,13 @@ Description: DVB info in NIT
We need to get the information of a DVB stream that are in the NIT (current program, next program, ...) We need to get the information of a DVB stream that are in the NIT (current program, next program, ...)
Status: Todo Status: Todo
Task
Difficulty: Medium
Urgency: Wishlist
Platform: any
Description: IceCast/ShoutCast serving
This would be a nice thing for the sake of completeness of VLC's streaming capabilities.
Status: Todo
Task Task
Difficulty: Hard Difficulty: Hard
......
...@@ -120,6 +120,7 @@ case "${target_os}" in ...@@ -120,6 +120,7 @@ case "${target_os}" in
OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; OBJCFLAGS="${OBJCFLAGS_save}" OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; OBJCFLAGS="${OBJCFLAGS_save}"
VLC_ADD_LDFLAGS([vlc ffmpeg],[-all_load]) VLC_ADD_LDFLAGS([vlc ffmpeg],[-all_load])
VLC_ADD_LDFLAGS([mp4], [-framework IOKit -framework CoreFoundation]) VLC_ADD_LDFLAGS([mp4], [-framework IOKit -framework CoreFoundation])
VLC_ADD_CFLAGS([vlc],[-x objective-c])
VLC_ADD_LDFLAGS([vlc],[-Wl,-multiply_defined,suppress]) VLC_ADD_LDFLAGS([vlc],[-Wl,-multiply_defined,suppress])
;; ;;
*mingw32* | *cygwin*) *mingw32* | *cygwin*)
...@@ -1237,7 +1238,6 @@ then ...@@ -1237,7 +1238,6 @@ then
],[ ],[
if test -n "${enable_dvdread}" if test -n "${enable_dvdread}"
then then
AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
AC_MSG_ERROR([cannot find libdvdread headers]) AC_MSG_ERROR([cannot find libdvdread headers])
fi fi
]) ])
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
</array> </array>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>29</integer>
<integer>1617</integer>
<integer>21</integer> <integer>21</integer>
<integer>1617</integer>
<integer>1647</integer> <integer>1647</integer>
<integer>29</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>7F44</string> <string>7H63</string>
</dict> </dict>
</plist> </plist>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] ) if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist == NULL ) if( p_playlist == NULL )
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
- (id)performDefaultImplementation { - (id)performDefaultImplementation {
NSString *o_command = [[self commandDescription] commandName]; NSString *o_command = [[self commandDescription] commandName];
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist == NULL ) if( p_playlist == NULL )
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
{ {
vlc_value_t val; vlc_value_t val;
playlist_t * p_playlist; playlist_t * p_playlist;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
- (IBAction)stop:(id)sender - (IBAction)stop:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist != NULL ) if( p_playlist != NULL )
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
- (IBAction)faster:(id)sender - (IBAction)faster:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_input != NULL ) if( p_input != NULL )
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
- (IBAction)slower:(id)sender - (IBAction)slower:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_input != NULL ) if( p_input != NULL )
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
- (IBAction)prev:(id)sender - (IBAction)prev:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist ) if( p_playlist )
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
- (IBAction)next:(id)sender - (IBAction)next:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist ) if( p_playlist )
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
- (IBAction)random:(id)sender - (IBAction)random:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
vlc_value_t val; vlc_value_t val;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
- (IBAction)repeat:(id)sender - (IBAction)repeat:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
vlc_value_t val; vlc_value_t val;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
- (IBAction)loop:(id)sender - (IBAction)loop:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
vlc_value_t val; vlc_value_t val;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
- (IBAction)forward:(id)sender - (IBAction)forward:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_input != NULL ) if( p_input != NULL )
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
- (IBAction)backward:(id)sender - (IBAction)backward:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_input != NULL ) if( p_input != NULL )
...@@ -279,7 +279,7 @@ ...@@ -279,7 +279,7 @@
- (IBAction)volumeUp:(id)sender - (IBAction)volumeUp:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
if( p_intf->p_sys->b_mute ) if( p_intf->p_sys->b_mute )
{ {
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
- (IBAction)volumeDown:(id)sender - (IBAction)volumeDown:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
if( p_intf->p_sys->b_mute ) if( p_intf->p_sys->b_mute )
{ {
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
- (IBAction)mute:(id)sender - (IBAction)mute:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeMute( p_intf, &i_volume ); aout_VolumeMute( p_intf, &i_volume );
...@@ -318,7 +318,7 @@ ...@@ -318,7 +318,7 @@
- (IBAction)volumeSliderUpdated:(id)sender - (IBAction)volumeSliderUpdated:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
audio_volume_t i_volume = (audio_volume_t)[sender intValue]; audio_volume_t i_volume = (audio_volume_t)[sender intValue];
aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP ); aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP );
...@@ -326,7 +326,7 @@ ...@@ -326,7 +326,7 @@
- (void)updateVolumeSlider - (void)updateVolumeSlider
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
NSString *o_title = [sender title]; NSString *o_title = [sender title];
NSArray *o_windows = [NSApp orderedWindows]; NSArray *o_windows = [NSApp orderedWindows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator]; NSEnumerator *o_enumerator = [o_windows objectEnumerator];
vout_thread_t *p_vout = vlc_object_find( [NSApp getIntf], VLC_OBJECT_VOUT, vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_vout != NULL ) if( p_vout != NULL )
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
/* Get the descriptive name of the variable */ /* Get the descriptive name of the variable */
var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL ); var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL );
[o_mi setTitle: [NSApp localizedString: text.psz_string ? [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ?
text.psz_string : strdup( psz_variable ) ]]; text.psz_string : strdup( psz_variable ) ]];
var_Get( p_object, psz_variable, &val ); var_Get( p_object, psz_variable, &val );
...@@ -523,7 +523,7 @@ ...@@ -523,7 +523,7 @@
another_val.psz_string = another_val.psz_string =
strdup(val_list.p_list->p_values[i].psz_string); strdup(val_list.p_list->p_values[i].psz_string);
o_title = [NSApp localizedString: text_list.p_list->p_values[i].psz_string ? o_title = [[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string ?
text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ]; text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ];
o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""]; o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
...@@ -540,7 +540,7 @@ ...@@ -540,7 +540,7 @@
case VLC_VAR_INTEGER: case VLC_VAR_INTEGER:
o_title = text_list.p_list->p_values[i].psz_string ? o_title = text_list.p_list->p_values[i].psz_string ?
[NSApp localizedString: strdup( text_list.p_list->p_values[i].psz_string )] : [[VLCMain sharedInstance] localizedString: strdup( text_list.p_list->p_values[i].psz_string )] :
[NSString stringWithFormat: @"%d", [NSString stringWithFormat: @"%d",
val_list.p_list->p_values[i].i_int]; val_list.p_list->p_values[i].i_int];
...@@ -580,9 +580,9 @@ ...@@ -580,9 +580,9 @@
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
VLCMenuExt *o_data = (VLCMenuExt *)_o_data; VLCMenuExt *o_data = (VLCMenuExt *)_o_data;
vlc_thread_set_priority( [NSApp getIntf] , VLC_THREAD_PRIORITY_LOW ); vlc_thread_set_priority( VLCIntf , VLC_THREAD_PRIORITY_LOW );
p_object = (vlc_object_t *)vlc_object_get( [NSApp getIntf], p_object = (vlc_object_t *)vlc_object_get( VLCIntf,
[o_data objectID] ); [o_data objectID] );
if( p_object != NULL ) if( p_object != NULL )
...@@ -604,7 +604,7 @@ ...@@ -604,7 +604,7 @@
{ {
BOOL bEnabled = TRUE; BOOL bEnabled = TRUE;
vlc_value_t val; vlc_value_t val;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
......
...@@ -31,33 +31,18 @@ ...@@ -31,33 +31,18 @@
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
/***************************************************************************** /*****************************************************************************
* VLCApplication interface * Local prototypes.
*****************************************************************************/ *****************************************************************************/
@interface VLCApplication : NSApplication int ExecuteOnMainThread( id target, SEL sel, void * p_arg );
{ unsigned int CocoaKeyToVLC( unichar i_key );
intf_thread_t *p_intf;
}
- (NSString *)localizedString:(char *)psz;
- (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
- (void)setIntf:(intf_thread_t *)p_intf;
- (intf_thread_t *)getIntf;
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
@end #define VLCIntf [[VLCMain sharedInstance] getIntf]
#define _NS(s) [NSApp localizedString: _(s)] #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
/* Get an alternate version of the string. /* Get an alternate version of the string.
* This string is stored as '1:string' but when displayed it only displays * This string is stored as '1:string' but when displayed it only displays
* the translated string. the translation should be '1:translatedstring' though */ * the translated string. the translation should be '1:translatedstring' though */
#define _ANS(s) [[NSApp localizedString: _(s)] substringFromIndex:2] #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
int ExecuteOnMainThread( id target, SEL sel, void * p_arg );
int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
unsigned int CocoaKeyToVLC( unichar i_key );
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of the interface * intf_sys_t: description and status of the interface
...@@ -92,6 +77,7 @@ struct intf_sys_t ...@@ -92,6 +77,7 @@ struct intf_sys_t
*****************************************************************************/ *****************************************************************************/
@interface VLCMain : NSObject @interface VLCMain : NSObject
{ {
intf_thread_t *p_intf; /* The main intf object */
id o_prefs; /* VLCPrefs */ id o_prefs; /* VLCPrefs */
IBOutlet id o_window; /* main window */ IBOutlet id o_window; /* main window */
...@@ -238,10 +224,19 @@ struct intf_sys_t ...@@ -238,10 +224,19 @@ struct intf_sys_t
IBOutlet id o_dmi_mute; IBOutlet id o_dmi_mute;
} }
+ (VLCMain *)sharedInstance;
- (intf_thread_t *)getIntf;
- (void)setIntf:(intf_thread_t *)p_mainintf;
- (id)getControls; - (id)getControls;
- (id)getPlaylist; - (id)getPlaylist;
- (id)getInfo; - (id)getInfo;
- (void)terminate; - (void)terminate;
- (NSString *)localizedString:(char *)psz;
- (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
- (void)initStrings; - (void)initStrings;
......
This diff is collapsed.
...@@ -44,8 +44,7 @@ ...@@ -44,8 +44,7 @@
- (BOOL)performKeyEquivalent:(NSEvent *)o_event - (BOOL)performKeyEquivalent:(NSEvent *)o_event
{ {
return [( (VLCApplication *) [VLCApplication sharedApplication] ) return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event];
hasDefinedShortcutKey:o_event];
} }
@end @end
...@@ -110,7 +109,7 @@ ...@@ -110,7 +109,7 @@
o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"]; o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
o_array = [o_array arrayByAddingObject: o_dic]; o_array = [o_array arrayByAddingObject: o_dic];
} }
[(VLCPlaylist *)[[NSApp delegate] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO]; [(VLCPlaylist *)[[VLCMain sharedInstance] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO];
return YES; return YES;
} }
} }
...@@ -188,7 +187,7 @@ ...@@ -188,7 +187,7 @@
o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"]; o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
o_array = [o_array arrayByAddingObject: o_dic]; o_array = [o_array arrayByAddingObject: o_dic];
} }
[(VLCPlaylist *)[[NSApp delegate] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO]; [[[VLCMain sharedInstance] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO];
return YES; return YES;
} }
} }
......
...@@ -130,7 +130,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -130,7 +130,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
- (void)awakeFromNib - (void)awakeFromNib
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
[o_panel setTitle: _NS("Open Source")]; [o_panel setTitle: _NS("Open Source")];
[o_mrl_lbl setTitle: _NS("Media Resource Locator (MRL)")]; [o_mrl_lbl setTitle: _NS("Media Resource Locator (MRL)")];
...@@ -573,7 +573,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -573,7 +573,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
{ {
NSString *o_mode; NSString *o_mode;
NSString *o_mrl_string = [NSString string]; NSString *o_mrl_string = [NSString string];
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
o_mode = [[o_net_mode selectedCell] title]; o_mode = [[o_net_mode selectedCell] title];
......
...@@ -397,7 +397,7 @@ ...@@ -397,7 +397,7 @@
- (void)TTLChanged:(NSNotification *)o_notification - (void)TTLChanged:(NSNotification *)o_notification
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
config_PutInt( p_intf, "ttl", [o_stream_ttl intValue] ); config_PutInt( p_intf, "ttl", [o_stream_ttl intValue] );
} }
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
NSNumber *o_number; NSNumber *o_number;
playlist_t * p_playlist; playlist_t * p_playlist;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
if( [[o_event characters] length] ) if( [[o_event characters] length] )
{ {
...@@ -191,7 +191,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -191,7 +191,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (void) tableView:(NSTableView*)o_tv - (void) tableView:(NSTableView*)o_tv
didClickTableColumn:(NSTableColumn *)o_tc didClickTableColumn:(NSTableColumn *)o_tc
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t *p_playlist = playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -264,7 +264,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -264,7 +264,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (NSMenu *)menuForEvent:(NSEvent *)o_event - (NSMenu *)menuForEvent:(NSEvent *)o_event
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -316,7 +316,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -316,7 +316,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (IBAction)savePlaylist:(id)sender - (IBAction)savePlaylist:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -335,7 +335,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -335,7 +335,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (IBAction)playItem:(id)sender - (IBAction)playItem:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -352,7 +352,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -352,7 +352,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
NSMutableArray *o_to_delete; NSMutableArray *o_to_delete;
NSNumber *o_number; NSNumber *o_number;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -392,7 +392,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -392,7 +392,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
NSMutableArray *o_selected; NSMutableArray *o_selected;
NSNumber *o_number; NSNumber *o_number;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -434,7 +434,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -434,7 +434,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (IBAction)enableGroup:(id)sender - (IBAction)enableGroup:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -448,7 +448,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -448,7 +448,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (IBAction)disableGroup:(id)sender - (IBAction)disableGroup:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -472,7 +472,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -472,7 +472,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
NSString *o_current_name; NSString *o_current_name;
NSString *o_current_author; NSString *o_current_author;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -528,7 +528,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -528,7 +528,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (IBAction)handlePopUp:(id)sender - (IBAction)handlePopUp:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
vlc_value_t val1,val2; vlc_value_t val1,val2;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -576,7 +576,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -576,7 +576,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
{ {
int i_item; int i_item;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -667,7 +667,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -667,7 +667,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (void)playlistUpdated - (void)playlistUpdated
{ {
vlc_value_t val1, val2; vlc_value_t val1, val2;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist != NULL ) if( p_playlist != NULL )
...@@ -698,7 +698,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -698,7 +698,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{ {
int i_row; int i_row;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -728,7 +728,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -728,7 +728,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (void)deleteGroup:(int)i_id - (void)deleteGroup:(int)i_id
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
int i; int i;
...@@ -833,7 +833,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -833,7 +833,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (int)numberOfRowsInTableView:(NSTableView *)o_tv - (int)numberOfRowsInTableView:(NSTableView *)o_tv
{ {
int i_count = 0; int i_count = 0;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -853,7 +853,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -853,7 +853,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
row:(int)i_row row:(int)i_row
{ {
id o_value = nil; id o_value = nil;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -922,7 +922,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -922,7 +922,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
forTableColumn:(NSTableColumn *)o_tc forTableColumn:(NSTableColumn *)o_tc
row:(int)i_rows row:(int)i_rows
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if (p_playlist) if (p_playlist)
...@@ -998,7 +998,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -998,7 +998,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{ {
if (i_moveRow != -1 && i_proposed_row != -1) if (i_moveRow != -1 && i_proposed_row != -1)
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
} }
else else
{ {
i_item = [[[NSApp delegate] getPlaylist] selectedPlaylistItem]; i_item = [[[VLCMain sharedInstance] getPlaylist] selectedPlaylistItem];
o_selected = [[[NSApp delegate] getPlaylist] selectedPlaylistItemsList]; o_selected = [[[VLCMain sharedInstance] getPlaylist] selectedPlaylistItemsList];
[o_selected retain]; [o_selected retain];
[self initPanel:sender]; [self initPanel:sender];
} }
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
} }
else else
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
- (void)initPanel:(id)sender - (void)initPanel:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist; playlist_t * p_playlist;
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
- (IBAction)infoOk:(id)sender - (IBAction)infoOk:(id)sender
{ {
int i,i_row,c; int i,i_row,c;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
vlc_value_t val; vlc_value_t val;
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
- (IBAction)handleGroup:(id)sender - (IBAction)handleGroup:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -228,13 +228,13 @@ ...@@ -228,13 +228,13 @@
if ([[o_group_cbx stringValue] isEqual: if ([[o_group_cbx stringValue] isEqual:
[o_group_cbx objectValueOfSelectedItem]]) [o_group_cbx objectValueOfSelectedItem]])
{ {
[o_group_color setBackgroundColor:[[[NSApp delegate] getPlaylist] [o_group_color setBackgroundColor:[[[VLCMain sharedInstance] getPlaylist]
getColor: p_playlist->pp_groups[ getColor: p_playlist->pp_groups[
[o_group_cbx indexOfSelectedItem]]->i_id]]; [o_group_cbx indexOfSelectedItem]]->i_id]];
} }
else else
{ {
[o_group_color setBackgroundColor:[[[NSApp delegate] getPlaylist] [o_group_color setBackgroundColor:[[[VLCMain sharedInstance] getPlaylist]
getColor:p_playlist->pp_groups[ getColor:p_playlist->pp_groups[
[o_group_cbx numberOfItems] - 1]->i_id + 1]]; [o_group_cbx numberOfItems] - 1]->i_id + 1]];
} }
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
- (IBAction)deleteOutlineGroup:(id)sender - (IBAction)deleteOutlineGroup:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
if ([[o_group_cbx stringValue] isEqual: if ([[o_group_cbx stringValue] isEqual:
[o_group_cbx objectValueOfSelectedItem]]) [o_group_cbx objectValueOfSelectedItem]])
{ {
[[[NSApp delegate] getPlaylist] deleteGroup:p_playlist->pp_groups[ [[[VLCMain sharedInstance] getPlaylist] deleteGroup:p_playlist->pp_groups[
[o_group_cbx indexOfSelectedItem]]->i_id]; [o_group_cbx indexOfSelectedItem]]->i_id];
[self createComboBox]; [self createComboBox];
[self handleGroup:self]; [self handleGroup:self];
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
- (IBAction)createOutlineGroup:(id)sender; - (IBAction)createOutlineGroup:(id)sender;
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if(p_playlist) if(p_playlist)
...@@ -278,14 +278,14 @@ ...@@ -278,14 +278,14 @@
strdup([[o_group_cbx stringValue] cString])); strdup([[o_group_cbx stringValue] cString]));
[self createComboBox]; [self createComboBox];
[o_group_cbx reloadData]; [o_group_cbx reloadData];
[[[NSApp delegate] getPlaylist] playlistUpdated]; [[[VLCMain sharedInstance] getPlaylist] playlistUpdated];
vlc_object_release(p_playlist); vlc_object_release(p_playlist);
} }
} }
-(void)createComboBox -(void)createComboBox
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
int i; int i;
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
{ {
BOOL bEnabled = TRUE; BOOL bEnabled = TRUE;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -387,7 +387,7 @@ static VLCInfoTreeItem *o_root_item = nil; ...@@ -387,7 +387,7 @@ static VLCInfoTreeItem *o_root_item = nil;
o_value = [o_item_value copy]; o_value = [o_item_value copy];
i_object_id = i_id; i_object_id = i_id;
o_parent = o_parent_item; o_parent = o_parent_item;
i_item = [[[NSApp delegate] getInfo] getItem]; i_item = [[[VLCMain sharedInstance] getInfo] getItem];
} }
return( self ); return( self );
} }
...@@ -410,7 +410,7 @@ static VLCInfoTreeItem *o_root_item = nil; ...@@ -410,7 +410,7 @@ static VLCInfoTreeItem *o_root_item = nil;
{ {
if (o_children == NULL) if (o_children == NULL)
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
int i; int i;
...@@ -491,7 +491,7 @@ static VLCInfoTreeItem *o_root_item = nil; ...@@ -491,7 +491,7 @@ static VLCInfoTreeItem *o_root_item = nil;
*/ */
- (void)refresh - (void)refresh
{ {
i_item = [[[NSApp delegate] getInfo] getItem]; i_item = [[[VLCMain sharedInstance] getInfo] getItem];
if (o_children != NULL) if (o_children != NULL)
{ {
[o_children release]; [o_children release];
......
This diff is collapsed.
...@@ -119,26 +119,6 @@ int E_(OpenVideo) ( vlc_object_t *p_this ) ...@@ -119,26 +119,6 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
return( 1 ); return( 1 );
} }
if( [NSApp respondsToSelector: @selector(getIntf)] )
{
intf_thread_t * p_intf;
for( i_timeout = 10 ; i_timeout-- ; )
{
if( ( p_intf = [NSApp getIntf] ) == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( p_intf == NULL )
{
msg_Err( p_vout, "MacOS X intf has getIntf, but is NULL" );
free( p_vout->p_sys );
return( 1 );
}
}
p_vout->p_sys->b_mouse_moved = VLC_TRUE; p_vout->p_sys->b_mouse_moved = VLC_TRUE;
p_vout->p_sys->i_time_mouse_last_moved = mdate(); p_vout->p_sys->i_time_mouse_last_moved = mdate();
...@@ -613,12 +593,12 @@ static int CoSendRequest( vout_thread_t *p_vout, SEL sel ) ...@@ -613,12 +593,12 @@ static int CoSendRequest( vout_thread_t *p_vout, SEL sel )
interface. We do not check if this interface exists, since it has interface. We do not check if this interface exists, since it has
already been done before.*/ already been done before.*/
p_intf = [NSApp getIntf]; /*p_intf = VLCIntf;
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
var_Create(p_intf,"intf-change",VLC_VAR_BOOL); var_Create(p_intf,"intf-change",VLC_VAR_BOOL);
var_Set(p_intf, "intf-change",val); var_Set(p_intf, "intf-change",val);
*/
return( i_ret ); return( i_ret );
} }
...@@ -1036,8 +1016,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1036,8 +1016,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
- (BOOL)performKeyEquivalent:(NSEvent *)o_event - (BOOL)performKeyEquivalent:(NSEvent *)o_event
{ {
return [(VLCApplication *) [VLCApplication sharedApplication] return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event];
hasDefinedShortcutKey:o_event];
} }
- (void)keyDown:(NSEvent *)o_event - (void)keyDown:(NSEvent *)o_event
......
...@@ -42,10 +42,13 @@ ...@@ -42,10 +42,13 @@
#include "audio_output.h" #include "audio_output.h"
#include "vlc_interface.h" #include "vlc_interface.h"
#include "vlc_video.h" #include "vlc_video.h"
#include "video_output.h" #include "video_output.h"
#ifdef SYS_DARWIN
# include "Cocoa/Cocoa.h"
#endif /* SYS_DARWIN */
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -127,8 +130,10 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module ) ...@@ -127,8 +130,10 @@ 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 SYS_DARWIN
if( p_intf->b_block ) if( p_intf->b_block )
{ {
/* This is the primary intf */
/* Run a manager thread, launch the interface, kill the manager */ /* Run a manager thread, launch the interface, kill the manager */
if( vlc_thread_create( p_intf, "manager", Manager, if( vlc_thread_create( p_intf, "manager", Manager,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) ) VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
...@@ -136,15 +141,49 @@ int intf_RunThread( intf_thread_t *p_intf ) ...@@ -136,15 +141,49 @@ int intf_RunThread( intf_thread_t *p_intf )
msg_Err( p_intf, "cannot spawn manager thread" ); msg_Err( p_intf, "cannot spawn manager thread" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
}
RunInterface( p_intf ); if( p_intf->b_block && !strncmp( p_intf->p_module->psz_shortname, "macosx" , 6 ) )
{
/* this is OSX, we are cheating :)
This is NOT I REPEAT NOT blocking since [NSApp run] is */
p_intf->b_block = VLC_FALSE;
RunInterface( p_intf );
p_intf->b_block = VLC_TRUE;
}
else if( p_intf->b_block && !strncmp( p_intf->p_vlc->psz_object_name, "clivlc", 6 ) )
{
/* VLC OS X in cli mode ( no blocking [NSApp run] )
this is equal to running in normal non-OSX primary intf mode */
RunInterface( p_intf );
p_intf->b_die = VLC_TRUE; p_intf->b_die = VLC_TRUE;
}
else
{
/* If anything else is the primary intf and we are not in cli mode,
then don't make it blocking ([NSApp run] will be blocking)
but run it in a seperate thread. */
p_intf->b_block = VLC_FALSE;
#else
if( p_intf->b_block )
{
/* Run a manager thread, launch the interface, kill the manager */
if( vlc_thread_create( p_intf, "manager", Manager,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
{
msg_Err( p_intf, "cannot spawn manager thread" );
return VLC_EGENERIC;
}
RunInterface( p_intf );
p_intf->b_die = VLC_TRUE;
/* Do not join the thread... intf_StopThread will do it for us */ /* Do not join the thread... intf_StopThread will do it for us */
} }
else else
{ {
#endif
/* Run the interface in a separate thread */ /* Run the interface in a separate thread */
if( vlc_thread_create( p_intf, "interface", RunInterface, if( vlc_thread_create( p_intf, "interface", RunInterface,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) ) VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
...@@ -228,6 +267,12 @@ static void Manager( intf_thread_t *p_intf ) ...@@ -228,6 +267,12 @@ static void Manager( intf_thread_t *p_intf )
if( p_intf->p_vlc->b_die ) if( p_intf->p_vlc->b_die )
{ {
p_intf->b_die = VLC_TRUE; p_intf->b_die = VLC_TRUE;
#ifdef SYS_DARWIN
if( strncmp( p_intf->p_vlc->psz_object_name, "clivlc", 6 ) )
{
[NSApp stop: NULL];
}
#endif
return; return;
} }
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
* Derk-Jan Hartman <hartman at videolan dot org>
* Lots of other people, see the libvlc AUTHORS file * Lots of other people, see the libvlc AUTHORS file
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -34,9 +35,16 @@ ...@@ -34,9 +35,16 @@
#ifdef HAVE_TIME_H #ifdef HAVE_TIME_H
# include <time.h> /* time() */ # include <time.h> /* time() */
#endif #endif
#ifdef HAVE_STRINGS_H
# include <strings.h> /* strncmp() */
#endif
#include <vlc/vlc.h> #include <vlc/vlc.h>
#ifdef SYS_DARWIN
#include <Cocoa/Cocoa.h>
#endif
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
...@@ -44,14 +52,58 @@ ...@@ -44,14 +52,58 @@
static void SigHandler ( int i_signal ); static void SigHandler ( int i_signal );
#endif #endif
#ifdef SYS_DARWIN
/*****************************************************************************
* VLCApplication interface
*****************************************************************************/
@interface VLCApplication : NSApplication
{
}
@end
/*****************************************************************************
* VLCApplication implementation
*****************************************************************************/
@implementation VLCApplication
- (void)stop: (id)sender
{
NSEvent *o_event;
[super stop:sender];
/* send a dummy event to break out of the event loop */
o_event = [NSEvent mouseEventWithType: NSLeftMouseDown
location: NSMakePoint( 1, 1 ) modifierFlags: 0
timestamp: 1 windowNumber: [[NSApp mainWindow] windowNumber]
context: [NSGraphicsContext currentContext] eventNumber: 1
clickCount: 1 pressure: 0.0];
[NSApp postEvent: o_event atStart: YES];
}
- (void)terminate: (id)sender
{
if( [NSApp isRunning] )
[NSApp stop:sender];
[super terminate: sender];
}
@end
#endif /* SYS_DARWIN */
/***************************************************************************** /*****************************************************************************
* main: parse command line, start interface and spawn threads * main: parse command line, start interface and spawn threads.
*****************************************************************************/ *****************************************************************************/
int main( int i_argc, char *ppsz_argv[] ) int main( int i_argc, char *ppsz_argv[] )
{ {
int i_ret; int i_ret;
int b_cli = VLC_FALSE ;
#ifndef SYS_DARWIN
/* This clutters OSX GUI error logs */
fprintf( stderr, "VLC media player %s\n", VLC_Version() ); fprintf( stderr, "VLC media player %s\n", VLC_Version() );
#endif
#ifdef HAVE_PUTENV #ifdef HAVE_PUTENV
# ifdef DEBUG # ifdef DEBUG
...@@ -98,8 +150,39 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -98,8 +150,39 @@ int main( int i_argc, char *ppsz_argv[] )
return i_ret; return i_ret;
} }
/* Add a blocking interface, start playing, and keep the return value */ #ifdef HAVE_STRINGS_H
/* if first 3 chars of argv[0] are cli, then this is clivlc
* We detect this specifically for Mac OS X, so you can launch vlc
* from the commandline even if you are not logged in on the GUI */
if( i_argc > 0 )
{
char *psz_temp;
char *psz_program = psz_temp = ppsz_argv[0];
while( *psz_temp )
{
if( *psz_temp == '/' ) psz_program = ++psz_temp;
else ++psz_temp;
}
b_cli = !strncmp( psz_program, "cli", 3 );
}
#endif
#ifdef SYS_DARWIN
if( !b_cli )
{
[VLCApplication sharedApplication];
}
i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );
if( !b_cli )
{
/* This is a blocking call */
[NSApp run];
}
#else
i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE ); i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );
#endif /* SYS_DARWIN */
/* Finish the threads */ /* Finish the threads */
VLC_CleanUp( 0 ); VLC_CleanUp( 0 );
...@@ -107,6 +190,13 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -107,6 +190,13 @@ int main( int i_argc, char *ppsz_argv[] )
/* Destroy the libvlc structure */ /* Destroy the libvlc structure */
VLC_Destroy( 0 ); VLC_Destroy( 0 );
#ifdef SYS_DARWIN
if( !b_cli )
{
[NSApp terminate:NULL];
}
#endif /* SYS_DARWIN */
return i_ret; return i_ret;
} }
......
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