Commit 10398c4f authored by Martin Storsjö's avatar Martin Storsjö

demux: mp4: Fix the post_mdat_offset for mdats with a 64 bit length

Apple/iOS writes fragmented files with such mdat lengths while writing
of the file isn't yet completed.
parent c3873141
...@@ -4938,7 +4938,17 @@ static int DemuxFrag( demux_t *p_demux ) ...@@ -4938,7 +4938,17 @@ static int DemuxFrag( demux_t *p_demux )
p_sys->context.i_current_box_type = VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ); p_sys->context.i_current_box_type = VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] );
if( p_sys->context.i_current_box_type == ATOM_mdat ) if( p_sys->context.i_current_box_type == ATOM_mdat )
{ {
p_sys->context.i_post_mdat_offset = vlc_stream_Tell( p_demux->s ) + GetDWBE( p_peek ); uint64_t size = GetDWBE( p_peek );
if ( size == 1 )
{
if( vlc_stream_Peek( p_demux->s, &p_peek, 16 ) != 16 )
{
i_status = VLC_DEMUXER_EOF;
goto end;
}
size = GetQWBE( p_peek + 8 );
}
p_sys->context.i_post_mdat_offset = vlc_stream_Tell( p_demux->s ) + size;
} }
else else
{ {
......
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