[vlc-devel] [PATCH 1/6] input: signal when an es fmt is updated

Thomas Guillem thomas at gllm.fr
Wed Aug 29 14:24:26 CEST 2018


Will be used by the future input manager users. It will allow to browse all es
tracks with an up to date fmt.
---
 include/vlc_input.h |  1 +
 src/input/es_out.c  |  4 +++-
 src/input/event.c   | 10 ++++++++++
 src/input/event.h   |  1 +
 src/input/var.c     |  2 ++
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index cfa2cef215..88acc266c0 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -428,6 +428,7 @@ struct vlc_input_event_es {
     enum {
         VLC_INPUT_ES_ADDED,
         VLC_INPUT_ES_DELETED,
+        VLC_INPUT_ES_UPDATED,
         VLC_INPUT_ES_SELECTED,
         VLC_INPUT_ES_UNSELECTED,
     } action;
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 3a8134d6f5..f62e87e415 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3134,7 +3134,6 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
     if( es->fmt.i_cat == fmt->i_cat )
     {
         es_format_t update = *fmt;
-        update.i_id = es->i_meta_id;
         update.i_codec = es->fmt.i_codec;
         update.i_original_fourcc = es->fmt.i_original_fourcc;
 
@@ -3160,6 +3159,9 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
         update.i_extra = 0;
         update.p_extra = NULL;
 
+        input_SendEventEsUpdate(p_input, &update);
+
+        update.i_id = es->i_meta_id;
         input_item_UpdateTracksInfo(input_GetItem(p_input), &update);
     }
 
diff --git a/src/input/event.c b/src/input/event.c
index b6c88529d2..ba9f39b629 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -234,6 +234,16 @@ void input_SendEventEsAdd( input_thread_t *p_input, const es_format_t *p_fmt,
         }
     });
 }
+void input_SendEventEsUpdate( input_thread_t *p_input, const es_format_t *p_fmt )
+{
+    input_SendEvent( p_input, &(struct vlc_input_event) {
+        .type = INPUT_EVENT_ES,
+        .es = {
+            .action = VLC_INPUT_ES_UPDATED,
+            .fmt = p_fmt,
+        }
+    });
+}
 void input_SendEventEsDel( input_thread_t *p_input,
                            const es_format_t *p_fmt )
 {
diff --git a/src/input/event.h b/src/input/event.h
index faead56a5a..5057458565 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -63,6 +63,7 @@ void input_SendEventProgramScrambled( input_thread_t *p_input, int i_group, bool
 void input_SendEventEsDel( input_thread_t *p_input, const es_format_t *fmt );
 void input_SendEventEsAdd( input_thread_t *p_input,
                            const es_format_t *fmt, const char *psz_title );
+void input_SendEventEsUpdate( input_thread_t *p_input, const es_format_t *fmt );
 void input_SendEventEsSelect( input_thread_t *p_input, const es_format_t *fmt );
 void input_SendEventEsUnselect( input_thread_t *p_input, const es_format_t *fmt );
 
diff --git a/src/input/var.c b/src/input/var.c
index ca0901b69c..99a03f0f42 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -376,6 +376,8 @@ void input_LegacyEvents( input_thread_t *p_input, void *user_data,
                         VarListSelect( p_input, "teletext-es", i_id );
                     break;
                 }
+                case VLC_INPUT_ES_UPDATED:
+                    break;
             }
             break;
         case INPUT_EVENT_RECORD:
-- 
2.18.0



More information about the vlc-devel mailing list