diff options
author | wm4 <wm4@nowhere> | 2015-02-04 15:17:49 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-02-04 15:17:49 +0100 |
commit | 5bce4664beaddbcc256d333816ad6cdddf16a83d (patch) | |
tree | 0f9940143a203df44174d08fc72b737e19371979 /stream | |
parent | b715fb6df19b7d359073e93654d736f66085be91 (diff) | |
download | mpv-5bce4664beaddbcc256d333816ad6cdddf16a83d.tar.bz2 mpv-5bce4664beaddbcc256d333816ad6cdddf16a83d.tar.xz |
stream_cdda: fix bugs in chapter time retrieval
Looks like a bunch of off-by-one errors.
The track number was mistakenly offset by 1 - this shifted all chapters
by one, and make the first chapter start on the second track (so the
"chapter" property returned -1 in the first track since it was before
the first chapter).
Also, the calculation of the sector destination was messed up. This
comes from commit 32d818f0, where I apparently attempted to calculate
the position to one byte before the section, but unfortunately math
doesn't work this way and it was nonsense. Just drop this idea; while it
may help with seeking (probably...), it also returns slightly different
times. The user shall use hr-seeks if accurate seeking is required.
Hopefully fixes #1560.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_cdda.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index 52eeb3e3e5..a75ee3ae40 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -257,11 +257,11 @@ static int control(stream_t *stream, int cmd, void *arg) int track = *(double *)arg; int start_track = get_track_by_sector(p, p->start_sector); int end_track = get_track_by_sector(p, p->end_sector); - track += start_track + 1; + track += start_track; if (track > end_track) return STREAM_ERROR; int64_t sector = p->cd->disc_toc[track].dwStartSector; - int64_t pos = sector * (CDIO_CD_FRAMESIZE_RAW + 1) - 1; + int64_t pos = sector * CDIO_CD_FRAMESIZE_RAW; // Assume standard audio CD: 44.1khz, 2 channels, s16 samples *(double *)arg = pos / (44100.0 * 2 * 2); return STREAM_OK; |