diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-04-28 10:18:04 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-04-28 10:18:04 +0000 |
| commit | 26f7afaf50fe5965a32db545a1519f88a6a1e0c7 (patch) | |
| tree | 2ed878105c8dc2cdc552b448bbdb0ccf9d5cc25c | |
| parent | 4d8df087fb7eb80ac100e5024348b0917e46e7dd (diff) | |
| download | qmmp-26f7afaf50fe5965a32db545a1519f88a6a1e0c7.tar.gz qmmp-26f7afaf50fe5965a32db545a1519f88a6a1e0c7.tar.bz2 qmmp-26f7afaf50fe5965a32db545a1519f88a6a1e0c7.zip | |
optimization
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8802 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/plugins/Input/flac/decoder_flac.cpp | 9 | ||||
| -rw-r--r-- | src/plugins/Input/flac/decoder_flac.h | 48 | ||||
| -rw-r--r-- | src/plugins/Input/flac/flacmetadatamodel.cpp | 6 | ||||
| -rw-r--r-- | src/plugins/Input/flac/flacmetadatamodel.h | 6 | ||||
| -rw-r--r-- | src/plugins/Input/wavpack/decoder_wavpack.cpp | 11 | ||||
| -rw-r--r-- | src/plugins/Input/wavpack/decoder_wavpack.h | 26 |
6 files changed, 41 insertions, 65 deletions
diff --git a/src/plugins/Input/flac/decoder_flac.cpp b/src/plugins/Input/flac/decoder_flac.cpp index f45b3148e..281d2053f 100644 --- a/src/plugins/Input/flac/decoder_flac.cpp +++ b/src/plugins/Input/flac/decoder_flac.cpp @@ -136,7 +136,6 @@ static FLAC__StreamDecoderReadStatus flac_callback_read (const FLAC__StreamDecod } return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - } static FLAC__StreamDecoderWriteStatus flac_callback_write (const FLAC__StreamDecoder *d, @@ -270,16 +269,8 @@ DecoderFLAC::DecoderFLAC(const QString &path, QIODevice *i) m_data = new flac_data; m_data->decoder = nullptr; m_data->input = i; - m_parser = nullptr; - length_in_bytes = 0; - m_totalBytes = 0; - m_sz = 0; - m_buf = nullptr; - m_offset = 0; - m_track = 0; } - DecoderFLAC::~DecoderFLAC() { deinit(); diff --git a/src/plugins/Input/flac/decoder_flac.h b/src/plugins/Input/flac/decoder_flac.h index 2d31f97a3..f24a2956a 100644 --- a/src/plugins/Input/flac/decoder_flac.h +++ b/src/plugins/Input/flac/decoder_flac.h @@ -34,28 +34,28 @@ class CueParser; struct flac_data { //FLAC__SeekableStreamDecoder *decoder; - FLAC__StreamDecoder *decoder; - int bitrate; - int abort; /* abort playing (due to an error) */ + FLAC__StreamDecoder *decoder = nullptr; + int bitrate = 0; + int abort = 0; /* abort playing (due to an error) */ - qint64 length; - qint64 total_samples; + qint64 length = 0; + qint64 total_samples = 0; FLAC__byte sample_buffer[SAMPLE_BUFFER_SIZE]; - unsigned sample_buffer_fill; + unsigned sample_buffer_fill = 0; /* sound parameters */ - unsigned bits_per_sample; - unsigned sample_rate; - unsigned channels; + unsigned bits_per_sample = 0; + unsigned sample_rate = 0; + unsigned channels = 0; - FLAC__uint64 last_decode_position; + FLAC__uint64 last_decode_position = 0; //counters - qint64 read_bytes; - qint64 frame_counter; + qint64 read_bytes = 0; + qint64 frame_counter = 0; - QIODevice *input; + QIODevice *input = nullptr; }; class DecoderFLAC : public Decoder @@ -80,17 +80,17 @@ private: uint findID3v2(char *data, ulong size); //retuns ID3v2 tag size ChannelMap findChannelMap(int channels); - struct flac_data *m_data; - qint64 length_in_bytes; - qint64 m_totalBytes; - qint64 m_offset; - qint64 m_length; - QString m_path; - CueParser *m_parser; - int m_track; - char *m_buf; //buffer for remainig data - qint64 m_buf_size; - qint64 m_sz; //sample size + struct flac_data *m_data = nullptr; + qint64 length_in_bytes = 0; + qint64 m_totalBytes = 0; + qint64 m_offset = 0; + qint64 m_length = 0; + QString m_path = 0; + CueParser *m_parser = nullptr; + int m_track = 0; + char *m_buf = nullptr; //buffer for remainig data + qint64 m_buf_size = 0; + qint64 m_sz = 0; //sample size }; diff --git a/src/plugins/Input/flac/flacmetadatamodel.cpp b/src/plugins/Input/flac/flacmetadatamodel.cpp index c4b2301b7..14e87f358 100644 --- a/src/plugins/Input/flac/flacmetadatamodel.cpp +++ b/src/plugins/Input/flac/flacmetadatamodel.cpp @@ -25,7 +25,7 @@ #include <taglib/tmap.h> #include <taglib/id3v2framefactory.h> #include <taglib/flacpicture.h> -#ifndef IS_COVER_EDITABLE +#ifndef HAS_PICTURE_LIST #include <FLAC/all.h> #endif #include <qmmp/metadatamanager.h> @@ -38,10 +38,6 @@ FLACMetaDataModel::FLACMetaDataModel(const QString &path, bool readOnly) : MetaDataModel(true) #endif { - m_file = nullptr; - m_stream = nullptr; - m_tag = nullptr; - if(path.startsWith("flac://")) { QString p = path; diff --git a/src/plugins/Input/flac/flacmetadatamodel.h b/src/plugins/Input/flac/flacmetadatamodel.h index 440c490db..55b4a5bc7 100644 --- a/src/plugins/Input/flac/flacmetadatamodel.h +++ b/src/plugins/Input/flac/flacmetadatamodel.h @@ -48,9 +48,9 @@ public: private: QString m_path; QList<TagModel* > m_tags; - TagLib::Ogg::XiphComment *m_tag; - TagLib::File *m_file; - TagLib::FileStream *m_stream; + TagLib::Ogg::XiphComment *m_tag = nullptr; + TagLib::File *m_file = nullptr; + TagLib::FileStream *m_stream = nullptr; }; class VorbisCommentModel : public TagModel diff --git a/src/plugins/Input/wavpack/decoder_wavpack.cpp b/src/plugins/Input/wavpack/decoder_wavpack.cpp index 0c75cb914..2607d9dc8 100644 --- a/src/plugins/Input/wavpack/decoder_wavpack.cpp +++ b/src/plugins/Input/wavpack/decoder_wavpack.cpp @@ -36,17 +36,6 @@ DecoderWavPack::DecoderWavPack(const QString &path) : Decoder() { m_path = path; - m_totalTime = 0.0; - m_chan = 0; - m_context = nullptr; - m_parser = nullptr; - m_output_buf = nullptr; - m_length_in_bytes = 0; - m_totalBytes = 0; - m_frame_size = 0; - m_offset = 0; - m_bps = 0; - m_track = 0; } DecoderWavPack::~DecoderWavPack() diff --git a/src/plugins/Input/wavpack/decoder_wavpack.h b/src/plugins/Input/wavpack/decoder_wavpack.h index ede01d1e8..14dd79438 100644 --- a/src/plugins/Input/wavpack/decoder_wavpack.h +++ b/src/plugins/Input/wavpack/decoder_wavpack.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2016 by Ilya Kotov * + * Copyright (C) 2008-2019 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -48,19 +48,19 @@ private: void deinit(); qint64 wavpack_decode(unsigned char *data, qint64 size); ChannelMap findChannelMap(int channels); - WavpackContext *m_context; - int32_t *m_output_buf; // output buffer - int m_chan; - qint64 m_totalTime; - qint64 m_length_in_bytes; - qint64 m_totalBytes; - qint64 m_offset; - qint64 m_length; + WavpackContext *m_context = nullptr; + int32_t *m_output_buf = nullptr; // output buffer + int m_chan = 0; + qint64 m_totalTime = 0; + qint64 m_length_in_bytes = 0; + qint64 m_totalBytes = 0; + qint64 m_offset = 0; + qint64 m_length = 0; QString m_path; - CueParser *m_parser; - int m_track; - int m_bps; - qint64 m_frame_size; //frame size + CueParser *m_parser = nullptr; + int m_track = 0; + int m_bps = 0; + qint64 m_frame_size = 0; //frame size }; #endif // DECODER_WAVPACK_H |
