]> git.sesse.net Git - vlc/commitdiff
playlist: add playlist-independent functions for meta data handling
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 31 Dec 2013 18:25:21 +0000 (20:25 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 31 Dec 2013 18:26:56 +0000 (20:26 +0200)
This really only depends on the input item(s) and the core.

include/vlc_input_item.h
src/libvlc.c
src/libvlc.h
src/libvlccore.sym

index 1359d68a4d0aa1fdc4f460feae16b1f3b1eb2d0b..d1f019898a742cae114119752947d495b9ea2354 100644 (file)
@@ -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
  ******************/
index ac7e2a85800175140db2bbfdfa2f0114f5bf9327..2545ba847233ffeb9aeaa18c69ec3ab42d17bd06 100644 (file)
@@ -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;
+}
index 65f0d6d985cd0660b34c6eaf1e18356b9af77d3f..ec4b3eaa51bfe620d5b0bc0cf9fdc54fe1dc2109 100644 (file)
@@ -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 */
index f9c36cb873020cc6b04d122fe5e9889722161e24..200d1f28a0c0d2c434a89ea796ff66d7843ba80c 100644 (file)
@@ -230,6 +230,8 @@ libvlc_InternalDestroy
 libvlc_InternalInit
 libvlc_Quit
 libvlc_SetExitHandler
+libvlc_MetaRequest
+libvlc_ArtRequest
 vlc_UrlParse
 vlc_UrlClean
 vlc_path2uri