[vlc-commits] [Git][videolan/vlc][master] 3 commits: input: add an option to force preparsing

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Dec 7 11:12:21 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e32fee66 by Steve Lhomme at 2022-12-07T10:45:26+00:00
input: add an option to force preparsing

For input items without a know type (imem access for example) preparsing
is not possible. With this option we allow forcing the preparsing in that
case, optionally. By default the current behavior remains the same.

- - - - -
b25464bd by Steve Lhomme at 2022-12-07T10:45:26+00:00
preparser: clean block identation

- - - - -
3f097706 by Steve Lhomme at 2022-12-07T10:45:26+00:00
libvlc: add libvlc_media_no_skip flag

for META_REQUEST_OPTION_NO_SKIP

- - - - -


4 changed files:

- include/vlc/libvlc_media.h
- include/vlc_input_item.h
- lib/media.c
- src/preparser/preparser.c


Changes:

=====================================
include/vlc/libvlc_media.h
=====================================
@@ -166,6 +166,10 @@ typedef enum libvlc_media_parse_flag_t
      * when the input is asking for credentials.
      */
     libvlc_media_do_interact    = 0x08,
+    /**
+     * Force parsing the media even if it would be skipped.
+     */
+    libvlc_media_no_skip        = 0x10,
 } libvlc_media_parse_flag_t;
 
 /**


=====================================
include/vlc_input_item.h
=====================================
@@ -483,6 +483,7 @@ typedef enum input_item_meta_request_option_t
     META_REQUEST_OPTION_FETCH_NETWORK = 0x08,
     META_REQUEST_OPTION_FETCH_ANY     = 0x0C,
     META_REQUEST_OPTION_DO_INTERACT   = 0x10,
+    META_REQUEST_OPTION_NO_SKIP       = 0x20,
 } input_item_meta_request_option_t;
 
 /* status of the on_preparse_ended() callback */


=====================================
lib/media.c
=====================================
@@ -860,6 +860,8 @@ int libvlc_media_parse_request(libvlc_instance_t *inst, libvlc_media_t *media,
         parse_scope |= META_REQUEST_OPTION_FETCH_NETWORK;
     if (parse_flag & libvlc_media_do_interact)
         parse_scope |= META_REQUEST_OPTION_DO_INTERACT;
+    if (parse_flag & libvlc_media_no_skip)
+        parse_scope |= META_REQUEST_OPTION_NO_SKIP;
 
     ret = libvlc_MetadataRequest(libvlc, item, parse_scope,
                                  &input_preparser_callbacks, media,


=====================================
src/preparser/preparser.c
=====================================
@@ -323,19 +323,22 @@ int input_preparser_Push( input_preparser_t *preparser,
         item->b_preparse_interact = true;
     vlc_mutex_unlock( &item->lock );
 
-    switch( i_type )
+    if (!(i_options & META_REQUEST_OPTION_NO_SKIP))
     {
-        case ITEM_TYPE_NODE:
-        case ITEM_TYPE_FILE:
-        case ITEM_TYPE_DIRECTORY:
-        case ITEM_TYPE_PLAYLIST:
-            if( !b_net || i_options & META_REQUEST_OPTION_SCOPE_NETWORK )
-                break;
-            /* fallthrough */
-        default:
-            if (cbs && cbs->on_preparse_ended)
-                cbs->on_preparse_ended(item, ITEM_PREPARSE_SKIPPED, cbs_userdata);
-            return VLC_SUCCESS;
+        switch( i_type )
+        {
+            case ITEM_TYPE_NODE:
+            case ITEM_TYPE_FILE:
+            case ITEM_TYPE_DIRECTORY:
+            case ITEM_TYPE_PLAYLIST:
+                if( !b_net || i_options & META_REQUEST_OPTION_SCOPE_NETWORK )
+                    break;
+                /* fallthrough */
+            default:
+                if (cbs && cbs->on_preparse_ended)
+                    cbs->on_preparse_ended(item, ITEM_PREPARSE_SKIPPED, cbs_userdata);
+                return VLC_SUCCESS;
+        }
     }
 
     vlc_tick_t timeout = timeout_ms == -1 ? preparser->default_timeout



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bd4b273d077b3a283a57b4b23e1fd12097c96d71...3f097706d2ea87c942afb42ae0d25da118c7ba1d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bd4b273d077b3a283a57b4b23e1fd12097c96d71...3f097706d2ea87c942afb42ae0d25da118c7ba1d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list