Commit 3ceb6fca authored by Frédéric Yhuel's avatar Frédéric Yhuel Committed by Jean-Baptiste Kempf

libmp4: 'tfhd' parsing

- Take into account 'duration-is-empty' flag
- Avoid a full level of indentation
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 01cdee1a
......@@ -569,10 +569,24 @@ static int MP4_ReadBox_tfhd( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GETVERSIONFLAGS( p_box->data.p_tfhd );
if( p_box->data.p_tfhd->i_version != 0 )
{
msg_Warn( p_stream, "'tfhd' box with version != 0. "\
" Don't know what to do with that, please patch" );
MP4_READBOX_EXIT( 0 );
}
MP4_GET4BYTES( p_box->data.p_tfhd->i_track_ID );
if( p_box->data.p_tfhd->i_version == 0 )
if( p_box->data.p_tfhd->i_flags & MP4_TFHD_DURATION_IS_EMPTY )
{
msg_Dbg( p_stream, "'duration-is-empty' flag is present "\
"=> no samples for this time interval." );
p_box->data.p_tfhd->b_empty = true;
}
else
p_box->data.p_tfhd->b_empty = false;
if( p_box->data.p_tfhd->i_flags & MP4_TFHD_BASE_DATA_OFFSET )
MP4_GET8BYTES( p_box->data.p_tfhd->i_base_data_offset );
if( p_box->data.p_tfhd->i_flags & MP4_TFHD_SAMPLE_DESC_INDEX )
......@@ -607,7 +621,6 @@ static int MP4_ReadBox_tfhd( stream_t *p_stream, MP4_Box_t *p_box )
p_box->data.p_tfhd->i_track_ID,
psz_base, psz_desc, psz_dura, psz_size, psz_flag );
#endif
}
MP4_READBOX_EXIT( 1 );
}
......
......@@ -870,9 +870,11 @@ typedef struct MP4_Box_data_sidx_s
#define MP4_TFHD_DFLT_SAMPLE_DURATION (1LL<<3)
#define MP4_TFHD_DFLT_SAMPLE_SIZE (1LL<<4)
#define MP4_TFHD_DFLT_SAMPLE_FLAGS (1LL<<5)
#define MP4_TFHD_DURATION_IS_EMPTY (1LL<<16)
typedef struct MP4_Box_data_tfhd_s
{
uint8_t i_version;
bool b_empty;
uint32_t i_flags;
uint32_t i_track_ID;
......
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