[vlc-commits] core: add vlc_MetadataRequest

Filip Roséen git at videolan.org
Sun Jul 29 18:58:33 CEST 2018


vlc/vlc-3.0 | branch: master | Filip Roséen <filip at atch.se> | Wed Jul 25 04:06:38 2018 +0200| [f7f301cce34a93324efa572f181552fb0cb361a8] | committer: Jean-Baptiste Kempf

core: add vlc_MetadataRequest

This function is to be used by entities within the core that would
like to spawn a metadata request. Such request will not have the
implicit recursiveness of libvlc_MetadataRequest (which is to be
called by users of libvlc).

Signed-off-by: Thomas Guillem <thomas at gllm.fr>
(cherry picked from commit d2c29640ffcc0af46e9abde972a10d636f688a29)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/libvlc.c | 20 ++++++++++++++++++++
 src/libvlc.h |  6 ++++++
 2 files changed, 26 insertions(+)

diff --git a/src/libvlc.c b/src/libvlc.c
index 7e343a6365..c3effa7016 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -486,6 +486,26 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
     }
 }
 
+int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item,
+                        input_item_meta_request_option_t i_options,
+                        int timeout, void *id)
+{
+    libvlc_priv_t *priv = libvlc_priv(libvlc);
+
+    if (unlikely(priv->parser == NULL))
+        return VLC_ENOMEM;
+
+    if( i_options & META_REQUEST_OPTION_DO_INTERACT )
+    {
+        vlc_mutex_lock( &item->lock );
+        item->b_preparse_interact = true;
+        vlc_mutex_unlock( &item->lock );
+    }
+    playlist_preparser_Push( priv->parser, item, i_options, timeout, id );
+    return VLC_SUCCESS;
+
+}
+
 /**
  * Requests extraction of the meta data for an input item (a.k.a. preparsing).
  * The actual extraction is asynchronous. It can be cancelled with
diff --git a/src/libvlc.h b/src/libvlc.h
index 7d7982157e..e42c1185dd 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -25,6 +25,8 @@
 #ifndef LIBVLC_LIBVLC_H
 # define LIBVLC_LIBVLC_H 1
 
+#include <vlc_input_item.h>
+
 extern const char psz_vlc_changeset[];
 
 typedef struct variable_t variable_t;
@@ -205,6 +207,10 @@ void intf_DestroyAll( libvlc_int_t * );
 
 #define libvlc_stats( o ) (libvlc_priv((VLC_OBJECT(o))->obj.libvlc)->b_stats)
 
+int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item,
+                        input_item_meta_request_option_t i_options,
+                        int timeout, void *id);
+
 /*
  * Variables stuff
  */



More information about the vlc-commits mailing list