From 7e7141599cd04c0d721cbc4cbad5c50ab8e7dc73 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 9 Feb 2021 21:19:35 +0000 Subject: mpeg: added option to enable CRC checking git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9719 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/mpeg/decoder_mad.cpp | 5 +-- src/plugins/Input/mpeg/decoder_mad.h | 3 +- src/plugins/Input/mpeg/decodermpegfactory.cpp | 3 +- src/plugins/Input/mpeg/settingsdialog.cpp | 2 ++ src/plugins/Input/mpeg/settingsdialog.ui | 46 +++++++++++++++++++++------ 5 files changed, 45 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/plugins/Input/mpeg/decoder_mad.cpp b/src/plugins/Input/mpeg/decoder_mad.cpp index 073871c70..03eff03ce 100644 --- a/src/plugins/Input/mpeg/decoder_mad.cpp +++ b/src/plugins/Input/mpeg/decoder_mad.cpp @@ -33,7 +33,7 @@ #define LAME_MAGIC (('L' << 24) | ('A' << 16) | ('M' << 8) | 'E') #define INPUT_BUFFER_SIZE (32*1024) -DecoderMAD::DecoderMAD(QIODevice *i) : Decoder(i) +DecoderMAD::DecoderMAD(bool crc, QIODevice *i) : Decoder(i), m_crc(crc) {} DecoderMAD::~DecoderMAD() @@ -74,7 +74,8 @@ bool DecoderMAD::initialize() } mad_stream_init(&m_stream); - mad_stream_options(&m_stream, MAD_OPTION_IGNORECRC); + if(!m_crc) + mad_stream_options(&m_stream, MAD_OPTION_IGNORECRC); mad_frame_init(&m_frame); mad_synth_init(&m_synth); diff --git a/src/plugins/Input/mpeg/decoder_mad.h b/src/plugins/Input/mpeg/decoder_mad.h index b87ed6061..9764e1a70 100644 --- a/src/plugins/Input/mpeg/decoder_mad.h +++ b/src/plugins/Input/mpeg/decoder_mad.h @@ -31,7 +31,7 @@ class DecoderMAD : public Decoder { public: - explicit DecoderMAD(QIODevice *i); + explicit DecoderMAD(bool crc, QIODevice *i); virtual ~DecoderMAD(); // standard decoder API @@ -98,6 +98,7 @@ private: struct mad_frame m_frame; struct mad_synth m_synth; qint64 m_skip_bytes = 0, m_play_bytes = -1; + bool m_crc; }; diff --git a/src/plugins/Input/mpeg/decodermpegfactory.cpp b/src/plugins/Input/mpeg/decodermpegfactory.cpp index 69ebfb155..3021b6e4f 100644 --- a/src/plugins/Input/mpeg/decodermpegfactory.cpp +++ b/src/plugins/Input/mpeg/decodermpegfactory.cpp @@ -199,7 +199,8 @@ Decoder *DecoderMPEGFactory::create(const QString &, QIODevice *input) else { qDebug("DecoderMPEGFactory: using MAD decoder"); - d = new DecoderMAD(input); + bool crc = settings.value("MPEG/enable_crc", false).toBool(); + d = new DecoderMAD(crc, input); } #elif defined(WITH_MAD) d = new DecoderMAD(input); diff --git a/src/plugins/Input/mpeg/settingsdialog.cpp b/src/plugins/Input/mpeg/settingsdialog.cpp index a2facf6ce..c05cf96ac 100644 --- a/src/plugins/Input/mpeg/settingsdialog.cpp +++ b/src/plugins/Input/mpeg/settingsdialog.cpp @@ -42,6 +42,7 @@ SettingsDialog::SettingsDialog(bool using_rusxmms, QWidget *parent) QString decoderName = settings.value("decoder", "mad").toString(); m_ui.madRadioButton->setChecked(true); m_ui.mpg123RadioButton->setChecked(decoderName == "mpg123"); + m_ui.enableCrcCheckBox->setChecked(settings.value("enable_crc", false).toBool()); #elif defined(WITH_MAD) m_ui.madRadioButton->setChecked(true); m_ui.decoderGroupBox->setEnabled(false); @@ -80,6 +81,7 @@ void SettingsDialog::accept() QSettings settings(Qmmp::configFile(), QSettings::IniFormat); settings.beginGroup("MPEG"); settings.setValue("decoder", m_ui.mpg123RadioButton->isChecked() ? "mpg123" : "mad"); + settings.setValue("enable_crc", m_ui.enableCrcCheckBox->isChecked()); settings.setValue("ID3v1_encoding", m_ui.id3v1EncComboBox->currentText()); settings.setValue("ID3v2_encoding", m_ui.id3v2EncComboBox->currentText()); settings.setValue("tag_1", m_ui.firstTagComboBox->currentIndex()); diff --git a/src/plugins/Input/mpeg/settingsdialog.ui b/src/plugins/Input/mpeg/settingsdialog.ui index 7465f5373..d2a6653f7 100644 --- a/src/plugins/Input/mpeg/settingsdialog.ui +++ b/src/plugins/Input/mpeg/settingsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 380 - 391 + 362 + 420 @@ -34,22 +34,22 @@ Decoder - - + + MAD - + MPG123 - + Qt::Horizontal @@ -62,6 +62,16 @@ + + + + false + + + Enable CRC checking + + + @@ -367,8 +377,8 @@ reject() - 168 - 351 + 174 + 413 70 @@ -383,8 +393,8 @@ accept() - 257 - 336 + 263 + 413 302 @@ -392,5 +402,21 @@ + + madRadioButton + toggled(bool) + enableCrcCheckBox + setEnabled(bool) + + + 60 + 38 + + + 81 + 76 + + + -- cgit v1.2.3-13-gbd6f