[vlc-devel] commit: Modify input_ressource_RequestVout to allow avoiding recycling. ( Laurent Aimar )

git version control git at videolan.org
Thu Feb 5 23:34:45 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Feb  5 23:31:29 2009 +0100| [340272f8d4a2372ad56d6971e5964095e22f6e5d] | committer: Laurent Aimar 

Modify input_ressource_RequestVout to allow avoiding recycling.

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

 src/input/decoder.c   |   10 +++-------
 src/input/ressource.c |   14 ++++++++------
 src/input/ressource.h |    2 +-
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index bcae5fe..3f7ff47 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -2030,7 +2030,7 @@ static void DeleteDecoder( decoder_t * p_dec )
             vout_ChangePause( p_owner->p_vout, false, mdate() );
 
         /* */
-        input_ressource_RequestVout( p_owner->p_input->p->p_ressource, p_owner->p_vout, NULL );
+        input_ressource_RequestVout( p_owner->p_input->p->p_ressource, p_owner->p_vout, NULL, true );
         input_SendEventVout( p_owner->p_input );
     }
 
@@ -2110,11 +2110,7 @@ static vout_thread_t *aout_request_vout( void *p_private,
     decoder_t *p_dec = p_private;
     input_thread_t *p_input = p_dec->p_owner->p_input;
 
-    p_vout = input_ressource_RequestVout( p_input->p->p_ressource, p_vout, p_fmt );
-    /* TODO it would be better to give b_recyle to input_ressource_RequestVout
-     * as here we are not sure of which vout we destroy */
-    if( !b_recyle )
-        input_ressource_TerminateVout( p_input->p->p_ressource );
+    p_vout = input_ressource_RequestVout( p_input->p->p_ressource, p_vout, p_fmt, b_recyle );
     input_SendEventVout( p_input );
 
     return p_vout;
@@ -2293,7 +2289,7 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
         vlc_mutex_unlock( &p_owner->lock );
 
         p_vout = input_ressource_RequestVout( p_owner->p_input->p->p_ressource,
-                                              p_vout, &p_dec->fmt_out.video );
+                                              p_vout, &p_dec->fmt_out.video, true );
 
         vlc_mutex_lock( &p_owner->lock );
         p_owner->p_vout = p_vout;
diff --git a/src/input/ressource.c b/src/input/ressource.c
index 0fd1e3b..11003d9 100644
--- a/src/input/ressource.c
+++ b/src/input/ressource.c
@@ -177,7 +177,8 @@ static void DisplayVoutTitle( input_ressource_t *p_ressource,
     free( psz_nowplaying );
 }
 static vout_thread_t *RequestVout( input_ressource_t *p_ressource,
-                                   vout_thread_t *p_vout, video_format_t *p_fmt )
+                                   vout_thread_t *p_vout, video_format_t *p_fmt,
+                                   bool b_recycle )
 {
     if( !p_vout && !p_fmt )
     {
@@ -232,9 +233,10 @@ static vout_thread_t *RequestVout( input_ressource_t *p_ressource,
         const int i_vout_active = p_ressource->i_vout;
         vlc_mutex_unlock( &p_ressource->lock_vout );
 
-        if( p_ressource->p_vout_free || i_vout_active > 0 )
+        if( p_ressource->p_vout_free || i_vout_active > 0 || !b_recycle )
         {
-            msg_Dbg( p_ressource->p_input, "detroying vout (already one saved or active)" );
+            if( b_recycle )
+                msg_Dbg( p_ressource->p_input, "detroying vout (already one saved or active)" );
             vout_CloseAndRelease( p_vout );
         }
         else
@@ -388,10 +390,10 @@ void input_ressource_SetInput( input_ressource_t *p_ressource, input_thread_t *p
 }
 
 vout_thread_t *input_ressource_RequestVout( input_ressource_t *p_ressource,
-                                            vout_thread_t *p_vout, video_format_t *p_fmt )
+                                            vout_thread_t *p_vout, video_format_t *p_fmt, bool b_recycle )
 {
     vlc_mutex_lock( &p_ressource->lock );
-    vout_thread_t *p_ret = RequestVout( p_ressource, p_vout, p_fmt );
+    vout_thread_t *p_ret = RequestVout( p_ressource, p_vout, p_fmt, b_recycle );
     vlc_mutex_unlock( &p_ressource->lock );
 
     return p_ret;
@@ -406,7 +408,7 @@ void input_ressource_HoldVouts( input_ressource_t *p_ressource, vout_thread_t **
 }
 void input_ressource_TerminateVout( input_ressource_t *p_ressource )
 {
-    input_ressource_RequestVout( p_ressource, NULL, NULL );
+    input_ressource_RequestVout( p_ressource, NULL, NULL, false );
 }
 bool input_ressource_HasVout( input_ressource_t *p_ressource )
 {
diff --git a/src/input/ressource.h b/src/input/ressource.h
index 4409a88..f0e0aef 100644
--- a/src/input/ressource.h
+++ b/src/input/ressource.h
@@ -60,7 +60,7 @@ aout_instance_t *input_ressource_HoldAout( input_ressource_t *p_ressource );
 /**
  * This function handles vout request.
  */
-vout_thread_t *input_ressource_RequestVout( input_ressource_t *, vout_thread_t *, video_format_t * );
+vout_thread_t *input_ressource_RequestVout( input_ressource_t *, vout_thread_t *, video_format_t *, bool b_recycle );
 
 /**
  * This function return one of the current vout if any.




More information about the vlc-devel mailing list