[vlc-devel] [PATCH 09/11] vlc_player: add vlc_player_[GetSelected, Select]Angle

Francois Cartegnie fcvlcdev at free.fr
Tue May 5 17:57:07 CEST 2020


---
 include/vlc_player.h | 17 +++++++++++++++++
 src/libvlccore.sym   |  2 ++
 src/player/player.c  | 22 ++++++++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index cbd74b86a1..ef4e2fb871 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -1162,6 +1162,23 @@ vlc_player_SelectNextChapter(vlc_player_t *player);
 VLC_API void
 vlc_player_SelectPrevChapter(vlc_player_t *player);
 
+/**
+ * Get the viewing angle of the current media
+ *
+ * @param player locked player instance
+ */
+VLC_API unsigned
+vlc_player_GetSelectedAngle(vlc_player_t *player);
+
+/**
+ * Select the viewing angle for the current media
+ *
+ * @param player locked player instance
+ * @param angle valid angle for the current title
+ */
+VLC_API void
+vlc_player_SelectAngle(vlc_player_t *player, unsigned angle);
+
 /** @} vlc_player__titles */
 
 /**
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 504801246b..2a733758cf 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -800,6 +800,7 @@ vlc_player_GetProgramAt
 vlc_player_GetProgramCount
 vlc_player_GetRate
 vlc_player_GetRenderer
+vlc_player_GetSelectedAngle
 vlc_player_GetSelectedChapterIdx
 vlc_player_GetSelectedTitleIdx
 vlc_player_GetSignal
@@ -835,6 +836,7 @@ vlc_player_RestorePlaybackPos
 vlc_player_Resume
 vlc_player_SeekByPos
 vlc_player_SeekByTime
+vlc_player_SelectAngle
 vlc_player_SelectCategoryLanguage
 vlc_player_SelectChapter
 vlc_player_SelectChapterIdx
diff --git a/src/player/player.c b/src/player/player.c
index a1a39a28f5..6ae7ef5119 100644
--- a/src/player/player.c
+++ b/src/player/player.c
@@ -839,6 +839,16 @@ vlc_player_GetSelectedTitleIdx(vlc_player_t *player)
     return input->title_selected;
 }
 
+unsigned
+vlc_player_GetSelectedAngle(vlc_player_t *player)
+{
+    struct vlc_player_input *input = vlc_player_get_input_locked(player);
+
+    if (!input)
+        return 0;
+    return input->angle_selected;
+}
+
 static ssize_t
 vlc_player_GetTitleIdx(vlc_player_t *player,
                        const struct vlc_player_title *title)
@@ -949,6 +959,18 @@ vlc_player_SelectPrevChapter(vlc_player_t *player)
         vlc_player_osd_Message(player, _("Previous chapter"));
 }
 
+void
+vlc_player_SelectAngle(vlc_player_t *player, unsigned angle)
+{
+    struct vlc_player_input *input = vlc_player_get_input_locked(player);
+    if (!input)
+        return;
+    int ret = input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_ANGLE,
+                                      &(vlc_value_t){ .i_int = angle });
+    if (ret == VLC_SUCCESS)
+        vlc_player_osd_Message(player, _("Viewing angle %u"), angle);
+}
+
 void
 vlc_player_Lock(vlc_player_t *player)
 {
-- 
2.25.4



More information about the vlc-devel mailing list