[vlc-devel] [PATCH 09/12] vlc_player: add vlc_player_[GetSelected, Select]Angle
Francois Cartegnie
fcvlcdev at free.fr
Thu Apr 2 20:40:17 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 aabc265a40..e97dc3b8c9 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 char
+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 char angle);
+
/** @} vlc_player__titles */
/**
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index cc8098edd9..2aa518f2eb 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..137b02f234 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 char
+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 char 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 %"PRIu8), angle);
+}
+
void
vlc_player_Lock(vlc_player_t *player)
{
--
2.25.1
More information about the vlc-devel
mailing list