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

Thomas Guillem thomas at gllm.fr
Thu Aug 16 16:01:25 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 |  4 ++++
 src/input/es_out.c  |  4 +++-
 src/input/event.c   | 12 ++++++++++++
 src/input/event.h   |  1 +
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 4a12cbf1ea..020589a297 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -440,6 +440,7 @@ struct vlc_input_event
         struct {
             enum {
                 VLC_INPUT_ES_ADDED,
+                VLC_INPUT_ES_UPDATED,
                 VLC_INPUT_ES_DELETED,
                 VLC_INPUT_ES_SELECTED,
             } action;
@@ -449,6 +450,9 @@ struct vlc_input_event
                     const char *title;
                     const es_format_t *fmt;
                 } added;
+                struct {
+                    const es_format_t *fmt;
+                } updated;
                 struct {
                     enum es_format_category_e cat;
                     int id;
diff --git a/src/input/es_out.c b/src/input/es_out.c
index bd0625239a..929f0a6907 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3150,7 +3150,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;
 
@@ -3176,6 +3175,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 38ea5e2f65..e1fed167c8 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -236,6 +236,18 @@ void input_SendEventEsAdd( input_thread_t *p_input, const char *psz_title,
         }
     });
 }
+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,
+            .updated = {
+                .fmt = p_fmt,
+            }
+        }
+    });
+}
 void input_SendEventEsDel( input_thread_t *p_input,
                            enum es_format_category_e i_cat, int i_id )
 {
diff --git a/src/input/event.h b/src/input/event.h
index 5ede17fd73..0252b7f90e 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -62,6 +62,7 @@ void input_SendEventEsDel( input_thread_t *p_input, enum es_format_category_e i_
 void input_SendEventEsAdd( input_thread_t *p_input, const char *psz_title,
                            const es_format_t *fmt );
 void input_SendEventEsSelect( input_thread_t *p_input, enum es_format_category_e i_cat, int i_id ); /* i_id == -1 will unselect */
+void input_SendEventEsUpdate( input_thread_t *p_input, const es_format_t *fmt );
 
 void input_SendEventTeletextAdd( input_thread_t *p_input,
                                  int i_teletext, const char *psz_text );
-- 
2.18.0



More information about the vlc-devel mailing list