<html><head></head><body>Hi,<br><br>While it likely makes sense at the level of UI widgets and user interactions, it seems a bit out of place, standing alone, at the player API level.<br><br>In particular, I doubt that enabling multiple tracks mode in Qt should interfere with the track selection of, say, the HTTP remote control.<br><br>IMO, the API should just take the list of active tracks, whether it be empty, a singleton, or larger.<br><br><div class="gmail_quote">Le 11 mai 2019 08:32:05 GMT+02:00, Roland Bewick <roland.bewick@gmail.com> 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> include/vlc_player.h | 13 ++++++++++<br> modules/gui/qt/util/input_models.cpp | 6 +++++<br> src/input/es_out.c | 47 ++++++++++++++++++++++++++++++++++--<br> src/input/es_out.h | 5 +++-<br> src/input/input.c | 5 ++++<br> src/input/input_internal.h | 1 +<br> src/input/player.c | 11 +++++++++<br> src/libvlccore.sym | 1 +<br> 8 files changed, 86 insertions(+), 3 deletions(-)<br><br>diff --git a/include/vlc_player.h b/include/vlc_player.h<br>index 1aa5f8e687..077b3883ad 100644<br>--- a/include/vlc_player.h<br>+++ b/include/vlc_player.h<br>@@ -2428,6 +2428,19 @@ VLC_API unsigned<br> vlc_player_GetSubtitleTextScale(vlc_player_t *player);<br> <br> /**<br>+ * Allow secondary subtitle track(s) to be selected when<br>+ * the primary subtitle track is already selected.<br>+ *<br>+ * @note This must be returned to false immediately after<br>+ * selection of the subtitle.<br>+ *<br>+ * @param player locked player instance<br>+ * @param select true to allow selection of multiple subtitles<br>+ */<br>+VLC_API void<br>+vlc_player_SetSubtitleMultipleSelection(vlc_player_t *player, bool multiple);<br>+<br>+/**<br> * Get the signal quality and strength of the current media<br> *<br> * @param player locked player instance<br>diff --git a/modules/gui/qt/util/input_models.cpp b/modules/gui/qt/util/input_models.cpp<br>index e381fbb917..34fefa3960 100644<br>--- a/modules/gui/qt/util/input_models.cpp<br>+++ b/modules/gui/qt/util/input_models.cpp<br>@@ -62,7 +62,13 @@ bool TrackListModel::setData(const QModelIndex &index, const QVariant &value, in<br> vlc_player_locker lock{ m_player };<br> <br> if (select)<br>+ {<br>+ /* Only allow secondary subtitles to be manually selected<br>+ by the user through the GUI. */<br>+ vlc_player_SetSubtitleMultipleSelection(m_player, true);<br> vlc_player_SelectTrack(m_player, m_data[row].m_id.get());<br>+ vlc_player_SetSubtitleMultipleSelection(m_player, false);<br>+ }<br> else<br> vlc_player_UnselectTrack(m_player, m_data[row].m_id.get());<br> return true;<br>diff --git a/src/input/es_out.c b/src/input/es_out.c<br>index 2026fb8c22..54245aed4e 100644<br>--- a/src/input/es_out.c<br>+++ b/src/input/es_out.c<br>@@ -209,6 +209,9 @@ typedef struct<br> /* Used only to limit debugging output */<br> int i_prev_stream_level;<br> <br>+ /* Used to temporarily allow subtitle selection of multiple sub tracks */<br>+ bool b_multiple_subtitle_selection;<br>+<br> es_out_t out;<br> } es_out_sys_t;<br> <br>@@ -2037,6 +2040,24 @@ static void EsOutUnselectEs( es_out_t *out, es_out_id_t *es, bool b_update )<br> }<br> <br> /**<br>+ * Count the number of selected ES of the given category<br>+ * \param i_cat the ES category (e.g. SPU_ES)<br>+ * \return count<br>+ */<br>+static int EsOutCountSelected( es_out_sys_t *p_sys, <br>+ enum es_format_category_e i_cat )<br>+{<br>+ int i_selected_count = 0;<br>+ es_out_id_t *other;<br>+ foreach_es_then_es_slaves(other)<br>+ if( other->fmt.i_cat == i_cat && EsIsSelected( other ) )<br>+ {<br>+ ++i_selected_count;<br>+ }<br>+ return i_selected_count;<br>+}<br>+<br>+/**<br> * Select an ES given the current mode<br> * XXX: you need to take a the lock before (stream.stream_lock)<br> *<br>@@ -2056,9 +2077,24 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )<br> return;<br> }<br> <br>+ /* Select secondary if the user has already selected a primary sub track */<br>+ bool b_select_secondary_subtitle = es->fmt.i_cat == SPU_ES && <br>+ p_sys->b_multiple_subtitle_selection &&<br>+ p_esprops->p_main_es != NULL &&<br>+ EsIsSelected(p_esprops->p_main_es);<br>+<br>+ if ( b_select_secondary_subtitle &&<br>+ EsOutCountSelected( p_sys, es->fmt.i_cat ) > 1 )<br>+ {<br>+ /* Don't allow more than one secondary SPU ES selected at a time. */<br>+ EsOutSendEsEvent(out, es, VLC_INPUT_ES_UNSELECTED);<br>+ return;<br>+ }<br>+<br> bool b_auto_unselect = p_esprops && p_sys->i_mode == ES_OUT_MODE_AUTO &&<br> p_esprops->e_policy == ES_OUT_ES_POLICY_EXCLUSIVE &&<br>- p_esprops->p_main_es && p_esprops->p_main_es != es;<br>+ p_esprops->p_main_es && p_esprops->p_main_es != es &&<br>+ !b_select_secondary_subtitle;<br> <br> if( p_sys->i_mode == ES_OUT_MODE_ALL || b_force )<br> {<br>@@ -2178,7 +2214,8 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )<br> }<br> <br> /* FIXME TODO handle priority here */<br>- if( p_esprops && p_sys->i_mode == ES_OUT_MODE_AUTO && EsIsSelected( es ) )<br>+ if( p_esprops && p_sys->i_mode == ES_OUT_MODE_AUTO && EsIsSelected( es ) && <br>+ !b_select_secondary_subtitle )<br> p_esprops->p_main_es = es;<br> }<br> <br>@@ -3187,6 +3224,12 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )<br> }<br> return ret;<br> }<br>+ case ES_OUT_SET_MULTIPLE_SUBTITLE_SELECTION:<br>+ {<br>+ es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);<br>+ p_sys->b_multiple_subtitle_selection = va_arg( args, int );<br>+ return VLC_SUCCESS;<br>+ }<br> default:<br> msg_Err( p_sys->p_input, "unknown query 0x%x in %s", i_query,<br> __func__ );<br>diff --git a/src/input/es_out.h b/src/input/es_out.h<br>index 7cbea71728..3f37d73b68 100644<br>--- a/src/input/es_out.h<br>+++ b/src/input/es_out.h<br>@@ -89,7 +89,10 @@ enum es_out_query_private_e<br> ES_OUT_SET_VBI_PAGE, /* arg1=unsigned res=can fail */<br> <br> /* Set VBI/Teletext menu transparent */<br>- ES_OUT_SET_VBI_TRANSPARENCY /* arg1=bool res=can fail */<br>+ ES_OUT_SET_VBI_TRANSPARENCY, /* arg1=bool res=can fail */<br>+ <br>+ /* Allow selection of a secondary SPU ES if primary is already selected */<br>+ ES_OUT_SET_MULTIPLE_SUBTITLE_SELECTION, /* arg1=bool res=cannot fail */<br> };<br> <br> static inline void es_out_SetMode( es_out_t *p_out, int i_mode )<br>diff --git a/src/input/input.c b/src/input/input.c<br>index 381b85a9fd..821a18ff2c 100644<br>--- a/src/input/input.c<br>+++ b/src/input/input.c<br>@@ -2396,6 +2396,11 @@ static bool Control( input_thread_t *p_input,<br> param.vbi_transparency.id,<br> param.vbi_transparency.enabled );<br> break;<br>+ case INPUT_CONTROL_SET_MULTIPLE_SUBTITLE_SELECTION:<br>+ es_out_Control( priv->p_es_out_display,<br>+ ES_OUT_SET_MULTIPLE_SUBTITLE_SELECTION,<br>+ param.val.b_bool );<br>+ break;<br> <br> case INPUT_CONTROL_NAV_ACTIVATE:<br> case INPUT_CONTROL_NAV_UP:<br>diff --git a/src/input/input_internal.h b/src/input/input_internal.h<br>index 18495881c2..914cebe7d4 100644<br>--- a/src/input/input_internal.h<br>+++ b/src/input/input_internal.h<br>@@ -268,6 +268,7 @@ enum input_control_e<br> <br> INPUT_CONTROL_SET_VBI_PAGE,<br> INPUT_CONTROL_SET_VBI_TRANSPARENCY,<br>+ INPUT_CONTROL_SET_MULTIPLE_SUBTITLE_SELECTION,<br> };<br> <br> /* Internal helpers */<br>diff --git a/src/input/player.c b/src/input/player.c<br>index da02375a66..843f86000c 100644<br>--- a/src/input/player.c<br>+++ b/src/input/player.c<br>@@ -2888,6 +2888,17 @@ vlc_player_SetSubtitleSync(vlc_player_t *player,<br> }<br> }<br> <br>+void<br>+vlc_player_SetSubtitleMultipleSelection(vlc_player_t *player, bool multiple)<br>+{<br>+ struct vlc_player_input *input = vlc_player_get_input_locked(player);<br>+ if (!input)<br>+ return;<br>+ input_ControlPushHelper(input->thread,<br>+ INPUT_CONTROL_SET_MULTIPLE_SUBTITLE_SELECTION,<br>+ &(vlc_value_t){ .b_bool = multiple });<br>+}<br>+<br> vlc_tick_t<br> vlc_player_GetSubtitleDelay(vlc_player_t *player)<br> {<br>diff --git a/src/libvlccore.sym b/src/libvlccore.sym<br>index 1cbbfe72f6..d0070d42b8 100644<br>--- a/src/libvlccore.sym<br>+++ b/src/libvlccore.sym<br>@@ -868,6 +868,7 @@ vlc_player_SetStartPaused<br> vlc_player_SetSubtitleDelay<br> vlc_player_SetSubtitleSync<br> vlc_player_SetSubtitleTextScale<br>+vlc_player_SetSubtitleMultipleSelection<br> vlc_player_SetTeletextEnabled<br> vlc_player_SetTeletextTransparency<br> vlc_player_SetTrackCategoryEnabled</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>