From fb3b208b48976721954b232a8a100633e8f9c55b Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 27 Dec 2015 18:05:14 +0000 Subject: opus: using float output git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@5919 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/opus/decoder_opus.cpp | 9 ++++----- src/plugins/Input/opus/decoder_opus.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Input/opus/decoder_opus.cpp b/src/plugins/Input/opus/decoder_opus.cpp index d55b75be9..0441e944c 100644 --- a/src/plugins/Input/opus/decoder_opus.cpp +++ b/src/plugins/Input/opus/decoder_opus.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2013-2014 by Ilya Kotov * + * Copyright (C) 2013-2015 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -137,7 +137,7 @@ bool DecoderOpus::initialize() qWarning("DecoderOpus: unsupported number of channels: %d", m_chan); return false; } - configure(48000, chmap, Qmmp::PCM_S16LE); //opus codec supports 48 kHz only + configure(48000, chmap, Qmmp::PCM_FLOAT); //opus codec supports 48 kHz only return true; } @@ -160,10 +160,9 @@ void DecoderOpus::seek(qint64 time) qint64 DecoderOpus::read(unsigned char *data, qint64 maxSize) { - int samples = maxSize / 2 / m_chan; - samples = op_read(m_opusfile, (opus_int16 *)data, samples, 0); + int frames = op_read_float(m_opusfile, (float*) data, maxSize / sizeof(float), 0); m_bitrate = op_bitrate_instant(m_opusfile) / 1000; - return samples * m_chan * 2; + return frames * m_chan * sizeof(float); } //https://tools.ietf.org/id/draft-ietf-codec-oggopus-04.txt diff --git a/src/plugins/Input/opus/decoder_opus.h b/src/plugins/Input/opus/decoder_opus.h index e1d8a3287..f2395f347 100644 --- a/src/plugins/Input/opus/decoder_opus.h +++ b/src/plugins/Input/opus/decoder_opus.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2013-2014 by Ilya Kotov * + * Copyright (C) 2013-2015 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * -- cgit v1.2.3-13-gbd6f