Commit 35d7ea5e authored by François Cartegnie's avatar François Cartegnie 🤞

demux: mp4: work with edit lists with CLOCK_FREQ

as the track -> movie timescale conversion isn't guaranteed
parent 83fa27fc
......@@ -941,8 +941,8 @@ typedef struct MP4_Box_data_elst_s
uint32_t i_entry_count;
uint64_t *i_segment_duration;
int64_t *i_media_time;
uint64_t *i_segment_duration; /* movie timescale */
int64_t *i_media_time; /* media(track) timescale */
uint16_t *i_media_rate_integer;
uint16_t *i_media_rate_fraction;
......
......@@ -319,6 +319,8 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track )
}
}
i_dts = MP4_rescale( i_dts, p_track->i_timescale, CLOCK_FREQ );
/* now handle elst */
if( p_track->p_elst && p_track->BOXDATA(p_elst)->i_entry_count )
{
......@@ -329,16 +331,16 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track )
elst->i_media_rate_fraction[p_track->i_elst] > 0 ) &&
elst->i_media_time[p_track->i_elst] > 0 )
{
i_dts -= elst->i_media_time[p_track->i_elst];
i_dts -= MP4_rescale( elst->i_media_time[p_track->i_elst], p_track->i_timescale, CLOCK_FREQ );
}
/* add i_elst_time */
i_dts += MP4_rescale( p_track->i_elst_time, p_sys->i_timescale, p_track->i_timescale );
i_dts += MP4_rescale( p_track->i_elst_time, p_sys->i_timescale, CLOCK_FREQ );
if( i_dts < 0 ) i_dts = 0;
}
return MP4_rescale( i_dts, p_track->i_timescale, CLOCK_FREQ );
return i_dts;
}
static inline bool MP4_TrackGetPTSDelta( demux_t *p_demux, mp4_track_t *p_track,
......
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