Commit 6dda19c8 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Very minor identation changes.

parent 702edfe8
......@@ -29,8 +29,8 @@
@interface VLCMediaLibrary : NSObject
{
void *mlib;
VLCMediaList *allMedia;
void * mlib;
VLCMediaList * allMedia;
}
+ (id)sharedMediaLibrary;
......
......@@ -25,8 +25,8 @@
#import "VLCMedia.h"
/* Notification Messages */
extern NSString *VLCMediaListItemAdded;
extern NSString *VLCMediaListItemDeleted;
extern NSString * VLCMediaListItemAdded;
extern NSString * VLCMediaListItemDeleted;
@class VLCMedia;
@class VLCMediaList;
......@@ -59,7 +59,7 @@ extern NSString *VLCMediaListItemDeleted;
- (int)indexOfMedia:(VLCMedia *)media;
- (int)count;
#if 0 /* Disabled until this get fixed in libvlc
#if 0 /* Disabled until this get fixed in libvlc */
- (NSArray *)sublists; //< A way to see the same media list. Only sub media list.
- (NSArray *)flatMediaView; //< A way to see the same media list. Only media.
- (VLCMedia *)providerMedia; //< If a media was at the origin of this media list, here it is.
......
......@@ -26,8 +26,8 @@
#import "VLCMedia.h"
/* Notification Messages */
extern NSString *VLCMediaPlayerTimeChanged;
extern NSString *VLCMediaPlayerStateChanged;
extern NSString * VLCMediaPlayerTimeChanged;
extern NSString * VLCMediaPlayerStateChanged;
// TODO: Documentation
typedef enum VLCMediaPlayerState
......
......@@ -25,8 +25,8 @@
#import <Cocoa/Cocoa.h>
/* Notifications */
extern NSString *VLCVideoViewEnteredFullScreen;
extern NSString *VLCVideoViewLeftFullScreen;
extern NSString * VLCVideoViewEnteredFullScreen;
extern NSString * VLCVideoViewLeftFullScreen;
@protocol VLCVideoViewDelegate
// Notifications defined in VLCVideoView.h
......@@ -49,7 +49,7 @@ extern NSString *VLCVideoViewLeftFullScreen;
@interface VLCVideoView : NSView <VLCOpenGLVoutEmbedding>
{
id delegate;
NSColor *backColor;
NSColor * backColor;
BOOL stretchesVideo;
// TODO: Allow for view to report transparency to do some cool effects
......
......@@ -37,7 +37,7 @@ void __quit_on_exception( void * e, const char * function, const char * file, in
{
/* 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 );
}
}
......@@ -61,7 +61,7 @@ static void *DestroySharedLibraryAtExit()
[[self alloc] init];
// Register a function to gracefully destroy the shared library on exit.
atexit((void*)DestroySharedLibraryAtExit);
atexit( (void*)DestroySharedLibraryAtExit );
}
return sharedLibrary;
}
......@@ -79,8 +79,8 @@ static void *DestroySharedLibraryAtExit()
libvlc_exception_init( &ex );
// Figure out the frameworks path
char *applicationPath = strdup([[NSString stringWithFormat:@"%@/Versions/Current/VLC",
[[NSBundle bundleForClass:[VLCLibrary class]] bundlePath]] UTF8String]);
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[] = {
......@@ -89,7 +89,7 @@ static void *DestroySharedLibraryAtExit()
"--no-video-title-show", NULL
};
instance = (void *)libvlc_new(7, lib_vlc_params, &ex);
instance = (void *)libvlc_new( 7, lib_vlc_params, &ex );
quit_on_exception( &ex );
if (!sharedLibrary)
......@@ -99,7 +99,7 @@ static void *DestroySharedLibraryAtExit()
/*audio = */ [[VLCAudio alloc] initWithLibrary:self];
// free allocated resources
free(applicationPath);
free( applicationPath );
}
return self;
}
......@@ -114,9 +114,9 @@ static void *DestroySharedLibraryAtExit()
if (instance)
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
libvlc_destroy(instance, &ex);
libvlc_destroy( instance, &ex );
}
}
@finally
......
......@@ -219,7 +219,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
[subitems release];
[metaDictionary release];
libvlc_media_descriptor_release(p_md);
libvlc_media_descriptor_release( p_md );
[super dealloc];
}
......@@ -257,7 +257,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
if (!length)
{
// Try figuring out what the length is
long long duration = libvlc_media_descriptor_get_duration(p_md, NULL);
long long duration = libvlc_media_descriptor_get_duration( p_md, NULL );
if (duration > -1)
{
[self setLength:[VLCTime timeWithNumber:[NSNumber numberWithLongLong:duration]]];
......@@ -278,7 +278,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
{
while (!length && ![self isPreparsed] && [aDate timeIntervalSinceNow] > 0)
{
usleep(THREAD_SLEEP);
usleep( THREAD_SLEEP );
}
// So we're done waiting, but sometimes we trap the fact that the parsing
......@@ -294,7 +294,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
- (BOOL)isPreparsed
{
return libvlc_media_descriptor_is_preparsed(p_md, NULL);
return libvlc_media_descriptor_is_preparsed( p_md, NULL );
}
- (NSDictionary *)metaDictionary
......@@ -320,10 +320,10 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
libvlc_exception_t ex;
libvlc_exception_init( &ex );
VLCMedia *media = (VLCMedia *)libvlc_media_descriptor_get_user_data(md, &ex);
if (!media || libvlc_exception_raised(&ex))
VLCMedia *media = (VLCMedia *)libvlc_media_descriptor_get_user_data( md, &ex );
if (!media || libvlc_exception_raised( &ex ))
{
libvlc_exception_clear(&ex);
libvlc_exception_clear( &ex );
return [[[VLCMedia alloc] initWithLibVLCMediaDescriptor:md] autorelease];
}
else
......@@ -344,18 +344,18 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
{
return [self retain];
}
libvlc_exception_clear(&ex); // Just in case an exception was raised, lets release it
libvlc_exception_clear( &ex ); // Just in case an exception was raised, lets release it
if (self = [super init])
{
char * p_url;
p_url = libvlc_media_descriptor_get_mrl(md, &ex);
p_url = libvlc_media_descriptor_get_mrl( md, &ex );
quit_on_exception( &ex );
url = [NSString stringWithCString:p_url];
libvlc_media_descriptor_retain(md);
libvlc_media_descriptor_retain( md );
p_md = md;
[self initInternalMediaDescriptor];
......@@ -419,27 +419,27 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
- (void)initInternalMediaDescriptor
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_descriptor_set_user_data(p_md, (void*)self, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
libvlc_media_descriptor_set_user_data( p_md, (void*)self, &ex );
quit_on_exception( &ex );
// TODO: Should these events be caught by VLCMediaList's notification hooks?
libvlc_event_manager_t *p_em = libvlc_media_descriptor_event_manager(p_md, &ex);
libvlc_event_manager_t *p_em = libvlc_media_descriptor_event_manager( p_md, &ex );
// libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded, HandleMediaSubItemAdded, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemRemoved, HandleMediaSubItemRemoved, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDescriptorMetaChanged, HandleMediaMetaChanged, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, &ex);
quit_on_exception(&ex);
quit_on_exception( &ex );
libvlc_media_list_t *p_mlist = libvlc_media_descriptor_subitems(p_md, NULL);
libvlc_media_list_t *p_mlist = libvlc_media_descriptor_subitems( p_md, NULL );
if (!p_mlist)
subitems = nil;
else
{
[subitems release];
subitems = [[VLCMediaList medialistWithLibVLCMediaList:p_mlist] retain];
libvlc_media_list_release(p_mlist);
libvlc_media_list_release( p_mlist );
}
[self fetchMetaInformation];
}
......@@ -471,7 +471,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
}
result = YES;
}
free(value);
free( value );
return result;
}
......@@ -480,9 +480,9 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
// TODO: Only fetch meta data that has been requested. Just don't fetch
// it, just because.
[self setMetaValue:libvlc_media_descriptor_get_meta(p_md, libvlc_meta_Title, NULL) forKey:[VLCMedia metaTypeToString:libvlc_meta_Title]];
[self setMetaValue:libvlc_media_descriptor_get_meta(p_md, libvlc_meta_Artist, NULL) forKey:[VLCMedia metaTypeToString:libvlc_meta_Artist]];
[self setMetaValue:libvlc_media_descriptor_get_meta(p_md, libvlc_meta_ArtworkURL, NULL) forKey:[VLCMedia metaTypeToString:libvlc_meta_ArtworkURL]];
[self setMetaValue:libvlc_media_descriptor_get_meta( p_md, libvlc_meta_Title, NULL ) forKey:[VLCMedia metaTypeToString:libvlc_meta_Title]];
[self setMetaValue:libvlc_media_descriptor_get_meta( p_md, libvlc_meta_Artist, NULL ) forKey:[VLCMedia metaTypeToString:libvlc_meta_Artist]];
[self setMetaValue:libvlc_media_descriptor_get_meta( p_md, libvlc_meta_ArtworkURL, NULL ) forKey:[VLCMedia metaTypeToString:libvlc_meta_ArtworkURL]];
}
- (void)fetchMetaInformationForArtWorkWithURL:(NSString *)anURL
......
......@@ -84,7 +84,7 @@ static VLCMediaLibrary * sharedMediaLibrary = nil;
{
libvlc_media_list_t *p_mlist = libvlc_media_library_media_list( mlib, NULL );
VLCMediaList *medialist = [VLCMediaList medialistWithLibVLCMediaList:p_mlist];
libvlc_media_list_release(p_mlist);
libvlc_media_list_release( p_mlist );
NSArray *ret = [medialist sublists];
return ret;
......
......@@ -124,12 +124,12 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (void)lock
{
libvlc_media_list_lock(p_mlist);
libvlc_media_list_lock( p_mlist );
}
- (void)unlock
{
libvlc_media_list_unlock(p_mlist);
libvlc_media_list_unlock( p_mlist );
}
- (int)addMedia:(VLCMedia *)media
......@@ -146,8 +146,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// 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);
quit_on_exception(&p_e);
libvlc_media_list_insert_media_descriptor( p_mlist, [media libVLCMediaDescriptor], index, &p_e );
quit_on_exception( &p_e );
}
- (void)removeMediaAtIndex:(int)index
......@@ -156,17 +156,17 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// 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);
quit_on_exception(&p_e);
libvlc_exception_init( &p_e );
libvlc_media_list_remove_index( p_mlist, index, &p_e );
quit_on_exception( &p_e );
}
- (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);
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.
......@@ -176,9 +176,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (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_init( &p_e );
int result = libvlc_media_list_count( p_mlist, &p_e );
quit_on_exception( &p_e );
return result;
}
......@@ -186,9 +186,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (int)indexOfMedia:(VLCMedia *)media
{
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);
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;
}
......@@ -199,22 +199,22 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
int i, count;
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
count = libvlc_media_list_count(p_mlist, &p_e);
quit_on_exception(&p_e);
libvlc_exception_init( &p_e );
count = libvlc_media_list_count( p_mlist, &p_e );
quit_on_exception( &p_e );
for(i = 0; i < count; i++)
{
libvlc_media_descriptor_t *p_md;
libvlc_media_list_t *p_submlist;
p_md = libvlc_media_list_item_at_index(p_mlist, i, NULL);
p_submlist = libvlc_media_descriptor_subitems(p_md, NULL);
if(p_submlist)
p_md = libvlc_media_list_item_at_index( p_mlist, i, NULL );
p_submlist = libvlc_media_descriptor_subitems( p_md, NULL );
if (p_submlist)
{
[ret addObject:[VLCMediaList medialistWithLibVLCMediaList:p_submlist]];
libvlc_media_list_release(p_submlist);
libvlc_media_list_release( p_submlist );
}
libvlc_media_descriptor_release(p_md);
libvlc_media_descriptor_release( p_md );
}
return [ret autorelease];
}
......@@ -275,9 +275,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_t p_e;
libvlc_exception_init(&p_e);
libvlc_event_manager_t *p_em = libvlc_media_list_event_manager(p_mlist, &p_e);
libvlc_event_attach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, &p_e);
libvlc_event_attach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e);
libvlc_event_manager_t *p_em = libvlc_media_list_event_manager( p_mlist, &p_e );
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 );
......
......@@ -94,9 +94,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// it will change depending on the media descriptor provided to the media
// instance
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
instance = (void *)libvlc_media_instance_new([VLCLibrary sharedInstance], &ex);
quit_on_exception(&ex);
quit_on_exception( &ex );
[self registerObservers];
......@@ -139,11 +139,11 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// Make sure that this instance has been associated with the drawing canvas.
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
libvlc_media_instance_set_drawable ((libvlc_media_instance_t *)instance,
(libvlc_drawable_t)videoView,
&ex);
quit_on_exception(&ex);
quit_on_exception( &ex );
}
- (VLCVideoView *)videoView
......@@ -159,100 +159,100 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (BOOL)fullscreen
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_get_fullscreen(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
int result = libvlc_get_fullscreen( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setVideoAspectRatio:(char *)value
{
libvlc_video_set_aspect_ratio(instance, value, NULL);
libvlc_video_set_aspect_ratio( instance, value, NULL );
}
- (char *)videoAspectRatio
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *result = libvlc_video_get_aspect_ratio(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
char *result = libvlc_video_get_aspect_ratio( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setVideoSubTitles:(int)value
{
libvlc_video_set_spu(instance, value, NULL);
libvlc_video_set_spu( instance, value, NULL );
}
- (int)videoSubTitles
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_video_get_spu(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
int result = libvlc_video_get_spu( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setVideoCropGeometry:(char *)value
{
libvlc_video_set_crop_geometry(instance, value, NULL);
libvlc_video_set_crop_geometry( instance, value, NULL );
}
- (char *)videoCropGeometry
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *result = libvlc_video_get_crop_geometry(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
char *result = libvlc_video_get_crop_geometry( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setVideoTeleText:(int)value
{
libvlc_video_set_teletext(instance, value, NULL);
libvlc_video_set_teletext( instance, value, NULL );
}
- (int)videoTeleText
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_video_get_teletext(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
int result = libvlc_video_get_teletext( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setRate:(int)value
{
libvlc_media_instance_set_rate(instance, value, NULL);
libvlc_media_instance_set_rate( instance, value, NULL );
}
- (int)rate
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
float result = libvlc_media_instance_get_rate(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
float result = libvlc_media_instance_get_rate( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (NSSize)videoSize
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
NSSize result = NSMakeSize(libvlc_video_get_height((libvlc_media_instance_t *)instance, &ex),
libvlc_video_get_width((libvlc_media_instance_t *)instance, &ex));
quit_on_exception(&ex);
quit_on_exception( &ex );
return result;
}
- (BOOL)hasVideoOut
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
BOOL result = libvlc_media_instance_has_vout((libvlc_media_instance_t *)instance, &ex);
if (libvlc_exception_raised(&ex))
if (libvlc_exception_raised( &ex ))
{
libvlc_exception_clear(&ex);
libvlc_exception_clear( &ex );
return NO;
}
else
......@@ -262,34 +262,34 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (float)framesPerSecond
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
float result = libvlc_media_instance_get_fps((libvlc_media_instance_t *)instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
float result = libvlc_media_instance_get_fps( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setTime:(VLCTime *)value
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
// Time is managed in seconds, while duration is managed in microseconds
// TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
libvlc_media_instance_set_time((libvlc_media_instance_t *)instance,
(value ? [[value numberValue] longLongValue] / 1000 : 0),
&ex);
quit_on_exception(&ex);
libvlc_media_instance_set_time( (libvlc_media_instance_t *)instance,
(value ? [[value numberValue] longLongValue] / 1000 : 0),
&ex );
quit_on_exception( &ex );
}
- (VLCTime *)time
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
// Results are returned in seconds...duration is returned in milliseconds
long long time = libvlc_media_instance_get_time((libvlc_media_instance_t *)instance, &ex) * 1000;
if (libvlc_exception_raised(&ex))
long long time = libvlc_media_instance_get_time( (libvlc_media_instance_t *)instance, &ex ) * 1000;
if (libvlc_exception_raised( &ex ))
{
libvlc_exception_clear(&ex);
libvlc_exception_clear( &ex );
return [VLCTime nullTime]; // Error in obtaining the time, return a null time defintition (--:--:--)
}
else
......@@ -298,29 +298,29 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (void)setAudioTrack:(int)value
{
libvlc_audio_set_track(instance, value, NULL);
libvlc_audio_set_track( instance, value, NULL );
}
- (int)audioTrack
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_audio_get_track(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
int result = libvlc_audio_get_track( instance, &ex );
quit_on_exception( &ex );
return result;
}
- (void)setAudioChannel:(int)value
{
libvlc_audio_set_channel(instance, value, NULL);
libvlc_audio_set_channel( instance, value, NULL );
}
- (int)audioChannel
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
int result = libvlc_audio_get_channel(instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
int result = libvlc_audio_get_channel( instance, &ex );
quit_on_exception( &ex );
return result;
}
......@@ -347,9 +347,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
[self didChangeValueForKey:@"media"];
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_instance_set_media_descriptor(instance, [media libVLCMediaDescriptor], &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
libvlc_media_instance_set_media_descriptor( instance, [media libVLCMediaDescriptor], &ex );
quit_on_exception( &ex );
if (media) {
if (wasPlaying)
......@@ -370,10 +370,10 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
return [self isPlaying];
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
libvlc_media_instance_play((libvlc_media_instance_t *)instance, &ex);
quit_on_exception(&ex);
libvlc_media_instance_play( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception( &ex );
return YES;
}
......@@ -391,9 +391,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// Pause the stream
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_instance_pause((libvlc_media_instance_t *)instance, &ex);
quit_on_exception(&ex);
libvlc_exception_init( &ex );
libvlc_media_instance_pause( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception( &ex );
// TODO: Should we record the time in case the media instance is destroyed
// then rebuilt?
......@@ -409,9 +409,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// The following is not implemented in the core, should I fix it or just
// compensate?
// libvlc_exception_t ex;
// libvlc_exception_init(&ex);
// libvlc_exception_init( &ex );
// libvlc_media_instance_stop((libvlc_media_instance_t *)instance, &ex);
// quit_on_exception(&ex);
// quit_on_exception( &ex );
// Pause and reposition to the begining of the stream.
[self pause];
......@@ -434,8 +434,8 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (BOOL)willPlay
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
BOOL ret = libvlc_media_instance_will_play((libvlc_media_instance_t *)instance, &ex);
libvlc_exception_init( &ex );
BOOL ret = libvlc_media_instance_will_play( (libvlc_media_instance_t *)instance, &ex );
if (libvlc_exception_raised(&ex))
{
libvlc_exception_clear(&ex);
......@@ -445,15 +445,15 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
return ret;
}
static VLCMediaPlayerState libvlc_to_local_state [] =
static VLCMediaPlayerState libvlc_to_local_state[] =
{
[libvlc_Stopped] = VLCMediaPlayerStateStopped,
[libvlc_Opening] = VLCMediaPlayerStateOpening,
[libvlc_Buffering] = VLCMediaPlayerStateBuffering,
[libvlc_Buffering] = VLCMediaPlayerStateBuffering,
[libvlc_Playing] = VLCMediaPlayerStatePlaying,
[libvlc_Paused] = VLCMediaPlayerStatePaused,
[libvlc_Ended] = VLCMediaPlayerStateEnded,
[libvlc_Error] = VLCMediaPlayerStateError
[libvlc_Paused] = VLCMediaPlayerStatePaused,
[libvlc_Ended] = VLCMediaPlayerStateEnded,
[libvlc_Error] = VLCMediaPlayerStateError
};
- (VLCMediaPlayerState)state
......@@ -463,11 +463,11 @@ static VLCMediaPlayerState libvlc_to_local_state [] =
return VLCMediaPlayerStateStopped;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_state_t libvlc_state = libvlc_media_instance_get_state((libvlc_media_instance_t *)instance, &ex);
if (libvlc_exception_raised(&ex))
libvlc_exception_init( &ex );
libvlc_state_t libvlc_state = libvlc_media_instance_get_state( (libvlc_media_instance_t *)instance, &ex );
if (libvlc_exception_raised( &ex ))
{
libvlc_exception_clear(&ex);
libvlc_exception_clear( &ex );
return VLCMediaPlayerStateError;
}
else
......@@ -479,23 +479,23 @@ static VLCMediaPlayerState libvlc_to_local_state [] =
- (void)registerObservers
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_exception_init( &ex );
// Attach event observers into the media instance
libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager(instance, &ex);
libvlc_event_attach(p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, &ex);
quit_on_exception(&ex);
libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager( instance, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, &ex );
quit_on_exception( &ex );
}
- (void)unregisterObservers
{
libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager(instance, NULL);
libvlc_event_detach(p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, NULL);
libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager( instance, NULL );
libvlc_event_detach( p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, NULL );
}
@end
\ No newline at end of file
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