Explorar el Código

VLCMediaPlayer: expand the API to launch instances with custom options

Existing API is untouched, so this doesn't break existing apps
Felix Paul Kühne hace 12 años
padre
commit
fbb6ee17d8
Se han modificado 2 ficheros con 23 adiciones y 7 borrados
  1. 1 0
      Headers/Public/VLCMediaPlayer.h
  2. 22 7
      Sources/VLCMediaPlayer.m

+ 1 - 0
Headers/Public/VLCMediaPlayer.h

@@ -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;

+ 22 - 7
Sources/VLCMediaPlayer.m

@@ -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];