[vlc-commits] player: refactor track research from id

Thomas Guillem git at videolan.org
Thu Jun 20 11:01:33 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun 14 11:57:54 2019 +0200| [587c8f85efd885735b6949ddf452a1219cc3ed43] | committer: Thomas Guillem

player: refactor track research from id

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=587c8f85efd885735b6949ddf452a1219cc3ed43
---

 src/input/player.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/input/player.c b/src/input/player.c
index 2405f4b084..b37fd8aa2e 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -1259,6 +1259,15 @@ vlc_player_track_vector_FindById(vlc_player_track_vector *vec, vlc_es_id_t *id,
     return NULL;
 }
 
+static struct vlc_player_track_priv *
+vlc_player_input_FindTrackById(struct vlc_player_input *input, vlc_es_id_t *id,
+                               size_t *idx)
+{
+    vlc_player_track_vector *vec =
+        vlc_player_input_GetTrackVector(input, vlc_es_id_GetCat(id));
+    return vec ? vlc_player_track_vector_FindById(vec, id, idx) : NULL;
+}
+
 size_t
 vlc_player_GetTrackCount(vlc_player_t *player, enum es_format_category_e cat)
 {
@@ -1898,10 +1907,8 @@ vlc_player_input_HandleVoutEvent(struct vlc_player_input *input,
 
     vlc_player_t *player = input->player;
 
-    vlc_player_track_vector *vec =
-        vlc_player_input_GetTrackVector(input, vlc_es_id_GetCat(ev->id));
     struct vlc_player_track_priv *trackpriv =
-        vec ? vlc_player_track_vector_FindById(vec, ev->id, NULL) : NULL;
+        vlc_player_input_FindTrackById(input, ev->id, NULL);
     if (!trackpriv)
         return;
 



More information about the vlc-commits mailing list