[vlc-devel] [PATCH 06/12] vlc_player: add angle_selection event

Francois Cartegnie fcvlcdev at free.fr
Thu Apr 2 20:40:14 CEST 2020


---
 include/vlc_player.h                          | 12 ++++++++++++
 .../gui/macosx/playlist/VLCPlayerController.m |  1 +
 modules/gui/qt/player/player_controller.cpp   |  1 +
 modules/gui/skins2/src/vlcproc.cpp            |  1 +
 test/src/player/player.c                      | 19 +++++++++++++++++++
 5 files changed, 34 insertions(+)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index 6643f2ebed..aabc265a40 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -2846,6 +2846,18 @@ struct vlc_player_cbs
         const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx,
         void *data);
 
+    /**
+     * Called when a new viewing angle is selected
+     *
+     * ??
+     *
+     * @param player locked player instance
+     * @param angle_idx new selected angle index
+     * @param data opaque pointer set by vlc_player_AddListener()
+     */
+    void (*on_angle_selection_changed)(vlc_player_t *player,
+                                       unsigned char angle_idx, void *data);
+
     /**
      * Called when the media has a teletext menu
      *
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m
index 1698f9b36f..e935c4de21 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.m
+++ b/modules/gui/macosx/playlist/VLCPlayerController.m
@@ -484,6 +484,7 @@ static const struct vlc_player_cbs player_callbacks = {
     cb_player_titles_changed,
     cb_player_title_selection_changed,
     cb_player_chapter_selection_changed,
+    nullptr,
     cb_player_teletext_menu_availability_changed,
     cb_player_teletext_enabled_changed,
     cb_player_teletext_page_changed,
diff --git a/modules/gui/qt/player/player_controller.cpp b/modules/gui/qt/player/player_controller.cpp
index 724232062b..b7443337e3 100644
--- a/modules/gui/qt/player/player_controller.cpp
+++ b/modules/gui/qt/player/player_controller.cpp
@@ -948,6 +948,7 @@ static const struct vlc_player_cbs player_cbs = {
     on_player_titles_changed,
     on_player_title_selection_changed,
     on_player_chapter_selection_changed,
+    nullptr,
     on_player_teletext_menu_changed,
     on_player_teletext_enabled_changed,
     on_player_teletext_page_changed,
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index ed8cbe846d..cfd2faad46 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -396,6 +396,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
     on_player_titles_changed,
     NULL, //on_player_title_selection_changed,
     NULL, //on_player_chapter_selection_changed,
+    NULL, //on_player_chapter_angle_changed,
     NULL, //on_player_teletext_menu_changed,
     NULL, //on_player_teletext_enabled_changed,
     NULL, //on_player_teletext_page_changed,
diff --git a/test/src/player/player.c b/test/src/player/player.c
index f465f96c0c..9af3a620d1 100644
--- a/test/src/player/player.c
+++ b/test/src/player/player.c
@@ -69,6 +69,12 @@ struct report_chapter_selection
     size_t chapter_idx;
 };
 
+
+struct report_angle_selection
+{
+    unsigned char angle;
+};
+
 struct report_category_delay
 {
     enum es_format_category_e cat;
@@ -111,6 +117,7 @@ struct report_media_subitems
     X(vlc_player_title_list *, on_titles_changed) \
     X(size_t, on_title_selection_changed) \
     X(struct report_chapter_selection, on_chapter_selection_changed) \
+    X(struct report_angle_selection, on_angle_selection_changed) \
     X(struct report_category_delay, on_category_delay_changed) \
     X(bool, on_recording_changed) \
     X(struct report_signal, on_signal_changed) \
@@ -425,6 +432,18 @@ player_on_chapter_selection_changed(vlc_player_t *player,
     (void) chapter;
 }
 
+static void
+player_on_angle_selection_changed(vlc_player_t *player,
+                                  unsigned char angle,
+                                  void *data)
+{
+    struct ctx *ctx = get_ctx(player, data);
+    struct report_angle_selection report = {
+        .angle = angle,
+    };
+    VEC_PUSH(on_angle_selection_changed, report);
+}
+
 static void
 player_on_category_delay_changed(vlc_player_t *player,
                                  enum es_format_category_e cat, vlc_tick_t new_delay,
-- 
2.25.1



More information about the vlc-devel mailing list