[vlc-commits] player: rename vlc_player_*Track to EsId

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


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jun 19 13:00:03 2019 +0200| [cb1b9717d0fedd903cf22de32d94b87933321341] | committer: Thomas Guillem

player: rename vlc_player_*Track to EsId

In order to clearly identify functions using a vlc_es_id_t*.
And add Track helpers.

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

 include/vlc_player.h                              | 43 +++++++++++++++++++----
 lib/audio.c                                       |  2 +-
 lib/video.c                                       |  4 +--
 modules/control/rc.c                              |  2 +-
 modules/gui/macosx/playlist/VLCPlayerController.m |  4 +--
 modules/gui/qt/util/input_models.cpp              |  4 +--
 modules/lua/libs/input.c                          |  4 +--
 src/input/player.c                                | 14 ++++----
 src/libvlccore.sym                                |  6 ++--
 test/src/input/player.c                           |  4 +--
 10 files changed, 59 insertions(+), 28 deletions(-)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index 34599a62a0..9eec9a70b8 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -103,7 +103,7 @@ struct vlc_player_program
  */
 struct vlc_player_track
 {
-    /** Id used for any player actions, like vlc_player_SelectTrack() */
+    /** Id used for any player actions, like vlc_player_SelectEsId() */
     vlc_es_id_t *es_id;
     /** Track name, always valid */
     const char *name;
@@ -1716,7 +1716,18 @@ vlc_player_GetSelectedTrack(vlc_player_t *player, enum es_format_category_e cat)
  * vlc_player_GetTrackAt())
  */
 VLC_API void
-vlc_player_SelectTrack(vlc_player_t *player, vlc_es_id_t *es_id);
+vlc_player_SelectEsId(vlc_player_t *player, vlc_es_id_t *es_id);
+
+
+/**
+ * Helper to select a track
+ */
+static inline void
+vlc_player_SelectTrack(vlc_player_t *player,
+                       const struct vlc_player_track *track)
+{
+    vlc_player_SelectEsId(player, track->es_id);
+}
 
 /**
  * Select the next track
@@ -1761,7 +1772,17 @@ vlc_player_SelectPrevTrack(vlc_player_t *player,
  * vlc_player_GetTrackAt())
  */
 VLC_API void
-vlc_player_UnselectTrack(vlc_player_t *player, vlc_es_id_t *es_id);
+vlc_player_UnselectEsId(vlc_player_t *player, vlc_es_id_t *es_id);
+
+/**
+ * Helper to unselect a track
+ */
+static inline void
+vlc_player_UnselectTrack(vlc_player_t *player,
+                         const struct vlc_player_track *track)
+{
+    vlc_player_UnselectEsId(player, track->es_id);
+}
 
 /**
  * Helper to unselect all tracks from an ES category
@@ -1777,7 +1798,7 @@ vlc_player_UnselectTrackCategory(vlc_player_t *player,
             vlc_player_GetTrackAt(player, cat, i);
         assert(track);
         if (track->selected)
-            vlc_player_UnselectTrack(player, track->es_id);
+            vlc_player_UnselectTrack(player, track);
     }
 }
 
@@ -1792,7 +1813,17 @@ vlc_player_UnselectTrackCategory(vlc_player_t *player,
  * vlc_player_GetTrackAt())
  */
 VLC_API void
-vlc_player_RestartTrack(vlc_player_t *player, vlc_es_id_t *es_id);
+vlc_player_RestartEsId(vlc_player_t *player, vlc_es_id_t *es_id);
+
+/**
+ * Helper to restart a track
+ */
+static inline void
+vlc_player_RestartTrack(vlc_player_t *player,
+                        const struct vlc_player_track *track)
+{
+    vlc_player_RestartEsId(player, track->es_id);
+}
 
 /**
   * Helper to restart all selected tracks from an ES category
@@ -1808,7 +1839,7 @@ vlc_player_RestartTrackCategory(vlc_player_t *player,
             vlc_player_GetTrackAt(player, cat, i);
         assert(track);
         if (track->selected)
-            vlc_player_RestartTrack(player, track->es_id);
+            vlc_player_RestartTrack(player, track);
     }
 }
 
diff --git a/lib/audio.c b/lib/audio.c
index f10c304561..52fa9d5c47 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -383,7 +383,7 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
         if (i_track == vlc_es_id_GetInputId(track->es_id))
         {
             /* found */
