[vlc-commits] playlist: add playlist-independent functions for meta data handling

Rémi Denis-Courmont git at videolan.org
Tue Dec 31 19:45:11 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Dec 31 20:25:21 2013 +0200| [ff8e72230774cb621fb3f5a350f681283973f0f5] | committer: Rémi Denis-Courmont

playlist: add playlist-independent functions for meta data handling

This really only depends on the input item(s) and the core.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff8e72230774cb621fb3f5a350f681283973f0f5
---

 include/vlc_input_item.h |    3 +++
 src/libvlc.c             |   39 +++++++++++++++++++++++++++++++++++++++
 src/libvlc.h             |    1 +
 src/libvlccore.sym       |    2 ++
 4 files changed, 45 insertions(+)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 1359d68..d1f0198 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -279,6 +279,9 @@ VLC_API void input_item_Release(input_item_t *);
 #define vlc_gc_incref(i) input_item_Hold(i)
 #define vlc_gc_decref(i) input_item_Release(i)
 
+VLC_API int libvlc_MetaRequest(libvlc_int_t *, input_item_t *);
+VLC_API int libvlc_ArtRequest(libvlc_int_t *, input_item_t *);
+
 /******************
  * Input stats
  ******************/
diff --git a/src/libvlc.c b/src/libvlc.c
index ac7e2a8..2545ba8 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -42,6 +42,7 @@
 
 #include "modules/modules.h"
 #include "config/configuration.h"
+#include "playlist/preparser.h"
 
 #include <stdio.h>                                              /* sprintf() */
 #include <string.h>
@@ -367,6 +368,11 @@ dbus_out:
      */
     priv->actions = vlc_InitActions( p_libvlc );
 
+    /*
+     * Meta data handling
+     */
+    priv->parser = playlist_preparser_New(VLC_OBJECT(p_libvlc));
+
     /* Create a variable for showing the fullscreen interface */
     var_Create( p_libvlc, "intf-toggle-fscontrol", VLC_VAR_BOOL );
     var_SetBool( p_libvlc, "intf-toggle-fscontrol", true );
@@ -569,6 +575,9 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     }
 #endif
 
+    if (priv->parser != NULL)
+        playlist_preparser_Delete(priv->parser);
+
     vlc_DeinitActions( p_libvlc, priv->actions );
 
     /* Save the configuration */
@@ -675,3 +684,33 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
         free( mrl );
     }
 }
+
+/**
+ * Requests extraction of the meta data for an input item (a.k.a. preparsing).
+ * The actual extraction is asynchronous.
+ */
+int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item)
+{
+    libvlc_priv_t *priv = libvlc_priv(libvlc);
+
+    if (unlikely(priv->parser == NULL))
+        return VLC_ENOMEM;
+
+    playlist_preparser_Push(priv->parser, item);
+    return VLC_SUCCESS;
+}
+
+/**
+ * Requests retrieving/downloading art for an input item.
+ * The retrieval is performed asynchronously.
+ */
+int libvlc_ArtRequest(libvlc_int_t *libvlc, input_item_t *item)
+{
+    libvlc_priv_t *priv = libvlc_priv(libvlc);
+
+    if (unlikely(priv->parser == NULL))
+        return VLC_ENOMEM;
+
+    playlist_preparser_fetcher_Push(priv->parser, item);
+    return VLC_SUCCESS;
+}
diff --git a/src/libvlc.h b/src/libvlc.h
index 65f0d6d..ec4b3ea 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -163,6 +163,7 @@ typedef struct libvlc_priv_t
 #ifdef ENABLE_SOUT
     sap_handler_t     *p_sap; ///< SAP SDP advertiser
 #endif
+    struct playlist_preparser_t *parser; ///< Input item meta data handler
     struct vlc_actions *actions; ///< Hotkeys handler
 
     /* Interfaces */
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index f9c36cb..200d1f2 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -230,6 +230,8 @@ libvlc_InternalDestroy
 libvlc_InternalInit
 libvlc_Quit
 libvlc_SetExitHandler
+libvlc_MetaRequest
+libvlc_ArtRequest
 vlc_UrlParse
 vlc_UrlClean
 vlc_path2uri



More information about the vlc-commits mailing list