Quellcode durchsuchen

VLCMedia: added new parsing method which allows differenciated parsing and fetching of local and remote sources

Felix Paul Kühne vor 10 Jahren
Ursprung
Commit
62e91de124
3 geänderte Dateien mit 32 neuen und 1 gelöschten Zeilen
  1. 21 0
      Headers/Public/VLCMedia.h
  2. 2 1
      NEWS
  3. 9 0
      Sources/VLCMedia.m

+ 21 - 0
Headers/Public/VLCMedia.h

@@ -434,6 +434,27 @@ extern NSString *const VLCMediaTracksInformationTypeUnknown;
  */
 - (void)synchronousParse;
 
+
+enum {
+    VLCMediaParseLocal          = 0x00,
+    VLCMediaParseNetwork        = 0x01,
+    VLCMediaFetchLocal          = 0x02,
+    VLCMediaFetchNetwork        = 0x04,
+};
+typedef int VLCMediaParsingOptions;
+
+/**
+ * triggers an asynchronous parse of the media item
+ * using the given options
+ * \param the option mask based on VLCMediaParsingOptions
+ * \see VLCMediaParsingOptions
+ * \return an int. 0 on success, -1 in case of error
+ * \note listen to the "parsed" key value or the mediaDidFinishParsing:
+ * delegate method to be notified about parsing results. Those triggers
+ * will _NOT_ be raised if parsing fails and this method returns an error.
+ */
+- (int)parseWithOptions:(VLCMediaParsingOptions)options;
+
 /**
  * Add options to the media, that will be used to determine how
  * VLCMediaPlayer will read the media. This allow to use VLC advanced

+ 2 - 1
NEWS

@@ -12,7 +12,8 @@ New APIs:
                 VLCMetaInformationAlbumArtist, VLCMetaInformationDiscNumber
   - added selectors: codecNameForFourCC:trackType:
                      mediaType
-  - added enum: VLCMediaType
+                     parseWithOptions:
+  - added enums: VLCMediaType, VLCMediaParsingOptions
 
 Deprecated APIs:
 - VLCMediaPlayer

+ 9 - 0
Sources/VLCMedia.m

@@ -344,6 +344,15 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
         libvlc_media_parse(p_md);
 }
 
+- (int)parseWithOptions:(VLCMediaParsingOptions)options
+{
+    if (!p_md)
+        return -1;
+
+    return libvlc_media_parse_with_options(p_md,
+                                           options);
+}
+
 - (void)addOptions:(NSDictionary*)options
 {
     if (p_md) {