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

VLCMediaPlayer: expand the API to launch instances with custom options

Existing API is untouched, so this doesn't break existing apps
parent cbc12cea
......@@ -103,6 +103,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (id)initWithVideoView:(VLCVideoView *)aVideoView;
- (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
#endif
- (id)initWithOptions:(NSArray *)options;
/* Properties */
- (void)setDelegate:(id)value;
......
......@@ -145,7 +145,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
// TODO: Documentation
@interface VLCMediaPlayer (Private)
- (id)initWithDrawable:(id)aDrawable;
- (id)initWithDrawable:(id)aDrawable options:(NSArray *)options;
- (void)registerObservers;
- (void)unregisterObservers;
......@@ -182,24 +182,39 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return dict[key];
}
/* Contructor */
/* Constructor */
- (id)init
{
return [self initWithDrawable:nil];
return [self initWithDrawable:nil options:nil];
}
#if !TARGET_OS_IPHONE
- (id)initWithVideoView:(VLCVideoView *)aVideoView
{
return [self initWithDrawable: aVideoView];
return [self initWithDrawable: aVideoView options:nil];
}
- (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer
{
return [self initWithDrawable: aVideoLayer];
return [self initWithDrawable: aVideoLayer options:nil];
}
- (id)initWithVideoView:(VLCVideoView *)aVideoView options:(NSArray *)options
{
return [self initWithDrawable: aVideoView options:options];
}
- (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer options:(NSArray *)options
{
return [self initWithDrawable: aVideoLayer options:options];
}
#endif
- (id)initWithOptions:(NSArray *)options
{
return [self initWithDrawable:nil options:options];
}
- (void)dealloc
{
NSAssert(libvlc_media_player_get_state(instance) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped");
......@@ -946,7 +961,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
[super dealloc];
}
- (id)initWithDrawable:(id)aDrawable
- (id)initWithDrawable:(id)aDrawable options:(NSArray *)options
{
if (self = [super init]) {
delegate = nil;
......@@ -959,7 +974,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
// Create a media instance, it doesn't matter what library we start off with
// it will change depending on the media descriptor provided to the media
// instance
_privateLibrary = [[VLCLibrary alloc] init];
_privateLibrary = [[VLCLibrary alloc] initWithOptions:options];
instance = libvlc_media_player_new([_privateLibrary instance]);
[self registerObservers];
......
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