Commit 27e7fb5d authored by Francois Cartegnie's avatar Francois Cartegnie

demux: libmp4: rewrite nextbox/container reading

parent 6bff31b4
......@@ -58,7 +58,7 @@ bool AtomsReader::parseBlock(block_t *p_block, BaseRepresentation *rep)
memset(rootbox, 0, sizeof(*rootbox));
rootbox->i_type = ATOM_root;
rootbox->i_size = p_block->i_buffer;
if ( MP4_ReadBoxContainerChildren( stream, rootbox, 0 ) == 1 )
if ( MP4_ReadBoxContainerChildren( stream, rootbox, NULL ) == 1 )
{
#ifndef NDEBUG
MP4_BoxDumpStructure(stream, rootbox);
......
This diff is collapsed.
......@@ -1709,7 +1709,7 @@ unsigned MP4_BoxCount( const MP4_Box_t *p_box, const char *psz_fmt, ... );
/* Internal functions exposed for MKV demux */
int MP4_PeekBoxHeader( stream_t *p_stream, MP4_Box_t *p_box );
int MP4_ReadBoxContainerChildren( stream_t *p_stream, MP4_Box_t *p_container,
uint32_t i_last_child );
const uint32_t stoplist[] );
int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box );
void MP4_FreeBox_sample_vide( MP4_Box_t *p_box );
......
......@@ -4443,7 +4443,8 @@ static int ProbeIndex( demux_t *p_demux )
stream_Seek( p_demux->s, i_stream_size - i_offset ) == VLC_SUCCESS )
{
msg_Dbg( p_demux, "reading mfra index at %"PRIu64, i_stream_size - i_offset );
MP4_ReadBoxContainerChildren( p_demux->s, p_sys->p_root, ATOM_mfra );
const uint32_t stoplist[] = { ATOM_mfra, 0 };
MP4_ReadBoxContainerChildren( p_demux->s, p_sys->p_root, stoplist );
}
}
......@@ -4462,14 +4463,15 @@ static int ProbeFragments( demux_t *p_demux, bool b_force )
if ( p_sys->b_fastseekable || b_force )
{
MP4_ReadBoxContainerChildren( p_demux->s, p_sys->p_root, 0 ); /* Get the rest of the file */
MP4_ReadBoxContainerChildren( p_demux->s, p_sys->p_root, NULL ); /* Get the rest of the file */
p_sys->b_fragments_probed = true;
}
else
{
/* We stop at first moof, which validates our fragmentation condition
* and we'll find others while reading. */
MP4_ReadBoxContainerChildren( p_demux->s, p_sys->p_root, ATOM_moof );
const uint32_t stoplist[] = { ATOM_moof, 0 };
MP4_ReadBoxContainerChildren( p_demux->s, p_sys->p_root, stoplist );
}
if ( !p_sys->moovfragment.p_moox )
......
......@@ -268,7 +268,7 @@ static int parse_chunk( stream_t *s, chunk_t *ck, sms_stream_t *sms )
MP4_Box_t root_box = { 0 };
root_box.i_type = ATOM_root;
root_box.i_size = ck->size;
if ( MP4_ReadBoxContainerChildren( ck_s, &root_box, 0 ) != 1 )
if ( MP4_ReadBoxContainerChildren( ck_s, &root_box, NULL ) != 1 )
{
stream_Delete( ck_s );
return VLC_EGENERIC;
......
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