[vlc-commits] [Git][videolan/vlc][master] 3 commits: preparser: add vlc_preparser_SetTimeout (temporary)
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Oct 13 09:40:45 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
40f24d7e by Thomas Guillem at 2024-10-13T09:25:42+00:00
preparser: add vlc_preparser_SetTimeout (temporary)
Will be used by libvlc_media_t, temporarily, waiting for the future
libvlc_parser_t API.
- - - - -
80f325c8 by Thomas Guillem at 2024-10-13T09:25:42+00:00
lib: media: use vlc_preparser_SetTimeout()
The preparser timeout will be setup once, hence the usage of this
temporary API for libvlc (waiting for the libvlc_parser_t API).
- - - - -
1b1ca792 by Thomas Guillem at 2024-10-13T09:25:42+00:00
preparser: remove the timeout argument
The timeout is now setup once when creating the preparer.
- - - - -
8 changed files:
- include/vlc_preparser.h
- lib/media.c
- modules/gui/qt/player/player_controller.cpp
- src/libvlccore.sym
- src/media_source/media_tree.c
- src/playlist/preparse.c
- src/preparser/preparser.c
- test/libvlc/media.c
Changes:
=====================================
include/vlc_preparser.h
=====================================
@@ -78,9 +78,6 @@ VLC_API vlc_preparser_t *vlc_preparser_New( vlc_object_t *obj,
* @param option preparse flag, cf @ref input_item_meta_request_option_t
* @param cbs callback to listen to events (can't be NULL)
* @param cbs_userdata opaque pointer used by the callbacks
- * @param timeout maximum time allowed to preparse the item. If -1, the default
- * "preparse-timeout" option will be used as a timeout. If 0, it will wait
- * indefinitely. If > 0, the timeout will be used (in milliseconds).
* @param id unique id provided by the caller. This is can be used to cancel
* the request with vlc_preparser_Cancel()
* @returns VLC_SUCCESS if the item was scheduled for preparsing, an error code
@@ -90,8 +87,7 @@ VLC_API vlc_preparser_t *vlc_preparser_New( vlc_object_t *obj,
VLC_API int vlc_preparser_Push( vlc_preparser_t *preparser, input_item_t *item,
input_item_meta_request_option_t option,
const input_item_parser_cbs_t *cbs,
- void *cbs_userdata,
- int timeout, void *id );
+ void *cbs_userdata, void *id );
/**
* This function cancel all preparsing requests for a given id
@@ -119,6 +115,12 @@ VLC_API void vlc_preparser_Delete( vlc_preparser_t *preparser );
*/
VLC_API void vlc_preparser_Deactivate( vlc_preparser_t *preparser );
+/**
+ * Do not use, libVLC only fonction, will be removed soon
+ */
+VLC_API void vlc_preparser_SetTimeout( vlc_preparser_t *preparser,
+ vlc_tick_t timeout ) VLC_DEPRECATED;
+
/** @} vlc_preparser */
#endif
=====================================
lib/media.c
=====================================
@@ -811,8 +811,13 @@ int libvlc_media_parse_request(libvlc_instance_t *inst, libvlc_media_t *media,
parse_scope |= META_REQUEST_OPTION_DO_INTERACT;
parse_scope |= META_REQUEST_OPTION_PARSE_SUBITEMS;
+ if (timeout == -1)
+ timeout = var_InheritInteger(inst->p_libvlc_int, "preparse-timeout");
+
+ vlc_preparser_SetTimeout(parser, VLC_TICK_FROM_MS(timeout));
+
ret = vlc_preparser_Push(parser, item, parse_scope,
- &preparser_callbacks, media, timeout, media);
+ &preparser_callbacks, media, media);
if (ret != VLC_SUCCESS)
{
atomic_fetch_sub_explicit(&media->worker_count, 1,
=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -1974,7 +1974,7 @@ void PlayerController::requestArtUpdate( input_item_t *p_item )
}
vlc_preparser_Push( d->m_preparser, p_item, META_REQUEST_OPTION_FETCH_ANY,
- &art_fetcher_cbs, d, -1, nullptr );
+ &art_fetcher_cbs, d, nullptr );
}
void PlayerControllerPrivate::onArtFetchEnded(input_item_t *p_item, bool)
=====================================
src/libvlccore.sym
=====================================
@@ -1045,3 +1045,4 @@ vlc_preparser_Push
vlc_preparser_Cancel
vlc_preparser_Delete
vlc_preparser_Deactivate
+vlc_preparser_SetTimeout
=====================================
src/media_source/media_tree.c
=====================================
@@ -352,6 +352,6 @@ vlc_media_tree_Preparse(vlc_media_tree_t *tree, vlc_preparser_t *parser,
vlc_preparser_Push(parser, media, META_REQUEST_OPTION_PARSE |
META_REQUEST_OPTION_DO_INTERACT |
META_REQUEST_OPTION_PARSE_SUBITEMS,
- &preparser_callbacks, tree, 0, id);
+ &preparser_callbacks, tree, id);
#endif
}
=====================================
src/playlist/preparse.c
=====================================
@@ -155,6 +155,6 @@ vlc_playlist_AutoPreparse(vlc_playlist_t *playlist, input_item_t *input,
options |= META_REQUEST_OPTION_PARSE_SUBITEMS;
vlc_preparser_Push(playlist->parser, input, options,
- &preparser_callbacks, playlist, -1, NULL);
+ &preparser_callbacks, playlist, NULL);
}
}
=====================================
src/preparser/preparser.c
=====================================
@@ -341,8 +341,7 @@ vlc_preparser_t* vlc_preparser_New( vlc_object_t *parent, unsigned max_threads,
int vlc_preparser_Push( vlc_preparser_t *preparser,
input_item_t *item, input_item_meta_request_option_t i_options,
- const input_item_parser_cbs_t *cbs, void *cbs_userdata,
- int timeout_ms, void *id )
+ const input_item_parser_cbs_t *cbs, void *cbs_userdata, void *id )
{
if( atomic_load( &preparser->deactivated ) )
return VLC_EGENERIC;
@@ -350,10 +349,9 @@ int vlc_preparser_Push( vlc_preparser_t *preparser,
assert(i_options & META_REQUEST_OPTION_PARSE
|| i_options & META_REQUEST_OPTION_FETCH_ANY);
- vlc_tick_t timeout = timeout_ms == -1 ? preparser->default_timeout
- : VLC_TICK_FROM_MS(timeout_ms);
struct task *task =
- TaskNew(preparser, item, i_options, cbs, cbs_userdata, id, timeout);
+ TaskNew(preparser, item, i_options, cbs, cbs_userdata, id,
+ preparser->default_timeout);
if( !task )
return VLC_ENOMEM;
@@ -395,6 +393,12 @@ void vlc_preparser_Deactivate( vlc_preparser_t* preparser )
vlc_preparser_Cancel(preparser, NULL);
}
+void vlc_preparser_SetTimeout( vlc_preparser_t *preparser,
+ vlc_tick_t timeout )
+{
+ preparser->default_timeout = timeout;
+}
+
void vlc_preparser_Delete( vlc_preparser_t *preparser )
{
/* In case vlc_preparser_Deactivate() has not been called */
=====================================
test/libvlc/media.c
=====================================
@@ -246,7 +246,7 @@ static void test_input_metadata_timeout(libvlc_instance_t *vlc, int timeout,
i_ret = vlc_preparser_Push(parser, p_item,
META_REQUEST_OPTION_PARSE |
META_REQUEST_OPTION_FETCH_LOCAL,
- &cbs, &sem, -1, parser);
+ &cbs, &sem, parser);
assert(i_ret == 0);
if (wait_and_cancel > 0)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c272db053a3600f6bf05aa1f4b658faf49932d46...1b1ca7925b75fe01d0259566456c5443c0c679c1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c272db053a3600f6bf05aa1f4b658faf49932d46...1b1ca7925b75fe01d0259566456c5443c0c679c1
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