[vlc-commits] demux: mp4: work with edit lists with CLOCK_FREQ
Francois Cartegnie
git at videolan.org
Fri Jan 5 17:13:30 CET 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan 4 17:41:46 2018 +0100| [35d7ea5e1920ba3b38ac723c83a9be284f3caf10] | committer: Francois Cartegnie
demux: mp4: work with edit lists with CLOCK_FREQ
as the track -> movie timescale conversion isn't guaranteed
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=35d7ea5e1920ba3b38ac723c83a9be284f3caf10
---
modules/demux/mp4/libmp4.h | 4 ++--
modules/demux/mp4/mp4.c | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index e0bc63071f..af1cc4a93d 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -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;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 4b03a1c6dd..5be7031a1f 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -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,
More information about the vlc-commits
mailing list