-            vlc_player_SelectTrack(player, track->es_id);
+            vlc_player_SelectTrack(player, track);
             i_ret = 0;
             goto end;
         }
diff --git a/lib/video.c b/lib/video.c
index 896cb78b23..2b6511d26c 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -325,7 +325,7 @@ int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu )
         if (i_spu == vlc_es_id_GetInputId(track->es_id))
         {
             /* found */
-            vlc_player_SelectTrack(player, track->es_id);
+            vlc_player_SelectTrack(player, track);
             i_ret = 0;
             goto end;
         }
@@ -496,7 +496,7 @@ int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
         if (i_track == vlc_es_id_GetInputId(track->es_id))
         {
             /* found */
-            vlc_player_SelectTrack(player, track->es_id);
+            vlc_player_SelectTrack(player, track);
             i_ret = 0;
             goto end;
         }
diff --git a/modules/control/rc.c b/modules/control/rc.c
index 660ecafee9..67b1193596 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -549,7 +549,7 @@ static void Input(intf_thread_t *intf, char const *psz_cmd,
                 vlc_player_GetTrackAt(player, cat, (size_t)idx);
             if (!track)
                 goto out;
-            vlc_player_SelectTrack(player, track->es_id);
+            vlc_player_SelectTrack(player, track);
         }
         else
         {
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m
index a3478417ae..f53cdc9027 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.m
+++ b/modules/gui/macosx/playlist/VLCPlayerController.m
@@ -1373,14 +1373,14 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
 - (void)selectTrack:(VLCTrackMetaData *)track
 {
     vlc_player_Lock(_p_player);
-    vlc_player_SelectTrack(_p_player, track.esID);
+    vlc_player_SelectEsId(_p_player, track.esID);
     vlc_player_Unlock(_p_player);
 }
 
 - (void)unselectTrack:(VLCTrackMetaData *)track
 {
     vlc_player_Lock(_p_player);
-    vlc_player_UnselectTrack(_p_player, track.esID);
+    vlc_player_UnselectEsId(_p_player, track.esID);
     vlc_player_Unlock(_p_player);
 }
 
diff --git a/modules/gui/qt/util/input_models.cpp b/modules/gui/qt/util/input_models.cpp
index 6b0a0b8bf1..b740bfafb6 100644
--- a/modules/gui/qt/util/input_models.cpp
+++ b/modules/gui/qt/util/input_models.cpp
@@ -62,9 +62,9 @@ bool TrackListModel::setData(const QModelIndex &index, const QVariant &value, in
     vlc_player_locker lock{ m_player };
 
     if (select)
-        vlc_player_SelectTrack(m_player, m_data[row].m_id.get());
+        vlc_player_SelectEsId(m_player, m_data[row].m_id.get());
     else
-        vlc_player_UnselectTrack(m_player, m_data[row].m_id.get());
+        vlc_player_UnselectEsId(m_player, m_data[row].m_id.get());
     return true;
 }
 
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index ac69f1f7b7..79e1f24eed 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -370,9 +370,9 @@ static int vlclua_player_toggle_track_(lua_State *L,
     const struct vlc_player_track *track = FindTrack(player, cat, id);
     if (track) {
         if (track->selected)
-            vlc_player_UnselectTrack(player, track->es_id);
+            vlc_player_UnselectTrack(player, track);
         else
-            vlc_player_SelectTrack(player, track->es_id);
+            vlc_player_SelectTrack(player, track);
     }
 
     vlc_player_Unlock(player);
diff --git a/src/input/player.c b/src/input/player.c
index bb84c85cb8..2405f4b084 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -1371,7 +1371,7 @@ vlc_player_vout_OSDTrack(vlc_player_t *player, vlc_es_id_t *id, bool select)
 }
 
 void
-vlc_player_SelectTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_SelectEsId(vlc_player_t *player, vlc_es_id_t *id)
 {
     struct vlc_player_input *input = vlc_player_get_input_locked(player);
     if (!input)
@@ -1427,9 +1427,9 @@ vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat,
     const struct vlc_player_track *track =
         vlc_player_GetTrackAt(player, cat, index);
     if (selected)
-        vlc_player_SelectTrack(player, track->es_id);
+        vlc_player_SelectTrack(player, track);
     else
-        vlc_player_UnselectTrack(player, track->es_id);
+        vlc_player_UnselectTrack(player, track);
 }
 
 void
@@ -1447,7 +1447,7 @@ vlc_player_SelectPrevTrack(vlc_player_t *player,
 }
 
 void
-vlc_player_UnselectTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_UnselectEsId(vlc_player_t *player, vlc_es_id_t *id)
 {
     struct vlc_player_input *input = vlc_player_get_input_locked(player);
     if (!input)
@@ -1458,7 +1458,7 @@ vlc_player_UnselectTrack(vlc_player_t *player, vlc_es_id_t *id)
 }
 
 void
-vlc_player_RestartTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_RestartEsId(vlc_player_t *player, vlc_es_id_t *id)
 {
     struct vlc_player_input *input = vlc_player_get_input_locked(player);
 
@@ -1557,9 +1557,9 @@ vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled)
     if (!input || !input->teletext_menu)
         return;
     if (enabled)
-        vlc_player_SelectTrack(player, input->teletext_menu->t.es_id);
+        vlc_player_SelectEsId(player, input->teletext_menu->t.es_id);
     else
-        vlc_player_UnselectTrack(player, input->teletext_menu->t.es_id);
+        vlc_player_UnselectEsId(player, input->teletext_menu->t.es_id);
 }
 
 void
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 0cfe87f88c..6c59e1b6fc 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -825,13 +825,14 @@ vlc_player_Pause
 vlc_player_program_Delete
 vlc_player_program_Dup
 vlc_player_RemoveListener
