[vlc-devel] [PATCH 03/11] input: add Angle Event

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


---
 src/input/event.h          | 9 +++++++++
 src/input/input.c          | 3 +++
 src/input/input_internal.h | 9 +++++++++
 3 files changed, 21 insertions(+)

diff --git a/src/input/event.h b/src/input/event.h
index dd9aec4a87..8b788063f6 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -123,6 +123,15 @@ static inline void input_SendEventSeekpoint(input_thread_t *p_input,
     });
 }
 
+static inline void input_SendEventAngle(input_thread_t *p_input,
+                                        unsigned i_angle)
+{
+    input_SendEvent(p_input, &(struct vlc_input_event) {
+        .type = INPUT_EVENT_ANGLE,
+        .angle = { i_angle }
+    });
+}
+
 static inline void input_SendEventSignal(input_thread_t *p_input,
                                          double f_quality, double f_strength)
 {
diff --git a/src/input/input.c b/src/input/input.c
index d6256fef47..8232a58bb9 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -562,6 +562,9 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
             *pb_changed = true;
         }
 
+        if( demux_TestAndClearFlags( p_demux, INPUT_UPDATE_ANGLE ) )
+            input_SendEventAngle( p_input, demux_GetAngle( p_demux ) );
+
         UpdateGenericFromDemux( p_input );
     }
 
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 1391571eea..54b4d49b58 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -99,6 +99,8 @@ typedef enum input_event_type_e
     INPUT_EVENT_TITLE,
     /* A chapter has been added or removed or selected. */
     INPUT_EVENT_CHAPTER,
+    /* Angle has been changed for the designated title. */
+    INPUT_EVENT_ANGLE,
 
     /* A program ("program") has been added or removed or selected,
      * or "program-scrambled" has changed.*/
@@ -200,6 +202,11 @@ struct vlc_input_event_chapter
     int seekpoint;
 };
 
+struct vlc_input_event_angle
+{
+    unsigned angle;
+};
+
 struct vlc_input_event_program {
     enum {
         VLC_INPUT_PROGRAM_ADDED,
@@ -277,6 +284,8 @@ struct vlc_input_event
         struct vlc_input_event_title title;
         /* INPUT_EVENT_CHAPTER */
         struct vlc_input_event_chapter chapter;
+        /* INPUT_EVENT_ANGLE */
+        struct vlc_input_event_angle angle;
         /* INPUT_EVENT_PROGRAM */
         struct vlc_input_event_program program;
         /* INPUT_EVENT_ES */
-- 
2.25.4



More information about the vlc-devel mailing list