[vlc-devel] [PATCH 1/2] Method for adding vlc-options to a VLCMedia

Rune Botten rbotten at gmail.com
Fri Dec 17 22:00:30 CET 2010


---
 .../macosx/framework/Headers/Public/VLCMedia.h     |   10 ++++++++++
 projects/macosx/framework/Sources/VLCMedia.m       |   14 ++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/projects/macosx/framework/Headers/Public/VLCMedia.h
b/projects/macosx/framework/Headers/Public/VLCMedia.h
index 52954fb..eb5824a 100644
--- a/projects/macosx/framework/Headers/Public/VLCMedia.h
+++ b/projects/macosx/framework/Headers/Public/VLCMedia.h
@@ -332,4 +332,14 @@ 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
diff --git a/projects/macosx/framework/Sources/VLCMedia.m
b/projects/macosx/framework/Sources/VLCMedia.m
index 5f6fec5..f0e9cf3 100644
--- a/projects/macosx/framework/Sources/VLCMedia.m
+++ b/projects/macosx/framework/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
-- 
1.7.3.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20101217/3a1d3ac5/attachment.html>


More information about the vlc-devel mailing list