Commit 279d76fb authored by François Cartegnie's avatar François Cartegnie 🤞

demux: mp4: fix ctts sign storage

parent 202780b1
......@@ -1020,7 +1020,7 @@ static int MP4_ReadBox_trun( stream_t *p_stream, MP4_Box_t *p_box )
if( p_box->data.p_trun->i_flags & MP4_TRUN_SAMPLE_FLAGS )
MP4_GET4BYTES( p_sample->i_flags );
if( p_box->data.p_trun->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET )
MP4_GET4BYTES( p_sample->i_composition_time_offset );
MP4_GET4BYTES( p_sample->i_composition_time_offset.v0 );
}
#ifdef MP4_ULTRA_VERBOSE
......
......@@ -1157,7 +1157,11 @@ typedef struct MP4_descriptor_trun_sample_t
uint32_t i_duration;
uint32_t i_size;
uint32_t i_flags;
uint32_t i_composition_time_offset; /* version == 0 ? signed : unsigned */
union
{
uint32_t v0;
int32_t v1; /* version == 1 ? signed : unsigned */
} i_composition_time_offset;
} MP4_descriptor_trun_sample_t;
typedef struct MP4_Box_data_trun_s
......
......@@ -4210,11 +4210,11 @@ static int LeafParseTRUN( demux_t *p_demux, mp4_track_t *p_track,
if( p_trun->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET )
{
if ( p_trun->i_version == 1 )
i_pts += (int32_t) p_trun->p_samples[i].i_composition_time_offset;
else if( p_trun->p_samples[i].i_composition_time_offset < 0xFF000000 )
i_pts += p_trun->p_samples[i].i_composition_time_offset;
i_pts += p_trun->p_samples[i].i_composition_time_offset.v1;
else if( p_trun->p_samples[i].i_composition_time_offset.v0 < 0xFF000000 )
i_pts += p_trun->p_samples[i].i_composition_time_offset.v0;
else /* version 0 with negative */
i_pts += (int32_t) p_trun->p_samples[i].i_composition_time_offset;
i_pts += p_trun->p_samples[i].i_composition_time_offset.v1;
}
if( p_trun->i_flags & MP4_TRUN_SAMPLE_SIZE )
......
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