[vlc-devel] [PATCH 2/4] stream_output: add sout_InputFlush()

Steve Lhomme robux4 at gmail.com
Tue Dec 22 13:02:59 CET 2015


On Tue, Dec 22, 2015 at 1:00 PM, Thomas Guillem <thomas at gllm.fr> wrote:
>
> On Fri, Dec 18, 2015, at 12:51, Steve Lhomme wrote:
>> when seeking during stream output we need to be able to flush internal
>> buffers
>> ---
>>  include/vlc_sout.h                |  9 +++++++++
>>  src/input/decoder.c               |  6 ++++++
>>  src/stream_output/stream_output.c | 10 ++++++++++
>>  src/stream_output/stream_output.h |  1 +
>>  4 files changed, 26 insertions(+)
>>
>> diff --git a/include/vlc_sout.h b/include/vlc_sout.h
>> index 8147131..1d013b3 100644
>> --- a/include/vlc_sout.h
>> +++ b/include/vlc_sout.h
>> @@ -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 );
>> +    int               (*pf_flush)( sout_stream_t *, sout_stream_id_sys_t
>> * );
>
> Any particular reason to return an int here ? Every others flush return
> void now.
> And the decoder won't check the return error of flush calls.

No reason, I will change it to void.

>>
>>      sout_stream_sys_t *p_sys;
>>      bool pace_nocontrol;
>> @@ -237,6 +238,14 @@ static inline int sout_StreamIdSend( sout_stream_t
>> *s,
>>      return s->pf_send( s, id, b );
>>  }
>>
>> +static inline int sout_StreamFlush( sout_stream_t *s,
>> +                                     sout_stream_id_sys_t *id )
>
> space--

ok

>> +{
>> +    if (s->pf_flush)
>> +        return s->pf_flush( s, id );
>> +    return VLC_SUCCESS;
>> +}
>> +
>>  static inline int sout_StreamControl( sout_stream_t *s, int i_query, ...
>>  )
>>  {
>>      va_list args;
>> diff --git a/src/input/decoder.c b/src/input/decoder.c
>> index af1df41..ba3bc36 100644
>> --- a/src/input/decoder.c
>> +++ b/src/input/decoder.c
>> @@ -1373,6 +1373,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 )
>> diff --git a/src/stream_output/stream_output.c
>> b/src/stream_output/stream_output.c
>> index 20448a1..336ace1 100644
>> --- a/src/stream_output/stream_output.c
>> +++ b/src/stream_output/stream_output.c
>> @@ -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;
>> diff --git a/src/stream_output/stream_output.h
>> b/src/stream_output/stream_output.h
>> index 1429584..f1e0fd7 100644
>> --- a/src/stream_output/stream_output.h
>> +++ b/src/stream_output/stream_output.h
>> @@ -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
>> --
>> 2.6.3
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list