[vlc-devel] [PATCH 05/11] demux: wav: parse ds64 in a new function
Thomas Guillem
thomas at gllm.fr
Thu Mar 12 17:45:20 CET 2020
On Thu, Mar 12, 2020, at 17:36, Remi Denis-Courmont wrote:
> Le 2020-03-12 16:05, Thomas Guillem a écrit :
> > ---
> > modules/demux/wav.c | 41 +++++++++++++++++++++++++++--------------
> > 1 file changed, 27 insertions(+), 14 deletions(-)
> >
> > diff --git a/modules/demux/wav.c b/modules/demux/wav.c
> > index 45d475c1f00..c8829648730 100644
> > --- a/modules/demux/wav.c
> > +++ b/modules/demux/wav.c
> > @@ -248,6 +248,32 @@ static void Close ( vlc_object_t * p_this )
> > free( p_sys );
> > }
> >
> > +static int ChunkParseDS64( demux_t *p_demux, uint32_t i_size )
> > +{
> > + demux_sys_t *p_sys = p_demux->p_sys;
> > + const uint8_t *p_peek;
> > +
> > + if( i_size < 24 )
> > + {
> > + msg_Err( p_demux, "invalid 'ds64' chunk" );
> > + return VLC_EGENERIC;
> > + }
> > +
> > + if( vlc_stream_Peek( p_demux->s, &p_peek, 24 ) < 24 )
> > + return VLC_EGENERIC;
> > +
> > + uint64_t i_data_size = GetQWLE( &p_peek[8] );
> > + if( i_data_size >> 62 )
> > + p_sys->i_data_size = (int64_t)1 << 62;
>
> INT64_C(1)
>
> > + else
> > + p_sys->i_data_size = i_data_size;
> > +
> > + if( ChunkSkip( p_demux, i_size ) != VLC_SUCCESS )
> > + return VLC_EGENERIC;
> > +
> > + return VLC_SUCCESS;
> > +}
>
> return ChunkSkip()...
Indeed.
>
> > +
> > static int ChunkParseFmt( demux_t *p_demux, uint32_t i_size )
> > {
> > demux_sys_t *p_sys = p_demux->p_sys;
> > @@ -508,7 +534,6 @@ static int Open( vlc_object_t * p_this )
> > const uint8_t *p_peek;
> > bool b_is_rf64;
> > unsigned int i_size;
> > - uint64_t i_data_size;
> >
> > /* Is it a wav file ? */
> > if( vlc_stream_Peek( p_demux->s, &p_peek, 12 ) < 12 )
> > @@ -545,19 +570,7 @@ static int Open( vlc_object_t * p_this )
> > msg_Err( p_demux, "cannot find 'ds64' chunk" );
> > goto error;
> > }
> > - if( i_size < 24 )
> > - {
> > - msg_Err( p_demux, "invalid 'ds64' chunk" );
> > - goto error;
> > - }
> > - if( vlc_stream_Peek( p_demux->s, &p_peek, 24 ) < 24 )
> > - goto error;
> > - i_data_size = GetQWLE( &p_peek[8] );
> > - if( i_data_size >> 62 )
> > - p_sys->i_data_size = (int64_t)1 << 62;
> > - else
> > - p_sys->i_data_size = i_data_size;
> > - if( ChunkSkip( p_demux, i_size ) != VLC_SUCCESS )
> > + if( ChunkParseDS64( p_demux, i_size ) != VLC_SUCCESS )
> > goto error;
> > }
>
> --
> Rémi Denis-Courmont
>
More information about the vlc-devel
mailing list