mirror of https://code.videolan.org/videolan/vlc
player: add support for program pre-selection
And don't check for program existence before selecting it.
This commit is contained in:
parent
07b50f6db4
commit
4696e78bde
|
@ -1244,6 +1244,13 @@ vlc_player_GetProgram(vlc_player_t *player, int group_id);
|
|||
/**
|
||||
* Select a program from an ES group identifier
|
||||
*
|
||||
* This function can be used to pre-select a program by its id before starting
|
||||
* the player. It has only effect for the current media. It can also be used
|
||||
* when the player is already started.
|
||||
*
|
||||
* @note Selecting a non-existing program will cause the player to no select
|
||||
* any programs. Therefore, all tracks will be disabled.
|
||||
*
|
||||
* @param player locked player instance
|
||||
* @param group_id a program ID (retrieved from
|
||||
* vlc_player_cbs.on_program_list_changed or vlc_player_GetProgramAt())
|
||||
|
@ -1519,7 +1526,7 @@ vlc_player_GetSelectedTrack(vlc_player_t *player, enum es_format_category_e cat)
|
|||
/**
|
||||
* Select tracks by their string identifier
|
||||
*
|
||||
* This function can be used pre-select a list of tracks before starting the
|
||||
* This function can be used to pre-select a list of tracks before starting the
|
||||
* player. It has only effect for the current media. It can also be used when
|
||||
* the player is already started.
|
||||
|
||||
|
|
|
@ -295,15 +295,12 @@ vlc_player_SelectProgram(vlc_player_t *player, int id)
|
|||
if (!input)
|
||||
return;
|
||||
|
||||
input_SetProgramId(input->thread, id);
|
||||
|
||||
const struct vlc_player_program *prgm =
|
||||
vlc_player_program_vector_FindById(&input->program_vector,
|
||||
id, NULL);
|
||||
if (!prgm)
|
||||
return;
|
||||
int ret = input_ControlPushHelper(input->thread,
|
||||
INPUT_CONTROL_SET_PROGRAM,
|
||||
&(vlc_value_t) { .i_int = id });
|
||||
if (ret == VLC_SUCCESS)
|
||||
if (prgm != NULL)
|
||||
vlc_player_osd_Program(player, prgm->name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue