diff options
Diffstat (limited to 'src/plugins/Input/mpc')
| -rw-r--r-- | src/plugins/Input/mpc/decoder_mpc.cpp | 22 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/decoder_mpc.h | 13 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/mpcmetadatamodel.cpp | 8 |
3 files changed, 17 insertions, 26 deletions
diff --git a/src/plugins/Input/mpc/decoder_mpc.cpp b/src/plugins/Input/mpc/decoder_mpc.cpp index 22d721d27..63827c4a4 100644 --- a/src/plugins/Input/mpc/decoder_mpc.cpp +++ b/src/plugins/Input/mpc/decoder_mpc.cpp @@ -18,7 +18,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ - #include <QObject> #include <QIODevice> #include <qmmp/buffer.h> @@ -30,44 +29,38 @@ static mpc_int32_t mpc_callback_read (mpc_reader *reader, void *buffer, mpc_int32_t size) { - DecoderMPC *dmpc = (DecoderMPC *) reader->data; + DecoderMPC *dmpc = static_cast<DecoderMPC *>(reader->data); return dmpc->input()->read((char *)buffer, size); } static mpc_bool_t mpc_callback_seek (mpc_reader *reader, mpc_int32_t offset) { - DecoderMPC *dmpc = (DecoderMPC *) reader->data; + DecoderMPC *dmpc = static_cast<DecoderMPC *>(reader->data); return dmpc->input()->seek(offset); } static mpc_int32_t mpc_callback_tell (mpc_reader *reader) { - DecoderMPC *dmpc = (DecoderMPC *) reader->data; + DecoderMPC *dmpc = static_cast<DecoderMPC *>(reader->data); return dmpc->input()->pos (); } static mpc_bool_t mpc_callback_canseek (mpc_reader *reader) { - DecoderMPC *dmpc = (DecoderMPC *) reader->data; + DecoderMPC *dmpc = static_cast<DecoderMPC *>(reader->data); return !dmpc->input()->isSequential () ; } static mpc_int32_t mpc_callback_get_size (mpc_reader *reader) { - DecoderMPC *dmpc = (DecoderMPC *) reader->data; + DecoderMPC *dmpc = static_cast<DecoderMPC *>(reader->data); return dmpc->input()->size(); } // Decoder class -DecoderMPC::DecoderMPC(QIODevice *i) - : Decoder(i) -{ - m_len = 0; - m_bitrate = 0; - m_totalTime = 0.0; - m_data = nullptr; -} +DecoderMPC::DecoderMPC(QIODevice *i) : Decoder(i) +{} DecoderMPC::~DecoderMPC() { @@ -164,5 +157,4 @@ qint64 DecoderMPC::read(unsigned char *audio, qint64 maxSize) void DecoderMPC::seek(qint64 pos) { mpc_demux_seek_second(data()->demuxer, (double)pos/1000); - } diff --git a/src/plugins/Input/mpc/decoder_mpc.h b/src/plugins/Input/mpc/decoder_mpc.h index 7024020d3..007f3adad 100644 --- a/src/plugins/Input/mpc/decoder_mpc.h +++ b/src/plugins/Input/mpc/decoder_mpc.h @@ -26,7 +26,7 @@ struct mpc_data { - mpc_demux *demuxer; + mpc_demux *demuxer = nullptr; mpc_reader reader; mpc_streaminfo info; }; @@ -34,7 +34,7 @@ struct mpc_data class DecoderMPC : public Decoder { public: - DecoderMPC(QIODevice *i); + explicit DecoderMPC(QIODevice *i); virtual ~DecoderMPC(); struct mpc_data *data() @@ -50,11 +50,10 @@ public: void seek(qint64 time) override; private: - - struct mpc_data *m_data; - long m_len; - int m_bitrate; - qint64 m_totalTime; + struct mpc_data *m_data = nullptr; + long m_len = 0; + int m_bitrate = 0; + qint64 m_totalTime = 0; }; diff --git a/src/plugins/Input/mpc/mpcmetadatamodel.cpp b/src/plugins/Input/mpc/mpcmetadatamodel.cpp index ee9368477..81eeca5b7 100644 --- a/src/plugins/Input/mpc/mpcmetadatamodel.cpp +++ b/src/plugins/Input/mpc/mpcmetadatamodel.cpp @@ -45,11 +45,11 @@ QList<TagModel* > MPCMetaDataModel::tags() const return m_tags; } -MPCFileTagModel::MPCFileTagModel(TagLib::MPC::File *file, TagLib::MPC::File::TagTypes tagType) - : TagModel() +MPCFileTagModel::MPCFileTagModel(TagLib::MPC::File *file, TagLib::MPC::File::TagTypes tagType): TagModel(), + m_file(file), + m_tagType(tagType) { - m_tagType = tagType; - m_file = file; + if (m_tagType == TagLib::MPC::File::ID3v1) { m_tag = m_file->ID3v1Tag(); |
