Просмотр исходного кода

media player: expose playback slave addition

Felix Paul Kühne 9 лет назад
Родитель
Сommit
5c5e9a24fe
3 измененных файлов с 32 добавлено и 0 удалено
  1. 19 0
      Headers/Public/VLCMediaPlayer.h
  2. 2 0
      NEWS
  3. 11 0
      Sources/VLCMediaPlayer.m

+ 19 - 0
Headers/Public/VLCMediaPlayer.h

@@ -358,6 +358,25 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
 
 /**
+ * VLCMediaPlaybackNavigationAction describes actions which can be performed to navigate an interactive title
+ */
+typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
+{
+    VLCMediaPlaybackSlaveTypeSubtitle = 0,
+    VLCMediaPlaybackSlaveTypeAudio
+};
+
+/**
+ * Add additional input sources to a playing media item
+ * This way, you can add subtitles or audio files to an existing input stream
+ * For the user, it will appear as if they were part of the existing stream
+ * \param URL of the content to be added
+ * \param content type
+ * \param switch to the added accessory content
+ */
+- (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
+
+/**
  * Get the current subtitle delay. Positive values means subtitles are being
  * displayed later, negative values earlier.
  *

+ 2 - 0
NEWS

@@ -28,7 +28,9 @@ New APIs:
                       snapshots, lastSnapshot
   - added selectors: chaptersForTitleIndex:
                      numberOfChaptersForTitle:
+                     addPlaybackSlave:type:enforce:
   - added notifications: VLCMediaPlayerTitleChanged, VLCMediaPlayerChapterChanged
+  - added enum: VLCMediaPlaybackSlaveType
   - Note:
     - play's return type was changed from BOOL to void
     - hue is now a float instead of an integer

+ 11 - 0
Sources/VLCMediaPlayer.m

@@ -474,6 +474,17 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
                                          TRUE);
 }
 
+- (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection
+{
+    if (!slaveURL)
+        return -1;
+
+    return libvlc_media_player_add_slave(_playerInstance,
+                                         slaveType,
+                                         [[slaveURL absoluteString] UTF8String],
+                                         enforceSelection);
+}
+
 - (void)setCurrentVideoSubTitleDelay:(NSInteger)index
 {
     libvlc_video_set_spu_delay(_playerInstance, index);