<html><head></head><body>This needs a description and rationale, IMO.<br><br><div class="gmail_quote">Le 7 février 2020 16:08:35 GMT+02:00, Francois Cartegnie <fcvlcdev@free.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><hr> src/player/input.c | 61 ++++++++++++++++++++++++++++-----------------<br> src/player/player.h | 2 +-<br> 2 files changed, 39 insertions(+), 24 deletions(-)<br><br>diff --git a/src/player/input.c b/src/player/input.c<br>index 37a235664b..45ecb1c405 100644<br>--- a/src/player/input.c<br>+++ b/src/player/input.c<br>@@ -355,44 +355,61 @@ vlc_player_input_HandleProgramEvent(struct vlc_player_input *input,<br> <br> static void<br> vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,<br>- const struct vlc_input_event_es *ev)<br>+ const struct vlc_input_event_es *ev,<br>+ const struct vlc_player_track_priv *trackpriv)<br> {<br> vlc_player_t *player = input->player;<br>+ const struct vlc_player_track_priv *t;<br>+ if(ev->fmt->i_codec != VLC_CODEC_TELETEXT)<br>+ return;<br> switch (ev->action)<br> {<br> case VLC_INPUT_ES_ADDED:<br>- if (input->teletext_menu)<br>+ if(!input->teletext_menu || trackpriv->t.selected)<br>+ input->teletext_menu = trackpriv;<br>+ vlc_vector_foreach(t, &input->spu_track_vector)<br> {<br>- msg_Warn(player, "Can't handle more than one teletext menu "<br>- "track. Using the last one.");<br>- vlc_player_track_priv_Delete(input->teletext_menu);<br>+ /* Did we have index teletext page before in spu list */<br>+ if(t->t.fmt.i_codec == VLC_CODEC_TELETEXT &&<br>+ t->t.fmt.subs.teletext.i_type != 0x02 &&<br>+ t->t.fmt.subs.teletext.i_type != 0x05 &&<br>+ t != trackpriv)<br>+ return;<br> }<br>- input->teletext_menu = vlc_player_track_priv_New(ev->id, ev->title,<br>- ev->fmt);<br>- if (!input->teletext_menu)<br>- return;<br>-<br> vlc_player_SendEvent(player, on_teletext_menu_changed, true);<br> break;<br> case VLC_INPUT_ES_DELETED:<br> {<br>- if (input->teletext_menu && input->teletext_menu->t.es_id == ev->id)<br>+ if (input->teletext_menu == trackpriv)<br> {<br> assert(!input->teletext_enabled);<br>-<br>- vlc_player_track_priv_Delete(input->teletext_menu);<br> input->teletext_menu = NULL;<br>- vlc_player_SendEvent(player, on_teletext_menu_changed, false);<br> }<br>+ vlc_vector_foreach(t, &input->spu_track_vector)<br>+ {<br>+ /* Do we still have index teletext page in spu list */<br>+ if(t->t.fmt.i_codec == VLC_CODEC_TELETEXT &&<br>+ t->t.fmt.subs.teletext.i_type != 0x02 &&<br>+ t->t.fmt.subs.teletext.i_type != 0x05 &&<br>+ t != trackpriv)<br>+ {<br>+ input->teletext_menu = t;<br>+ return;<br>+ }<br>+ }<br>+ vlc_player_SendEvent(player, on_teletext_menu_changed, false);<br> break;<br> }<br> case VLC_INPUT_ES_UPDATED:<br> break;<br> case VLC_INPUT_ES_SELECTED:<br> case VLC_INPUT_ES_UNSELECTED:<br>- if (input->teletext_menu->t.es_id == ev->id)<br>+ if(trackpriv->t.fmt.subs.teletext.i_type != 0x02 &&<br>+ trackpriv->t.fmt.subs.teletext.i_type != 0x05)<br> {<br> input->teletext_enabled = ev->action == VLC_INPUT_ES_SELECTED;<br>+ if(input->teletext_enabled)<br>+ input->teletext_menu = trackpriv;<br> vlc_player_SendEvent(player, on_teletext_enabled_changed,<br> input->teletext_enabled);<br> }<br>@@ -408,14 +425,6 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,<br> {<br> assert(ev->id && ev->title && ev->fmt);<br> <br>- if (ev->fmt->i_cat == SPU_ES && ev->fmt->i_codec == VLC_CODEC_TELETEXT<br>- && (ev->fmt->subs.teletext.i_magazine == 1<br>- || ev->fmt->subs.teletext.i_magazine > 8))<br>- {<br>- vlc_player_input_HandleTeletextMenu(input, ev);<br>- return;<br>- }<br>-<br> vlc_player_track_vector *vec =<br> vlc_player_input_GetTrackVector(input, ev->fmt->i_cat);<br> if (!vec)<br>@@ -463,6 +472,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,<br> input->ml.states.current_subtitle_track == ev->fmt->i_id)<br> vlc_player_SelectTrack(input->player, &trackpriv->t,<br> VLC_PLAYER_SELECT_EXCLUSIVE);<br>+ vlc_player_input_HandleTeletextMenu(input, ev, trackpriv);<br> default:<br> break;<br> }<br>@@ -473,6 +483,8 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,<br> trackpriv = vlc_player_track_vector_FindById(vec, ev->id, &idx);<br> if (trackpriv)<br> {<br>+ if(trackpriv->t.fmt.i_cat == SPU_ES)<br>+ vlc_player_input_HandleTeletextMenu(input, ev, trackpriv);<br> vlc_player_SendEvent(player, on_track_list_changed,<br> VLC_PLAYER_LIST_REMOVED, &trackpriv->t);<br> vlc_vector_remove(vec, idx);<br>@@ -513,6 +525,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,<br> case SPU_ES:<br> if (input->ml.default_subtitle_track == -2)<br> input->ml.default_subtitle_track = ev->fmt->i_id;<br>+ vlc_player_input_HandleTeletextMenu(input, ev, trackpriv);<br> break;<br> default:<br> break;<br>@@ -526,6 +539,8 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,<br> trackpriv->t.selected = false;<br> vlc_player_SendEvent(player, on_track_selection_changed,<br> trackpriv->t.es_id, NULL);<br>+ if(trackpriv->t.fmt.i_cat == SPU_ES)<br>+ vlc_player_input_HandleTeletextMenu(input, ev, trackpriv);<br> }<br> break;<br> default:<br>diff --git a/src/player/player.h b/src/player/player.h<br>index d7e499a84e..e45cc1d510 100644<br>--- a/src/player/player.h<br>+++ b/src/player/player.h<br>@@ -83,7 +83,7 @@ struct vlc_player_input<br> vlc_player_track_vector video_track_vector;<br> vlc_player_track_vector audio_track_vector;<br> vlc_player_track_vector spu_track_vector;<br>- struct vlc_player_track_priv *teletext_menu;<br>+ const struct vlc_player_track_priv *teletext_menu;<br> <br> struct vlc_player_title_list *titles;<br> </pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>