[vlc-devel] [PATCH 8/9] core: add libvlc_MetadataCancel
Thomas Guillem
thomas at gllm.fr
Wed Jun 1 13:24:52 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 c695e8a..0ba8138 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -402,6 +402,7 @@ VLC_API int libvlc_MetadataRequest( libvlc_int_t *, input_item_t *,
input_item_meta_request_option_t );
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 *, input_item_t *);
/******************
* Input stats
diff --git a/src/libvlc.c b/src/libvlc.c
index 28b4bf4..aaac9c3 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)
@@ -646,3 +647,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, input_item_t *item)
+{
+ libvlc_priv_t *priv = libvlc_priv(libvlc);
+
+ if (unlikely(priv->parser == NULL))
+ return;
+
+ playlist_preparser_Cancel(priv->parser, item);
+}
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