summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_lavf.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-24 00:29:01 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-26 20:39:04 +0200
commit304cafd31dfaeee853e138a460b7ba82e65ed420 (patch)
tree8c5945cccb2dfc34424f56f941120e4375108354 /libmpdemux/demux_lavf.c
parenta248c2c7a137517061e6271f22b84d43bcd7191d (diff)
downloadmpv-304cafd31dfaeee853e138a460b7ba82e65ed420.tar.bz2
mpv-304cafd31dfaeee853e138a460b7ba82e65ed420.tar.xz
demux_mkv, chapters: change millisecond arithmetic to ns
demux_mkv kept various integer timestamps in millisecond units. Matroska timestamp arithmetic is however specified in nanoseconds (even though files typically use 1 ms precision), and using ms units instead of that only made things more complex. Based on the demux_mkv example the general demuxer-level chapter structure also used ms units. Change the demux_mkv arithmetic and demuxer chapter structures to use nanoseconds instead. This also fixes a seeking problem in demux_mkv with files using a TimecodeScale other than the usual 1000000 (confusion between ms and TimecodeScale*ns units).
Diffstat (limited to 'libmpdemux/demux_lavf.c')
-rw-r--r--libmpdemux/demux_lavf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 03ffa17c43..c84a17e4e3 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -588,8 +588,8 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
for(i=0; i < avfc->nb_chapters; i++) {
AVChapter *c = avfc->chapters[i];
- uint64_t start = av_rescale_q(c->start, c->time_base, (AVRational){1,1000});
- uint64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,1000});
+ uint64_t start = av_rescale_q(c->start, c->time_base, (AVRational){1,1000000000});
+ uint64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,1000000000});
t = av_metadata_get(c->metadata, "title", NULL, 0);
demuxer_add_chapter(demuxer, t ? BSTR(t->value) : BSTR(NULL), start, end);
}