diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/Input/vorbis/decoder_vorbis.cpp | 29 | ||||
| -rw-r--r-- | src/plugins/Input/vorbis/decoder_vorbis.h | 1 | ||||
| -rw-r--r-- | src/plugins/Input/vorbis/decodervorbisfactory.cpp | 4 |
3 files changed, 32 insertions, 2 deletions
diff --git a/src/plugins/Input/vorbis/decoder_vorbis.cpp b/src/plugins/Input/vorbis/decoder_vorbis.cpp index dc91ea384..73e19dd92 100644 --- a/src/plugins/Input/vorbis/decoder_vorbis.cpp +++ b/src/plugins/Input/vorbis/decoder_vorbis.cpp @@ -235,3 +235,32 @@ qint64 DecoderVorbis::read(char *data, qint64 maxSize) m_bitrate = ov_bitrate_instant(&oggfile) / 1000; return len; } + +qint64 DecoderVorbis::read(float *data, qint64 samples) +{ + len = -1; + float **pcm = 0; + while (len < 0) + len = ov_read_float(&oggfile, &pcm, samples, &m_section); + + if(len == 0) + return 0; + + int channels = audioParameters().channels(); + + for(int i = 0; i < channels; ++i) + { + float *ptr = &data[i]; + for(int j = 0; j < len; ++j) + { + *ptr = pcm[i][j]; + ptr += channels; + } + } + + if (m_section != m_last_section) + updateTags(); + + m_bitrate = ov_bitrate_instant(&oggfile) / 1000; + return len*channels; +} diff --git a/src/plugins/Input/vorbis/decoder_vorbis.h b/src/plugins/Input/vorbis/decoder_vorbis.h index c968379d5..e29e5e728 100644 --- a/src/plugins/Input/vorbis/decoder_vorbis.h +++ b/src/plugins/Input/vorbis/decoder_vorbis.h @@ -25,6 +25,7 @@ public: private: virtual qint64 read(char *data, qint64 maxSize); + virtual qint64 read(float *data, qint64 samples); virtual void seek(qint64 time); // helper functions diff --git a/src/plugins/Input/vorbis/decodervorbisfactory.cpp b/src/plugins/Input/vorbis/decodervorbisfactory.cpp index e069c7761..17d5af27e 100644 --- a/src/plugins/Input/vorbis/decodervorbisfactory.cpp +++ b/src/plugins/Input/vorbis/decodervorbisfactory.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2012 by Ilya Kotov * + * Copyright (C) 2008-2013 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -64,7 +64,7 @@ Decoder *DecoderVorbisFactory::create(const QString &url, QIODevice *input) if(!url.contains("://")) //local file { ReplayGainReader rg(url); - d->setReplayGainInfo(rg.replayGainInfo()); + d->setReplayGainInfo(rg.replayGainInfo(), true); } return d; } |
