diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-10-16 10:59:24 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-10-16 10:59:24 +0000 |
| commit | 691eff1ae20c8561674b379c0f8c13026622d11e (patch) | |
| tree | ae4dd87505a8b127a796cfee5cbfae15afdbadc6 /src/plugins/Input/vorbis/decoder_vorbis.cpp | |
| parent | 3618ec3e3dd3f728d6d4f8c5d4db6c527301560d (diff) | |
| download | qmmp-691eff1ae20c8561674b379c0f8c13026622d11e.tar.gz qmmp-691eff1ae20c8561674b379c0f8c13026622d11e.tar.bz2 qmmp-691eff1ae20c8561674b379c0f8c13026622d11e.zip | |
vorbis: added peak overflow support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3798 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/vorbis/decoder_vorbis.cpp')
| -rw-r--r-- | src/plugins/Input/vorbis/decoder_vorbis.cpp | 29 |
1 files changed, 29 insertions, 0 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; +} |
