[vlc-devel] [PATCH 2/6] player: add selected_by_user in tracks

Thomas Guillem thomas at gllm.fr
Fri Feb 28 13:47:27 CET 2020


It will be used to get the tracks specifically selected by the users.
---
 src/player/input.c  | 2 ++
 src/player/player.h | 2 ++
 src/player/track.c  | 1 +
 3 files changed, 5 insertions(+)

diff --git a/src/player/input.c b/src/player/input.c
index 1d689c2a9d6..7fccd70b91e 100644
--- a/src/player/input.c
+++ b/src/player/input.c
@@ -494,6 +494,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
             if (trackpriv)
             {
                 trackpriv->t.selected = true;
+                trackpriv->selected_by_user = ev->forced;
                 vlc_player_SendEvent(player, on_track_selection_changed,
                                      NULL, trackpriv->t.es_id);
             }
@@ -524,6 +525,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
             {
                 vlc_player_RemoveTimerSource(player, ev->id);
                 trackpriv->t.selected = false;
+                trackpriv->selected_by_user = false;
                 vlc_player_SendEvent(player, on_track_selection_changed,
                                      trackpriv->t.es_id, NULL);
             }
diff --git a/src/player/player.h b/src/player/player.h
index 202821ce238..8148d6cb62a 100644
--- a/src/player/player.h
+++ b/src/player/player.h
@@ -36,6 +36,8 @@ struct vlc_player_track_priv
     vlc_tick_t delay;
     /* only valid if selected and if category is VIDEO_ES or SPU_ES */
     enum vlc_vout_order vout_order;
+    /* Used to save or not the track selection */
+    bool selected_by_user;
 };
 
 typedef struct VLC_VECTOR(struct vlc_player_program *)
diff --git a/src/player/track.c b/src/player/track.c
index b02f8d58811..7a519a14aa9 100644
--- a/src/player/track.c
+++ b/src/player/track.c
@@ -113,6 +113,7 @@ vlc_player_track_priv_New(vlc_es_id_t *id, const char *name, const es_format_t *
     trackpriv->delay = INT64_MAX;
     trackpriv->vout = NULL;
     trackpriv->vout_order = VLC_VOUT_ORDER_NONE;
+    trackpriv->selected_by_user = false;
 
     track->name = strdup(name);
     if (!track->name)
-- 
2.20.1



More information about the vlc-devel mailing list