summaryrefslogtreecommitdiff
path: root/src/lib/sndfile_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-01-03 23:18:47 +0000
committerCarl Hetherington <cth@carlh.net>2014-01-03 23:18:47 +0000
commitd7b23d44dec9d6357619e8e009e564e475215470 (patch)
tree0ac5251fbbe5c55da24499eb5c7b4194f90365bf /src/lib/sndfile_decoder.cc
parentf0e95aa5b7ada81a1c40f06facab2e94e45ab26c (diff)
Various attempted fixes to audio sync.
Diffstat (limited to 'src/lib/sndfile_decoder.cc')
-rw-r--r--src/lib/sndfile_decoder.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc
index 1c651e614..d6537843e 100644
--- a/src/lib/sndfile_decoder.cc
+++ b/src/lib/sndfile_decoder.cc
@@ -45,6 +45,7 @@ SndfileDecoder::SndfileDecoder (shared_ptr<const Film> f, shared_ptr<const Sndfi
throw DecodeError (_("could not open audio file for reading"));
}
+ _done = 0;
_remaining = _info.frames;
}
@@ -93,7 +94,8 @@ SndfileDecoder::pass ()
}
data->set_frames (this_time);
- audio (data);
+ audio (data, _done * TIME_HZ / audio_frame_rate ());
+ _done += this_time;
_remaining -= this_time;
return _remaining == 0;
@@ -123,5 +125,6 @@ SndfileDecoder::seek (ContentTime t, bool accurate)
Decoder::seek (t, accurate);
AudioDecoder::seek (t, accurate);
+ _done = t * audio_frame_rate() / TIME_HZ;
_remaining = _info.frames - _done;
}