Commit 340272f8 authored by Laurent Aimar's avatar Laurent Aimar

Modify input_ressource_RequestVout to allow avoiding recycling.

parent 00b6b762
...@@ -2030,7 +2030,7 @@ static void DeleteDecoder( decoder_t * p_dec ) ...@@ -2030,7 +2030,7 @@ static void DeleteDecoder( decoder_t * p_dec )
vout_ChangePause( p_owner->p_vout, false, mdate() ); 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 ); input_SendEventVout( p_owner->p_input );
} }
...@@ -2110,11 +2110,7 @@ static vout_thread_t *aout_request_vout( void *p_private, ...@@ -2110,11 +2110,7 @@ static vout_thread_t *aout_request_vout( void *p_private,
decoder_t *p_dec = p_private; decoder_t *p_dec = p_private;
input_thread_t *p_input = p_dec->p_owner->p_input; 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 ); p_vout = input_ressource_RequestVout( p_input->p->p_ressource, p_vout, p_fmt, b_recyle );
/* 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 );
input_SendEventVout( p_input ); input_SendEventVout( p_input );
return p_vout; return p_vout;
...@@ -2293,7 +2289,7 @@ static picture_t *vout_new_buffer( decoder_t *p_dec ) ...@@ -2293,7 +2289,7 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
vlc_mutex_unlock( &p_owner->lock ); vlc_mutex_unlock( &p_owner->lock );
p_vout = input_ressource_RequestVout( p_owner->p_input->p->p_ressource, 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 ); vlc_mutex_lock( &p_owner->lock );
p_owner->p_vout = p_vout; p_owner->p_vout = p_vout;
......
...@@ -177,7 +177,8 @@ static void DisplayVoutTitle( input_ressource_t *p_ressource, ...@@ -177,7 +177,8 @@ static void DisplayVoutTitle( input_ressource_t *p_ressource,
free( psz_nowplaying ); free( psz_nowplaying );
} }
static vout_thread_t *RequestVout( input_ressource_t *p_ressource, 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 ) if( !p_vout && !p_fmt )
{ {
...@@ -232,8 +233,9 @@ static vout_thread_t *RequestVout( input_ressource_t *p_ressource, ...@@ -232,8 +233,9 @@ static vout_thread_t *RequestVout( input_ressource_t *p_ressource,
const int i_vout_active = p_ressource->i_vout; const int i_vout_active = p_ressource->i_vout;
vlc_mutex_unlock( &p_ressource->lock_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 )
{ {
if( b_recycle )
msg_Dbg( p_ressource->p_input, "detroying vout (already one saved or active)" ); msg_Dbg( p_ressource->p_input, "detroying vout (already one saved or active)" );
vout_CloseAndRelease( p_vout ); vout_CloseAndRelease( p_vout );
} }
...@@ -388,10 +390,10 @@ void input_ressource_SetInput( input_ressource_t *p_ressource, input_thread_t *p ...@@ -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 *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 ); 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 ); vlc_mutex_unlock( &p_ressource->lock );
return p_ret; return p_ret;
...@@ -406,7 +408,7 @@ void input_ressource_HoldVouts( input_ressource_t *p_ressource, vout_thread_t ** ...@@ -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 ) 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 ) bool input_ressource_HasVout( input_ressource_t *p_ressource )
{ {
......
...@@ -60,7 +60,7 @@ aout_instance_t *input_ressource_HoldAout( input_ressource_t *p_ressource ); ...@@ -60,7 +60,7 @@ aout_instance_t *input_ressource_HoldAout( input_ressource_t *p_ressource );
/** /**
* This function handles vout request. * 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. * This function return one of the current vout if any.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment