[vlc-commits] vlm: use own vlm event

Thomas Guillem git at videolan.org
Mon Jun 3 16:16:40 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri May 31 15:14:48 2019 +0200| [bbd379ff47696b0939693f816ece192e93612e88] | committer: Thomas Guillem

vlm: use own vlm event

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

 include/vlc_vlm.h     | 12 +++++++++++-
 src/input/vlm.c       | 15 ++++++++-------
 src/input/vlm_event.c |  6 +++---
 src/input/vlm_event.h |  2 +-
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/include/vlc_vlm.h b/include/vlc_vlm.h
index 1257b71a44..10895bfdc7 100644
--- a/include/vlc_vlm.h
+++ b/include/vlc_vlm.h
@@ -104,13 +104,23 @@ enum vlm_event_type_e
     VLM_EVENT_MEDIA_INSTANCE_STATE,
 };
 
+typedef enum vlm_state_e
+{
+    VLM_INIT_S = 0,
+    VLM_OPENING_S,
+    VLM_PLAYING_S,
+    VLM_PAUSE_S,
+    VLM_END_S,
+    VLM_ERROR_S,
+} vlm_state_e;
+
 typedef struct
 {
     int            i_type;            /* a vlm_event_type_e value */
     int64_t        id;                /* Media ID */
     const char    *psz_name;          /* Media name */
     const char    *psz_instance_name; /* Instance name or NULL */
-    input_state_e  input_state;       /* Input instance event type */
+    vlm_state_e    input_state;       /* Input instance event type */
 } vlm_event_t;
 
 /** VLM control query */
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 80d39f77e4..2cef3024ce 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -49,6 +49,7 @@
 #include <vlc_url.h>
 #include "../stream_output/stream_output.h"
 #include "../libvlc.h"
+#include "input_internal.h"
 
 /*****************************************************************************
  * Local prototypes.
@@ -101,28 +102,28 @@ static void player_on_state_changed(vlc_player_t *player,
         }
     }
     assert(psz_instance_name);
-    enum input_state_e legacy_state;
+    enum vlm_state_e vlm_state;
     switch (new_state)
     {
         case VLC_PLAYER_STATE_STOPPED:
-            legacy_state = vlc_player_GetError(player) ? ERROR_S : INIT_S;
+            vlm_state = vlc_player_GetError(player) ? VLM_ERROR_S : VLM_INIT_S;
             break;
         case VLC_PLAYER_STATE_STARTED:
-            legacy_state = OPENING_S;
+            vlm_state = VLM_OPENING_S;
             break;
         case VLC_PLAYER_STATE_PLAYING:
-            legacy_state = PLAYING_S;
+            vlm_state = VLM_PLAYING_S;
             break;
         case VLC_PLAYER_STATE_PAUSED:
-            legacy_state = PAUSE_S;
+            vlm_state = VLM_PAUSE_S;
             break;
         case VLC_PLAYER_STATE_STOPPING:
-            legacy_state = vlc_player_GetError(player) ? ERROR_S : END_S;
+            vlm_state = vlc_player_GetError(player) ? VLM_ERROR_S : VLM_END_S;
             break;
         default:
             vlc_assert_unreachable();
     }
-    vlm_SendEventMediaInstanceState( p_vlm, p_media->cfg.id, p_media->cfg.psz_name, psz_instance_name, legacy_state );
+    vlm_SendEventMediaInstanceState( p_vlm, p_media->cfg.id, p_media->cfg.psz_name, psz_instance_name, vlm_state );
 
     vlc_mutex_lock( &p_vlm->lock_manage );
     p_vlm->input_state_changed = true;
diff --git a/src/input/vlm_event.c b/src/input/vlm_event.c
index 63ea329279..086f968004 100644
--- a/src/input/vlm_event.c
+++ b/src/input/vlm_event.c
@@ -35,7 +35,7 @@
 
 /* */
 static void Trigger( vlm_t *, int i_type, int64_t id, const char *psz_name );
-static void TriggerInstanceState( vlm_t *, int i_type, int64_t id, const char *psz_name, const char *psz_instance_name, input_state_e input_state );
+static void TriggerInstanceState( vlm_t *, int i_type, int64_t id, const char *psz_name, const char *psz_instance_name, vlm_state_e input_state );
 
 /*****************************************************************************
  *
@@ -62,7 +62,7 @@ void vlm_SendEventMediaInstanceStopped( vlm_t *p_vlm, int64_t id, const char *ps
     Trigger( p_vlm, VLM_EVENT_MEDIA_INSTANCE_STOPPED, id, psz_name );
 }
 
-void vlm_SendEventMediaInstanceState( vlm_t *p_vlm, int64_t id, const char *psz_name, const char *psz_instance_name, input_state_e state )
+void vlm_SendEventMediaInstanceState( vlm_t *p_vlm, int64_t id, const char *psz_name, const char *psz_instance_name, vlm_state_e state )
 {
     TriggerInstanceState( p_vlm, VLM_EVENT_MEDIA_INSTANCE_STATE, id, psz_name, psz_instance_name, state );
 }
@@ -82,7 +82,7 @@ static void Trigger( vlm_t *p_vlm, int i_type, int64_t id, const char *psz_name
     var_SetAddress( p_vlm, "intf-event", &event );
 }
 
-static void TriggerInstanceState( vlm_t *p_vlm, int i_type, int64_t id, const char *psz_name, const char *psz_instance_name, input_state_e input_state )
+static void TriggerInstanceState( vlm_t *p_vlm, int i_type, int64_t id, const char *psz_name, const char *psz_instance_name, vlm_state_e input_state )
 {
     vlm_event_t event;
 
diff --git a/src/input/vlm_event.h b/src/input/vlm_event.h
index e4727fc2ba..e9e8d3d284 100644
--- a/src/input/vlm_event.h
+++ b/src/input/vlm_event.h
@@ -34,6 +34,6 @@ void vlm_SendEventMediaChanged( vlm_t *, int64_t id, const char *psz_name );
 
 void vlm_SendEventMediaInstanceStarted( vlm_t *, int64_t id, const char *psz_name );
 void vlm_SendEventMediaInstanceStopped( vlm_t *, int64_t id, const char *psz_name );
-void vlm_SendEventMediaInstanceState( vlm_t *, int64_t id, const char *psz_name, const char *psz_instance_name, input_state_e state );
+void vlm_SendEventMediaInstanceState( vlm_t *, int64_t id, const char *psz_name, const char *psz_instance_name, vlm_state_e state );
 
 #endif



More information about the vlc-commits mailing list