[vlc-commits] resource: add input_resource_ResetAout()

Rémi Denis-Courmont git at videolan.org
Mon Mar 10 18:19:13 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 10 19:18:18 2014 +0200| [b1ff0c7e294f99a8b480fc0ad717ef3a6d47e478] | committer: Rémi Denis-Courmont

resource: add input_resource_ResetAout()

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

 include/vlc_input.h  |    5 +++++
 src/input/resource.c |   10 ++++++----
 src/libvlccore.sym   |    1 +
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 176bf51..c1cb17d 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -663,4 +663,9 @@ VLC_API audio_output_t *input_resource_GetAout( input_resource_t * );
  */
 VLC_API void input_resource_PutAout( input_resource_t *, audio_output_t * );
 
+/**
+ * Prevents the existing audio output (if any) from being recycled.
+ */
+VLC_API void input_resource_ResetAout( input_resource_t * );
+
 #endif
diff --git a/src/input/resource.c b/src/input/resource.c
index aee2f68..779c921 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -392,12 +392,14 @@ audio_output_t *input_resource_HoldAout( input_resource_t *p_resource )
     return p_aout;
 }
 
-static void input_resource_TerminateAout( input_resource_t *p_resource )
+void input_resource_ResetAout( input_resource_t *p_resource )
 {
-    audio_output_t *p_aout;
+    audio_output_t *p_aout = NULL;
 
     vlc_mutex_lock( &p_resource->lock_hold );
-    p_aout = p_resource->p_aout;
+    if( !p_resource->b_aout_busy )
+        p_aout = p_resource->p_aout;
+
     p_resource->p_aout = NULL;
     p_resource->b_aout_busy = false;
     vlc_mutex_unlock( &p_resource->lock_hold );
@@ -507,7 +509,7 @@ void input_resource_TerminateSout( input_resource_t *p_resource )
 void input_resource_Terminate( input_resource_t *p_resource )
 {
     input_resource_TerminateSout( p_resource );
-    input_resource_TerminateAout( p_resource );
+    input_resource_ResetAout( p_resource );
     input_resource_TerminateVout( p_resource );
 }
 
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index e2c2008..af5e7bf 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -220,6 +220,7 @@ input_resource_Terminate
 input_resource_GetAout
 input_resource_HoldAout
 input_resource_PutAout
+input_resource_ResetAout
 input_Start
 input_Stop
 input_vaControl



More information about the vlc-commits mailing list