-vlc_player_RestartTrack
+vlc_player_RestartEsId
 vlc_player_Resume
 vlc_player_SeekByPos
 vlc_player_SeekByTime
 vlc_player_SelectCategoryLanguage
 vlc_player_SelectChapter
 vlc_player_SelectChapterIdx
+vlc_player_SelectEsId
 vlc_player_SelectNextChapter
 vlc_player_SelectNextTitle
 vlc_player_SelectNextTrack
@@ -844,7 +845,6 @@ vlc_player_SelectProgram
 vlc_player_SelectTeletextPage
 vlc_player_SelectTitle
 vlc_player_SelectTitleIdx
-vlc_player_SelectTrack
 vlc_player_SetAssociatedSubsFPS
 vlc_player_SetAtoBLoop
 vlc_player_SetCategoryDelay
@@ -866,7 +866,7 @@ vlc_player_title_list_Release
 vlc_player_track_Delete
 vlc_player_track_Dup
 vlc_player_Unlock
-vlc_player_UnselectTrack
+vlc_player_UnselectEsId
 vlc_player_UpdateViewpoint
 vlc_player_vout_AddListener
 vlc_player_vout_Hold
diff --git a/test/src/input/player.c b/test/src/input/player.c
index e467f60073..ad59935c1f 100644
--- a/test/src/input/player.c
+++ b/test/src/input/player.c
@@ -1133,11 +1133,11 @@ player_select_next_unselected_track(struct ctx *ctx,
     old_id = old_track ? vlc_es_id_Hold(old_track->es_id) : NULL;
 
     if (new_id)
-        vlc_player_SelectTrack(player, new_id);
+        vlc_player_SelectEsId(player, new_id);
     else
     {
         assert(old_id);
-        vlc_player_UnselectTrack(player, old_id);
+        vlc_player_UnselectEsId(player, old_id);
     }
 
     {



More information about the vlc-commits mailing list