Commit db4a6b82 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Fix tabs.

parent 3b44ce0d
......@@ -38,10 +38,10 @@
+ (id)sharedManager;
- (void)callOnMainThreadDelegateOfObject:(id)aTarget
withDelegateMethod:(SEL)aSelector
withNotificationName:(NSString *)aNotificationName;
withDelegateMethod:(SEL)aSelector
withNotificationName:(NSString *)aNotificationName;
- (void)callOnMainThreadObject:(id)aTarget
withMethod:(SEL)aSelector
withArgumentAsObject:(id)arg;
withMethod:(SEL)aSelector
withArgumentAsObject:(id)arg;
@end
......@@ -35,8 +35,8 @@
// TODO: Documentation
@interface VLCLibrary : NSObject
{
void *instance;
VLCAudio *audio;
void *instance;
VLCAudio *audio;
}
/* Factories */
......
......@@ -36,7 +36,7 @@ extern NSString *VLCMediaPlayerVolumeChanged;
// TODO: Documentation
@interface VLCAudio : NSObject
{
VLCLibrary *library; //< Library to control audio for
VLCLibrary *library; //< Library to control audio for
}
/* Initializers */
......
......@@ -30,32 +30,32 @@
/**
* Standard dictionary keys for retreiving meta data.
*/
extern NSString *VLCMetaInformationTitle; /* NSString */
extern NSString *VLCMetaInformationArtist; /* NSString */
extern NSString *VLCMetaInformationTitle; /* NSString */
extern NSString *VLCMetaInformationArtist; /* NSString */
extern NSString *VLCMetaInformationTitle; /* NSString */
extern NSString *VLCMetaInformationArtist; /* NSString */
extern NSString *VLCMetaInformationGenre; /* NSString */
extern NSString *VLCMetaInformationCopyright; /* NSString */
extern NSString *VLCMetaInformationAlbum; /* NSString */
extern NSString *VLCMetaInformationTrackNumber; /* NSString */
extern NSString *VLCMetaInformationDescription; /* NSString */
extern NSString *VLCMetaInformationRating; /* NSString */
extern NSString *VLCMetaInformationDate; /* NSString */
extern NSString *VLCMetaInformationSetting; /* NSString */
extern NSString *VLCMetaInformationURL; /* NSString */
extern NSString *VLCMetaInformationLanguage; /* NSString */
extern NSString *VLCMetaInformationNowPlaying; /* NSString */
extern NSString *VLCMetaInformationPublisher; /* NSString */
extern NSString *VLCMetaInformationEncodedBy; /* NSString */
extern NSString *VLCMetaInformationArtworkURL; /* NSString */
extern NSString *VLCMetaInformationArtist; /* NSString */
extern NSString *VLCMetaInformationGenre; /* NSString */
extern NSString *VLCMetaInformationCopyright; /* NSString */
extern NSString *VLCMetaInformationAlbum; /* NSString */
extern NSString *VLCMetaInformationTrackNumber; /* NSString */
extern NSString *VLCMetaInformationDescription; /* NSString */
extern NSString *VLCMetaInformationRating; /* NSString */
extern NSString *VLCMetaInformationDate; /* NSString */
extern NSString *VLCMetaInformationSetting; /* NSString */
extern NSString *VLCMetaInformationURL; /* NSString */
extern NSString *VLCMetaInformationLanguage; /* NSString */
extern NSString *VLCMetaInformationNowPlaying; /* NSString */
extern NSString *VLCMetaInformationPublisher; /* NSString */
extern NSString *VLCMetaInformationEncodedBy; /* NSString */
extern NSString *VLCMetaInformationArtworkURL; /* NSString */
extern NSString *VLCMetaInformationArtwork; /* NSImage */
extern NSString *VLCMetaInformationTrackID; /* NSString */
extern NSString *VLCMetaInformationTrackID; /* NSString */
/* Notification Messages */
/**
* Available notification messages.
*/
extern NSString *VLCMediaMetaChanged; //< Notification message for when the media's meta data has changed
extern NSString *VLCMediaMetaChanged; //< Notification message for when the media's meta data has changed
// Forward declarations, supresses compiler error messages
@class VLCMediaList;
......@@ -103,13 +103,13 @@ extern NSString *VLCMediaMetaChanged; //< Notification message for when the med
*/
@interface VLCMedia : NSObject
{
void *p_md; //< Internal media descriptor instance
NSString *url; //< URL for this media resource
VLCMediaList *subitems; //< Sub list of items
VLCTime *length; //< Duration of the media
NSMutableDictionary *metaDictionary; //< Meta data storage
id delegate; //< Delegate object
BOOL preparsed; //< Value used to determine of the file has been preparsed
void *p_md; //< Internal media descriptor instance
NSString *url; //< URL for this media resource
VLCMediaList *subitems; //< Sub list of items
VLCTime *length; //< Duration of the media
NSMutableDictionary *metaDictionary; //< Meta data storage
id delegate; //< Delegate object
BOOL preparsed; //< Value used to determine of the file has been preparsed
}
/* Object Factories */
......
......@@ -42,8 +42,8 @@ extern NSString *VLCMediaListItemDeleted;
// TODO: Documentation
@interface VLCMediaList : NSObject
{
void *p_mlist; //< Internal instance of media list
id delegate; //< Delegate object
void *p_mlist; //< Internal instance of media list
id delegate; //< Delegate object
}
/* Properties */
......@@ -61,8 +61,8 @@ extern NSString *VLCMediaListItemDeleted;
- (int)indexOfMedia:(VLCMedia *)media;
- (int)count;
- (NSArray *)sublists; // I don't see why this would be useful
//- (VLCMediaList *)flatPlaylist; // nore this one
//- (VLCMedia *)providerMedia; // I have no clue what this does
- (NSArray *)sublists; // I don't see why this would be useful
//- (VLCMediaList *)flatPlaylist; // nore this one
//- (VLCMedia *)providerMedia; // I have no clue what this does
@end
\ No newline at end of file
......@@ -32,13 +32,13 @@ extern NSString *VLCMediaPlayerStateChanged;
// TODO: Documentation
typedef enum VLCMediaPlayerState
{
VLCMediaPlayerStateStopped, //< Player has stopped
VLCMediaPlayerStateOpening, //< Stream is opening
VLCMediaPlayerStateBuffering, //< Stream is buffering
VLCMediaPlayerStateEnded, //< Stream has ended
VLCMediaPlayerStateError, //< Player has generated an error
VLCMediaPlayerStatePlaying, //< Stream is playing
VLCMediaPlayerStatePaused //< Stream is paused
VLCMediaPlayerStateStopped, //< Player has stopped
VLCMediaPlayerStateOpening, //< Stream is opening
VLCMediaPlayerStateBuffering, //< Stream is buffering
VLCMediaPlayerStateEnded, //< Stream has ended
VLCMediaPlayerStateError, //< Player has generated an error
VLCMediaPlayerStatePlaying, //< Stream is playing
VLCMediaPlayerStatePaused //< Stream is paused
} VLCMediaPlayerState;
extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
......@@ -57,11 +57,11 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
// TODO: Should we use medialist_player or our own flavor of media player?
@interface VLCMediaPlayer : NSObject
{
id delegate; //< Object delegate
VLCVideoView *videoView;//< NSView instance where media is rendered to
id delegate; //< Object delegate
VLCVideoView *videoView;//< NSView instance where media is rendered to
void *instance; // Internal
VLCMedia *media; //< Current media being played
void *instance; // Internal
VLCMedia *media; //< Current media being played
}
/* Initializers */
......@@ -177,5 +177,5 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
* \see VLCMediaState
*/
- (VLCMediaPlayerState)state;
@end
......@@ -52,12 +52,12 @@ extern NSString *VLCVideoViewLeftFullScreen;
@interface VLCVideoView : NSView <VLCOpenGLVoutEmbedding>
{
id delegate;
NSColor *backColor;
BOOL stretchesVideo;
// TODO: Allow for view to report transparency to do some cool effects
// with the video?
id delegate;
NSColor *backColor;
BOOL stretchesVideo;
// TODO: Allow for view to report transparency to do some cool effects
// with the video?
}
- (void)setDelegate:(id)value;
......
This diff is collapsed.
......@@ -35,50 +35,50 @@ NSString *VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
- (id)init
{
return nil;
return nil;
}
- (id)initWithLibrary:(VLCLibrary *)aLibrary
{
if (![library audio] && (self = [super init]))
{
library = aLibrary;
[library setAudio:self];
}
return self;
if (![library audio] && (self = [super init]))
{
library = aLibrary;
[library setAudio:self];
}
return self;
}
- (void)setMute:(BOOL)value
{
libvlc_audio_set_mute([library instance], value, NULL);
libvlc_audio_set_mute([library instance], value, NULL);
}
- (BOOL)isMuted
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
BOOL result = libvlc_audio_get_mute([library instance], &ex);
quit_on_exception(&ex);
return result;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
BOOL result = libvlc_audio_get_mute([library instance], &ex);
quit_on_exception(&ex);
return result;
}
- (void)setVolume:(int)value
{
if (value < 0)
value = 0;
else if (value > 200)
value = 200;
libvlc_audio_set_volume([library instance], value, NULL);
if (value < 0)
value = 0;
else if (value > 200)
value = 200;
libvlc_audio_set_volume([library instance], value, NULL);
}
- (int)volume
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_audio_get_volume([library instance], &ex);
quit_on_exception(&ex);
return result;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_audio_get_volume([library instance], &ex);
quit_on_exception(&ex);
return result;
}
@end
\ No newline at end of file
......@@ -71,9 +71,9 @@ static void * EventDispatcherMainLoop(void * user_data)
/* Wait until we have something on the queue */
while([[self messageQueue] count] <= 0 )
{
{
pthread_cond_wait( [self signalData], [self queueLock] );
}
}
message = (struct message *)[(NSData *)[[self messageQueue] lastObject] bytes];
/* Don't send the same notification twice */
......@@ -84,7 +84,7 @@ static void * EventDispatcherMainLoop(void * user_data)
message_newer = (struct message *)[(NSData *)[[self messageQueue] objectAtIndex: i] bytes];
if( message_newer->type != VLCNotification )
continue;
if( message_newer->target == message->target && message_newer->target == message->target && [message_newer->u.name isEqualToString:message->u.name] )
{
[message_newer->target release];
......@@ -110,7 +110,7 @@ static void * EventDispatcherMainLoop(void * user_data)
[pool release];
};
return nil;
return nil;
}
@implementation VLCEventManager
......@@ -143,7 +143,7 @@ static void * EventDispatcherMainLoop(void * user_data)
pthread_kill( dispatcherThread, SIGKILL );
pthread_join( dispatcherThread, NULL );
[messageQueue release];
[messageQueue release];
[super dealloc];
}
......@@ -151,14 +151,14 @@ static void * EventDispatcherMainLoop(void * user_data)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
struct message message =
{
[aTarget retain],
aSelector,
[aNotificationName retain],
VLCNotification
};
struct message message =
{
[aTarget retain],
aSelector,
[aNotificationName retain],
VLCNotification
};
pthread_mutex_lock( [self queueLock] );
[[self messageQueue] insertObject:[NSData dataWithBytes:&message length:sizeof(struct message)] atIndex:0];
pthread_cond_signal( [self signalData] );
......@@ -172,18 +172,18 @@ static void * EventDispatcherMainLoop(void * user_data)
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
struct message message =
{
[aTarget retain],
aSelector,
[arg retain],
VLCObjectMethodWithObjectArg
};
{
[aTarget retain],
aSelector,
[arg retain],
VLCObjectMethodWithObjectArg
};
pthread_mutex_lock( [self queueLock] );
[[self messageQueue] insertObject:[NSData dataWithBytes:&message length:sizeof(struct message)] atIndex:0];
pthread_cond_signal( [self signalData] );
pthread_mutex_unlock( [self queueLock] );
[pool release];
}
@end
......
......@@ -32,110 +32,110 @@ static VLCLibrary *sharedLibrary = nil;
// TODO: Change from a terminal error to raising an exception?
void __quit_on_exception( void * e, const char * function, const char * file, int line_number )
{
libvlc_exception_t *ex = (libvlc_exception_t *)e;
libvlc_exception_t *ex = (libvlc_exception_t *)e;
if (libvlc_exception_raised( ex ))
{
/* XXX: localization */
NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)",
libvlc_exception_get_message(ex), file, line_number, function], @"Quit", nil, nil );
libvlc_exception_get_message(ex), file, line_number, function], @"Quit", nil, nil );
exit( ex->i_code );
}
}
static void *DestroySharedLibraryAtExit()
{
// Destroy the shared library
if (sharedLibrary)
[sharedLibrary release];
sharedLibrary = nil;
return nil;
// Destroy the shared library
if (sharedLibrary)
[sharedLibrary release];
sharedLibrary = nil;
return nil;
}
@implementation VLCLibrary
+ (VLCLibrary *)sharedLibrary
{
if (!sharedLibrary)
{
// Initialize a shared instance
[[self alloc] init];
// Register a function to gracefully destroy the shared library on exit.
atexit((void*)DestroySharedLibraryAtExit);
}
return sharedLibrary;
if (!sharedLibrary)
{
// Initialize a shared instance
[[self alloc] init];
// Register a function to gracefully destroy the shared library on exit.
atexit((void*)DestroySharedLibraryAtExit);
}
return sharedLibrary;
}
+ (void *)sharedInstance
{
return [[self sharedLibrary] instance];
return [[self sharedLibrary] instance];
}
- (id)init
{
if (self = [super init])
if (self = [super init])
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
// Figure out the frameworks path
char *applicationPath = strdup([[NSString stringWithFormat:@"%@/Versions/Current/VLC",
[[NSBundle bundleForClass:[VLCLibrary class]] bundlePath]] UTF8String]);
// TODO: Raise error if there is no memory available
char *lib_vlc_params[] = {
applicationPath, "-I", "dummy", "-vvvv",
"--opengl-provider", "minimal_macosx",
"--no-video-title-show", NULL
};
instance = (void *)libvlc_new(7, lib_vlc_params, &ex);
// Figure out the frameworks path
char *applicationPath = strdup([[NSString stringWithFormat:@"%@/Versions/Current/VLC",
[[NSBundle bundleForClass:[VLCLibrary class]] bundlePath]] UTF8String]);
// TODO: Raise error if there is no memory available
char *lib_vlc_params[] = {
applicationPath, "-I", "dummy", "-vvvv",
"--opengl-provider", "minimal_macosx",
"--no-video-title-show", NULL
};
instance = (void *)libvlc_new(7, lib_vlc_params, &ex);
quit_on_exception( &ex );
if (!sharedLibrary)
sharedLibrary = [[self retain] autorelease];
// Assignment unneeded, as the audio unit will do it for us
/*audio = */ [[VLCAudio alloc] initWithLibrary:self];
// free allocated resources
free(applicationPath);
if (!sharedLibrary)
sharedLibrary = [[self retain] autorelease];
// Assignment unneeded, as the audio unit will do it for us
/*audio = */ [[VLCAudio alloc] initWithLibrary:self];
// free allocated resources
free(applicationPath);
}
return self;
return self;
}
- (void)dealloc
{
// TODO: libvlc core locks up or has segfaults while shutting down, the
// following code allows for the framework to be removed without crashing
// the host application.
@try
{
if (instance)
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_destroy(instance, &ex);
}
}
@finally
{
instance = nil;
[audio release];
[super dealloc];
}
// TODO: libvlc core locks up or has segfaults while shutting down, the
// following code allows for the framework to be removed without crashing
// the host application.
@try
{
if (instance)
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_destroy(instance, &ex);
}
}
@finally
{
instance = nil;
[audio release];
[super dealloc];
}
}
- (void *)instance
{
return instance;
return instance;
}
- (VLCAudio *)audio
{
return audio;
return audio;
}
@end
......@@ -144,8 +144,8 @@ static void *DestroySharedLibraryAtExit()
- (void)setAudio:(VLCAudio *)value
{
if (!audio)
audio = value;
if (!audio)
audio = value;
}
@end
......
......@@ -30,8 +30,8 @@
#include <vlc/libvlc.h>
/* Notification Messages */
NSString *VLCMediaListItemAdded = @"VLCMediaListItemAdded";
NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
NSString *VLCMediaListItemAdded = @"VLCMediaListItemAdded";
NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
// TODO: Documentation
@interface VLCMediaList (Private)
......@@ -49,26 +49,26 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_data)
{
id self = user_data;
// Check to see if the last item added is this item we're trying to introduce
// If no, then add the item to the local list, otherwise, the item has already
// been added
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemAdded:)
withArgumentAsObject:[NSArray arrayWithObjects:[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item],
[NSNumber numberWithInt:event->u.media_list_item_added.index], nil]];
// Check to see if the last item added is this item we're trying to introduce
// If no, then add the item to the local list, otherwise, the item has already
// been added
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemAdded:)
withArgumentAsObject:[NSArray arrayWithObjects:[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item],
[NSNumber numberWithInt:event->u.media_list_item_added.index], nil]];
}
static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * user_data)
{
id self = user_data;
// Check to see if the last item deleted is this item we're trying delete now.
// If no, then delete the item from the local list, otherwise, the item has already
// been deleted
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
// Check to see if the last item deleted is this item we're trying delete now.
// If no, then delete the item from the local list, otherwise, the item has already
// been deleted
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
}
@implementation VLCMediaList
......@@ -77,14 +77,14 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
if (self = [super init])
{
// Create a new libvlc media list instance
// Create a new libvlc media list instance
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
p_mlist = libvlc_media_list_new([VLCLibrary sharedInstance], &p_e);
quit_on_exception(&p_e);
// Initialize internals to defaults
delegate = nil;
// Initialize internals to defaults
delegate = nil;
[self initInternalMediaList];
}
return self;
......@@ -109,20 +109,20 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (void)dealloc
{
// Release allocated memory
// Release allocated memory
libvlc_media_list_release(p_mlist);
[super dealloc];
}
- (void)setDelegate:(id)value
{
delegate = value;
delegate = value;
}
- (id)delegate
{
return delegate;
return delegate;
}
- (void)lock
......@@ -137,16 +137,16 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (int)addMedia:(VLCMedia *)media
{
int index = [self count];
[self insertMedia:media atIndex:index];
return index;
int index = [self count];
[self insertMedia:media atIndex:index];
return index;
}
- (void)insertMedia:(VLCMedia *)media atIndex: (int)index
{
[media retain];
// Add it to the libvlc's medialist
[media retain];
// Add it to the libvlc's medialist
libvlc_exception_t p_e;
libvlc_exception_init( &p_e );
libvlc_media_list_insert_media_descriptor(p_mlist, [media libVLCMediaDescriptor], index, &p_e);
......@@ -155,9 +155,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (void)removeMediaAtIndex:(int)index
{
[[self mediaAtIndex:index] release];
[[self mediaAtIndex:index] release];
// Remove it from the libvlc's medialist
// Remove it from the libvlc's medialist
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
libvlc_media_list_remove_index(p_mlist, index, &p_e);
......@@ -166,34 +166,34 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (VLCMedia *)mediaAtIndex:(int)index
{
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
libvlc_media_descriptor_t *p_md = libvlc_media_list_item_at_index(p_mlist, index, &p_e);
quit_on_exception(&p_e);
// Returns local object for media descriptor, searchs for user data first. If not found it creates a
// new cocoa object representation of the media descriptor.
return [VLCMedia mediaWithLibVLCMediaDescriptor:p_md];
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
libvlc_media_descriptor_t *p_md = libvlc_media_list_item_at_index(p_mlist, index, &p_e);
quit_on_exception(&p_e);
// Returns local object for media descriptor, searchs for user data first. If not found it creates a
// new cocoa object representation of the media descriptor.
return [VLCMedia mediaWithLibVLCMediaDescriptor:p_md];
}
- (int)count
{
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
int result = libvlc_media_list_count(p_mlist, &p_e);
quit_on_exception(&p_e);
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
int result = libvlc_media_list_count(p_mlist, &p_e);
quit_on_exception(&p_e);
return result;
return result;
}
- (int)indexOfMedia:(VLCMedia *)media
{
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
int result = libvlc_media_list_index_of_item(p_mlist, [media libVLCMediaDescriptor], &p_e);
quit_on_exception(&p_e);
return result;
quit_on_exception(&p_e);
return result;
}
- (NSArray *)sublists
......@@ -277,7 +277,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (void)initInternalMediaList
{
// Add event callbacks
// Add event callbacks
[self lock];
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
......@@ -286,40 +286,40 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_event_attach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, &p_e);
libvlc_event_attach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e);
[self unlock];
quit_on_exception( &p_e );
}
- (void)mediaListItemAdded:(NSArray *)args
{
VLCMedia *media = [args objectAtIndex:0];
NSNumber *index = [args objectAtIndex:1];
// Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemAdded
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
media, @"media",
index, @"index",
nil]];
// Let the delegate know that the item was added
if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaAdded:atIndex:)])
[delegate mediaList:self mediaAdded:media atIndex:[index intValue]];
VLCMedia *media = [args objectAtIndex:0];
NSNumber *index = [args objectAtIndex:1];
// Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemAdded
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
media, @"media",
index, @"index",
nil]];
// Let the delegate know that the item was added
if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaAdded:atIndex:)])
[delegate mediaList:self mediaAdded:media atIndex:[index intValue]];
}
- (void)mediaListItemRemoved:(NSNumber *)index
{
// Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemDeleted
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
index, @"index",
nil]];
// Let the delegate know that the item is being removed
if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaRemovedAtIndex:)])
[delegate mediaList:self mediaRemovedAtIndex:index];
// Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemDeleted
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
index, @"index",
nil]];
// Let the delegate know that the item is being removed
if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaRemovedAtIndex:)])
[delegate mediaList:self mediaRemovedAtIndex:index];
}
@end
......
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