[vlc-devel] [PATCH 2/2] es_out: really update fmt on ES_OUT_SET_ES_FMT
Rémi Denis-Courmont
remi at remlab.net
Tue Jun 16 20:06:53 CEST 2015
Le 2015-06-16 19:24, Francois Cartegnie a écrit :
> We want to update format and decoder without having to
> es_out_Add/es_out_Del which would alter id and selected state.
Looks OK. I fear this might expose some interesting side effects or
unimplemented corner cases though.
> ---
> src/input/es_out.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/src/input/es_out.c b/src/input/es_out.c
> index 3704e4c..1fc40d7 100644
> --- a/src/input/es_out.c
> +++ b/src/input/es_out.c
> @@ -2402,25 +2402,13 @@ static int EsOutControlLocked( es_out_t *out,
> int i_query, va_list args )
> if( es == NULL )
> return VLC_EGENERIC;
>
> - if( p_fmt->i_extra )
> - {
> - es->fmt.i_extra = p_fmt->i_extra;
> - es->fmt.p_extra = xrealloc( es->fmt.p_extra,
> p_fmt->i_extra );
> - memcpy( es->fmt.p_extra, p_fmt->p_extra, p_fmt->i_extra
> );
> + es_format_Clean( &es->fmt );
> + es_format_Copy( &es->fmt, p_fmt );
>
> - if( !es->p_dec )
> - return VLC_SUCCESS;
> -#if 1
> + if( es->p_dec )
> + {
> EsDestroyDecoder( out, es );
> -
> EsCreateDecoder( out, es );
> -#else
> - es->p_dec->fmt_in.i_extra = p_fmt->i_extra;
> - es->p_dec->fmt_in.p_extra =
> - xrealloc( es->p_dec->fmt_in.p_extra, p_fmt->i_extra );
> - memcpy( es->p_dec->fmt_in.p_extra,
> - p_fmt->p_extra, p_fmt->i_extra );
> -#endif
> }
>
> return VLC_SUCCESS;
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list