diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-07 22:43:26 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-07 22:43:26 +0000 |
| commit | 0b46e2db06ec1bbfc3aee819787386ace9dad66c (patch) | |
| tree | 109f4bbf3a7227262a280f00731f0767d331a811 /src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp | |
| parent | 5896c5ae40726637cbfc5605f5f659791ff569c7 (diff) | |
| download | qmmp-0b46e2db06ec1bbfc3aee819787386ace9dad66c.tar.gz qmmp-0b46e2db06ec1bbfc3aee819787386ace9dad66c.tar.bz2 qmmp-0b46e2db06ec1bbfc3aee819787386ace9dad66c.zip | |
improved seeking accuracy
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@827 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp')
| -rw-r--r-- | src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp index 919830cfc..12e6d16ab 100644 --- a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp +++ b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp @@ -44,7 +44,7 @@ DecoderFFmpeg::DecoderFFmpeg(QObject *parent, DecoderFactory *d, Output *o, cons freq = 0; bitrate = 0; seekTime = -1.0; - totalTime = 0.0; + m_totalTime = 0.0; chan = 0; output_size = 0; ic = 0; @@ -122,7 +122,7 @@ bool DecoderFFmpeg::initialize() chan = 0; output_size = 0; seekTime = -1.0; - totalTime = 0.0; + m_totalTime = 0.0; if (!output_buf) output_buf = new char[globalBufferSize]; @@ -153,7 +153,7 @@ bool DecoderFFmpeg::initialize() if (avcodec_open(c, codec) < 0) return FALSE; - totalTime = ic->duration/AV_TIME_BASE; + m_totalTime = ic->duration * 1000 / AV_TIME_BASE; configure(c->sample_rate, c->channels, 16); @@ -166,12 +166,12 @@ bool DecoderFFmpeg::initialize() } -qint64 DecoderFFmpeg::lengthInSeconds() +qint64 DecoderFFmpeg::totalTime() { if (! inited) return 0; - return totalTime; + return m_totalTime; } @@ -212,7 +212,7 @@ void DecoderFFmpeg::run() if (seekTime >= 0.0) { int64_t timestamp; - timestamp = int64_t(seekTime)*AV_TIME_BASE; + timestamp = int64_t(seekTime)*AV_TIME_BASE/1000; if (ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD); |
