[vlc-devel] [PATCH 1/3] libvlc: libvlc_MetadataRequest: add option for no automatic recursion

Filip Roséen filip at atch.se
Fri Jul 20 10:15:42 CEST 2018


The previous behavior of libvlc_MetadataRequest was introduced in
f9aab1fe34, which resulted in unconditional recursion as the
i_preparse_depth of the passed item would always reset back to 1.

In order to have explicit control over how far we preparse, a new
option has been added simply stating: "do not automatically recurse,
use the i_preparse_depth of the item passed".

refs: #18236

---

Given that the behavior introduced in f9aab1fe34, has been public for
a long time, I am reluctant to change the behavior of
libvlc_MetadataRequest as I am sure there are users of it that now
relies on the, from our perspective, broken behavior.
---
 include/vlc_input_item.h | 3 ++-
 src/libvlc.c             | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 82ad4e4733..4bd07c1733 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -373,7 +373,8 @@ typedef enum input_item_meta_request_option_t
     META_REQUEST_OPTION_SCOPE_LOCAL   = 0x01,
     META_REQUEST_OPTION_SCOPE_NETWORK = 0x02,
     META_REQUEST_OPTION_SCOPE_ANY     = 0x03,
-    META_REQUEST_OPTION_DO_INTERACT   = 0x04
+    META_REQUEST_OPTION_DO_INTERACT   = 0x04,
+    META_REQUEST_OPTION_NO_AUTO_RECURSION = 0x08,
 } input_item_meta_request_option_t;
 
 /* status of the vlc_InputItemPreparseEnded event */
diff --git a/src/libvlc.c b/src/libvlc.c
index 8e9eea58a9..9ba4069f4e 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -485,8 +485,11 @@ int libvlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item,
         return VLC_ENOMEM;
 
     vlc_mutex_lock( &item->lock );
-    if( item->i_preparse_depth == 0 )
-        item->i_preparse_depth = 1;
+    if( !( i_options & META_REQUEST_OPTION_NO_AUTO_RECURSION ) )
+    {
+        if( item->i_preparse_depth == 0 )
+            item->i_preparse_depth = 1;
+    }
     if( i_options & META_REQUEST_OPTION_DO_INTERACT )
         item->b_preparse_interact = true;
     vlc_mutex_unlock( &item->lock );
-- 
2.18.0


More information about the vlc-devel mailing list