Skip to content

Commit

Permalink
preparser: remove the timeout argument
Browse files Browse the repository at this point in the history
The timeout is now setup once when creating the preparer.
  • Loading branch information
tguillem authored and robUx4 committed Oct 13, 2024
1 parent 80f325c commit 1b1ca79
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 15 deletions.
6 changes: 1 addition & 5 deletions include/vlc_preparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/media.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ int libvlc_media_parse_request(libvlc_instance_t *inst, libvlc_media_t *media,
vlc_preparser_SetTimeout(parser, VLC_TICK_FROM_MS(timeout));

ret = vlc_preparser_Push(parser, item, parse_scope,
&preparser_callbacks, media, -1, media);
&preparser_callbacks, media, media);
if (ret != VLC_SUCCESS)
{
atomic_fetch_sub_explicit(&media->worker_count, 1,
Expand Down
2 changes: 1 addition & 1 deletion modules/gui/qt/player/player_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/media_source/media_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion src/playlist/preparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
8 changes: 3 additions & 5 deletions src/preparser/preparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,19 +341,17 @@ 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;

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;

Expand Down
2 changes: 1 addition & 1 deletion test/libvlc/media.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b1ca79

Please sign in to comment.