[vlc-commits] input: add input_resource_PutSout()

Rémi Denis-Courmont git at videolan.org
Thu Jan 21 19:56:03 UTC 2021


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jan 19 19:56:51 2021 +0200| [603b9ced95eb1aa78132663a36be923064a8d3ff] | committer: Rémi Denis-Courmont

input: add input_resource_PutSout()

This mimicks input_resource_PutVout(), except in the case that the
second parameter is NULL:
- PutVout() asserts that that is not the case.
- PutSout() destroys the resource sout.
It is unclear if this is really intended. If not, this should be
addressed later on (this patch makes no functional changes).

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

 src/input/input.c    | 12 ++++++------
 src/input/resource.c |  7 +++++++
 src/input/resource.h |  1 +
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 08d5300d7d..4ac78a14c6 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1356,8 +1356,8 @@ error:
     if( input_priv(p_input)->p_resource )
     {
         if( input_priv(p_input)->p_sout )
-            input_resource_RequestSout( input_priv(p_input)->p_resource,
-                                         input_priv(p_input)->p_sout, NULL );
+            input_resource_PutSout( input_priv(p_input)->p_resource,
+                                    input_priv(p_input)->p_sout );
         input_resource_SetInput( input_priv(p_input)->p_resource, NULL );
         if( input_priv(p_input)->p_resource )
         {
@@ -1424,8 +1424,8 @@ static void End( input_thread_t * p_input )
     vlc_mutex_unlock( &input_priv(p_input)->p_item->lock );
 
     /* */
-    input_resource_RequestSout( input_priv(p_input)->p_resource,
-                                 input_priv(p_input)->p_sout, NULL );
+    input_resource_PutSout( input_priv(p_input)->p_resource,
+                            input_priv(p_input)->p_sout );
     input_resource_SetInput( input_priv(p_input)->p_resource, NULL );
     if( input_priv(p_input)->p_resource )
     {
@@ -1797,8 +1797,8 @@ static void ControlUpdateRenderer( input_thread_t *p_input, bool b_enable )
     }
     else
     {
-        input_resource_RequestSout( input_priv(p_input)->p_resource,
-                                    input_priv(p_input)->p_sout, NULL );
+        input_resource_PutSout( input_priv(p_input)->p_resource,
+                                input_priv(p_input)->p_sout );
         input_priv(p_input)->p_sout = NULL;
     }
 }
diff --git a/src/input/resource.c b/src/input/resource.c
index 044fb8b7e5..8c16802452 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -630,6 +630,13 @@ sout_instance_t *input_resource_RequestSout( input_resource_t *p_resource, sout_
     return p_ret;
 }
 
+void input_resource_PutSout(input_resource_t *resource, sout_instance_t *sout)
+{
+    vlc_mutex_lock(&resource->lock);
+    RequestSout(resource, sout, NULL);
+    vlc_mutex_unlock(&resource->lock);
+}
+
 void input_resource_TerminateSout( input_resource_t *p_resource )
 {
     vlc_mutex_lock( &p_resource->lock );
diff --git a/src/input/resource.h b/src/input/resource.h
index f6f3b4be60..66fdf997f8 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -36,6 +36,7 @@ void input_resource_SetInput( input_resource_t *, input_thread_t * );
  * This function handles sout request.
  */
 sout_instance_t *input_resource_RequestSout( input_resource_t *, sout_instance_t *, const char *psz_sout );
+void input_resource_PutSout(input_resource_t *, sout_instance_t *);
 
 vout_thread_t *input_resource_RequestVout(input_resource_t *, vlc_video_context *,
                                          const vout_configuration_t *,



More information about the vlc-commits mailing list