瀏覽代碼

Method for adding vlc-options to a VLCMedia

--0016e64f6886ef58a30497a17561
Content-Type: text/plain; charset=ISO-8859-1

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Rune Botten 14 年之前
父節點
當前提交
71da3e87c0
共有 2 個文件被更改,包括 25 次插入0 次删除
  1. 11 0
      Headers/Public/VLCMedia.h
  2. 14 0
      Sources/VLCMedia.m

+ 11 - 0
Headers/Public/VLCMedia.h

@@ -332,4 +332,15 @@ extern NSString *VLCMediaTracksInformationTypeUnknown;
  */
 - (void)parse;
 
+/**************************************************************************
+ * Add options to the media, that will be used to determine how
+ * VLCMediaPlayer will read the media. This allow to use VLC advanced
+ * reading/streaming options in a per-media basis
+ *
+ * The options are detailed in vlc --long-help, for instance "--sout-all"
+ * And on the web: http://wiki.videolan.org/VLC_command-line_help
+
+**************************************************************************/
+- (void) addOptions:(NSDictionary*) options;
+
 @end

+ 14 - 0
Sources/VLCMedia.m

@@ -324,6 +324,20 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
     libvlc_media_parse_async(p_md);
 }
 
+- (void)addOptions:(NSDictionary*)options
+{
+    if (p_md)
+    {
+        for (NSString * key in [options allKeys])
+        {
+            if ([options objectForKey:key] != [NSNull null])
+                libvlc_media_add_option(p_md, [[NSString stringWithFormat:@"%@=%@", key, [options objectForKey:key]] UTF8String]);
+            else
+                libvlc_media_add_option(p_md, [[NSString stringWithFormat:@"%@", key] UTF8String]);
+        }
+    }
+}
+
 NSString *VLCMediaTracksInformationCodec = @"codec"; // NSNumber
 NSString *VLCMediaTracksInformationId    = @"id";    // NSNumber
 NSString *VLCMediaTracksInformationType  = @"type";  // NSString