[vlc-devel] [PATCH 04/12] input/event: add input_SendDecoderState

Thomas Guillem thomas at gllm.fr
Thu Jun 9 11:51:56 CEST 2016


---
 include/vlc_input.h |  4 ++++
 src/input/event.c   | 29 +++++++++++++++++++++++++++++
 src/input/event.h   |  1 +
 src/input/var.c     |  6 ++++++
 4 files changed, 40 insertions(+)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 16a6a49..5f859df 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -398,6 +398,10 @@ typedef enum input_event_type_e
     /* A vout_thread_t object has been created/deleted by *the input* */
     INPUT_EVENT_VOUT,
 
+    INPUT_EVENT_VIDEO_DECODER_STATE,
+    INPUT_EVENT_AUDIO_DECODER_STATE,
+    INPUT_EVENT_SPU_DECODER_STATE,
+
 } input_event_type_e;
 
 /**
diff --git a/src/input/event.c b/src/input/event.c
index 456c4d7..4459a0f 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -315,6 +315,35 @@ void input_SendEventAout( input_thread_t *p_input )
     Trigger( p_input, INPUT_EVENT_AOUT );
 }
 
+void input_SendDecoderState( input_thread_t *p_input, int i_cat, int i_state )
+{
+    int i_type;
+    const char *psz_variable;
+
+    switch( i_cat )
+    {
+    case VIDEO_ES:
+        i_type = INPUT_EVENT_VIDEO_DECODER_STATE;
+        psz_variable = "video-dec-state";
+        break;
+    case AUDIO_ES:
+        i_type = INPUT_EVENT_AUDIO_DECODER_STATE;
+        psz_variable = "audio-dec-state";
+        break;
+    case SPU_ES:
+        i_type = INPUT_EVENT_SPU_DECODER_STATE;
+        psz_variable = "spu-dec-state";
+        break;
+    default:
+        return;
+    }
+
+    vlc_value_t val;
+    val.i_int = i_state;
+    var_Change( p_input, psz_variable, VLC_VAR_SETVALUE, &val, NULL );
+    Trigger( p_input, i_type );
+}
+
 /*****************************************************************************
  * Event for control.c/input.c
  *****************************************************************************/
diff --git a/src/input/event.h b/src/input/event.h
index e91ad11..77c4c4b 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -72,6 +72,7 @@ void input_SendEventTeletextSelect( input_thread_t *p_input, int i_teletext );
  *****************************************************************************/
 void input_SendEventVout( input_thread_t *p_input );
 void input_SendEventAout( input_thread_t *p_input );
+void input_SendDecoderState( input_thread_t *p_input, int i_cat, int i_state );
 
 /*****************************************************************************
  * Event for control.c/input.c
diff --git a/src/input/var.c b/src/input/var.c
index 6534603..3da81b0 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -192,16 +192,22 @@ void input_ControlVarInit ( input_thread_t *p_input )
     var_Create( p_input, "video-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
     text.psz_string = _("Video Track");
     var_Change( p_input, "video-es", VLC_VAR_SETTEXT, &text, NULL );
+    var_Create( p_input, "video-dec-state", VLC_VAR_INTEGER );
+    var_SetInteger( p_input, "video-dec-state", 0 );
 
     /* Audio ES */
     var_Create( p_input, "audio-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
     text.psz_string = _("Audio Track");
     var_Change( p_input, "audio-es", VLC_VAR_SETTEXT, &text, NULL );
+    var_Create( p_input, "audio-dec-state", VLC_VAR_INTEGER );
+    var_SetInteger( p_input, "audio-dec-state", 0 );
 
     /* Spu ES */
     var_Create( p_input, "spu-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
     text.psz_string = _("Subtitle Track");
     var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
+    var_Create( p_input, "spu-dec-state", VLC_VAR_INTEGER );
+    var_SetInteger( p_input, "spu-dec-state", 0 );
 
     var_Create( p_input, "spu-choice", VLC_VAR_INTEGER );
     var_SetInteger( p_input, "spu-choice", -1 );
-- 
2.8.1



More information about the vlc-devel mailing list