Commit ecacf6f0 authored by Steve Lhomme's avatar Steve Lhomme Committed by Thomas Guillem

stream_output: add sout_InputFlush()

when seeking during stream output we need to be able to flush internal buffers
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent d3db4b7f
......@@ -210,6 +210,7 @@ struct sout_stream_t
/* manage a packet */
int (*pf_send)( sout_stream_t *, sout_stream_id_sys_t *, block_t* );
int (*pf_control)( sout_stream_t *, int, va_list );
void (*pf_flush)( sout_stream_t *, sout_stream_id_sys_t * );
sout_stream_sys_t *p_sys;
bool pace_nocontrol;
......@@ -237,6 +238,13 @@ static inline int sout_StreamIdSend( sout_stream_t *s,
return s->pf_send( s, id, b );
}
static inline void sout_StreamFlush( sout_stream_t *s,
sout_stream_id_sys_t *id )
{
if (s->pf_flush)
s->pf_flush( s, id );
}
static inline int sout_StreamControl( sout_stream_t *s, int i_query, ... )
{
va_list args;
......
......@@ -1389,6 +1389,12 @@ static void DecoderProcessFlush( decoder_t *p_dec )
if ( p_dec->pf_flush != NULL )
p_dec->pf_flush( p_dec );
#ifdef ENABLE_SOUT
if ( p_owner->p_sout_input != NULL )
{
sout_InputFlush( p_owner->p_sout_input );
}
#endif
if( p_dec->fmt_out.i_cat == AUDIO_ES )
{
if( p_owner->p_aout )
......
......@@ -223,6 +223,15 @@ bool sout_InputIsEmpty( sout_packetizer_input_t *p_input )
return b;
}
void sout_InputFlush( sout_packetizer_input_t *p_input )
{
sout_instance_t *p_sout = p_input->p_sout;
vlc_mutex_lock( &p_sout->lock );
sout_StreamFlush( p_sout->p_stream, p_input->id );
vlc_mutex_unlock( &p_sout->lock );
}
/*****************************************************************************
*
*****************************************************************************/
......@@ -789,6 +798,7 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
p_stream->psz_name = psz_name;
p_stream->p_cfg = p_cfg;
p_stream->p_next = p_next;
p_stream->pf_flush = NULL;
p_stream->pf_control = NULL;
p_stream->pace_nocontrol = false;
p_stream->p_sys = NULL;
......
......@@ -50,5 +50,6 @@ sout_packetizer_input_t *sout_InputNew( sout_instance_t *, es_format_t * );
int sout_InputDelete( sout_packetizer_input_t * );
int sout_InputSendBuffer( sout_packetizer_input_t *, block_t* );
bool sout_InputIsEmpty(sout_packetizer_input_t *);
void sout_InputFlush( sout_packetizer_input_t * );
#endif
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