[vlc-commits] input: move vout events to decoder.c

Thomas Guillem git at videolan.org
Fri Mar 29 17:48:24 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 29 17:42:08 2019 +0100| [22e447be75239069ef0ac509fa8667e68f1f70f4] | committer: Thomas Guillem

input: move vout events to decoder.c

This fixes a Deleted event that could be sent when a vout creation failed.

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

 src/input/decoder.c  | 11 +++++++++++
 src/input/resource.c | 13 -------------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 4b2d5cbd9f..82e3fe781f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -540,6 +540,12 @@ static int vout_update_format( decoder_t *p_dec )
                 .dpb_size = dpb_size + p_dec->i_extra_picture_buffers + 1,
                 .mouse_event = MouseEvent, .mouse_opaque = p_dec
             } );
+        if (p_vout)
+            input_SendEventVout(p_owner->p_input,
+                &(struct vlc_input_event_vout) {
+                    .action = VLC_INPUT_EVENT_VOUT_ADDED,
+                    .vout = p_vout,
+                });
 
         vlc_mutex_lock( &p_owner->lock );
         p_owner->p_vout = p_vout;
@@ -1943,6 +1949,11 @@ static void DeleteDecoder( decoder_t * p_dec )
                  * thread */
                 vout_Cancel( p_owner->p_vout, false );
 
+                input_SendEventVout(p_owner->p_input,
+                    &(struct vlc_input_event_vout) {
+                        .action = VLC_INPUT_EVENT_VOUT_DELETED,
+                        .vout = p_owner->p_vout,
+                    });
                 input_resource_PutVout( p_owner->p_resource, p_owner->p_vout );
             }
             break;
diff --git a/src/input/resource.c b/src/input/resource.c
index 6929621df1..8a0b02ddbb 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -417,12 +417,6 @@ vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
     TAB_APPEND(p_resource->i_vout, p_resource->pp_vout, vout);
     vlc_mutex_unlock(&p_resource->lock_hold);
 
-    if (p_resource->p_input != NULL)
-        input_SendEventVout(p_resource->p_input,
-            &(struct vlc_input_event_vout) {
-                .action = VLC_INPUT_EVENT_VOUT_ADDED,
-                .vout = vout,
-            });
 out:
     vlc_mutex_unlock( &p_resource->lock );
     return vout;
@@ -440,13 +434,6 @@ void input_resource_PutVout(input_resource_t *p_resource,
     const int active_vouts = p_resource->i_vout;
     vlc_mutex_unlock(&p_resource->lock_hold);
 
-    if (p_resource->p_input != NULL)
-        input_SendEventVout(p_resource->p_input,
-            &(struct vlc_input_event_vout) {
-                .action = VLC_INPUT_EVENT_VOUT_DELETED,
-                .vout = vout,
-            });
-
     if (p_resource->p_vout_free != NULL || active_vouts > 0) {
         msg_Dbg(p_resource->p_parent, "destroying vout (already one saved or active)");
         vout_Close(vout);



More information about the vlc-commits mailing list