[vlc-devel] [PATCH 7/9] core: add libvlc_MetadataCancel

Thomas Guillem thomas at gllm.fr
Sun Jun 5 11:41:48 CEST 2016


---
 include/vlc_input_item.h |  1 +
 src/libvlc.c             | 19 ++++++++++++++++++-
 src/libvlccore.sym       |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 864b9fa..983b6e3 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -404,6 +404,7 @@ VLC_API int libvlc_MetadataRequest( libvlc_int_t *, input_item_t *,
                                     mtime_t, void * );
 VLC_API int libvlc_ArtRequest(libvlc_int_t *, input_item_t *,
                               input_item_meta_request_option_t );
+VLC_API void libvlc_MetadataCancel( libvlc_int_t *, void * );
 
 /******************
  * Input stats
diff --git a/src/libvlc.c b/src/libvlc.c
index 1897a57..c0789ce 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -611,7 +611,8 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
 
 /**
  * Requests extraction of the meta data for an input item (a.k.a. preparsing).
- * The actual extraction is asynchronous.
+ * The actual extraction is asynchronous. It can be cancelled with
+ * libvlc_MetadataCancel()
  */
 int libvlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item,
                            input_item_meta_request_option_t i_options,
@@ -647,3 +648,19 @@ int libvlc_ArtRequest(libvlc_int_t *libvlc, input_item_t *item,
     playlist_preparser_fetcher_Push(priv->parser, item, i_options);
     return VLC_SUCCESS;
 }
+
+/**
+ * Cancels extraction of the meta data for an input item.
+ *
+ * This does nothing if the input item is already processed or if it was not
+ * added with libvlc_MetadataRequest()
+ */
+void libvlc_MetadataCancel(libvlc_int_t *libvlc, void *id)
+{
+    libvlc_priv_t *priv = libvlc_priv(libvlc);
+
+    if (unlikely(priv->parser == NULL))
+        return;
+
+    playlist_preparser_Cancel(priv->parser, id);
+}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 6f25db1..6000b17 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -239,6 +239,7 @@ libvlc_InternalInit
 libvlc_Quit
 libvlc_SetExitHandler
 libvlc_MetadataRequest
+libvlc_MetadataCancel
 libvlc_ArtRequest
 vlc_UrlParse
 vlc_UrlClean
-- 
2.8.1



More information about the vlc-devel mailing list