diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-02-09 21:19:35 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-02-09 21:19:35 +0000 |
| commit | 7e7141599cd04c0d721cbc4cbad5c50ab8e7dc73 (patch) | |
| tree | 2c3da62d3e5e5047cdad1e177d7a93b9b74c7d12 /src | |
| parent | 3f7a4110979a94f326a77ea20d3817f9623fd2f5 (diff) | |
| download | qmmp-7e7141599cd04c0d721cbc4cbad5c50ab8e7dc73.tar.gz qmmp-7e7141599cd04c0d721cbc4cbad5c50ab8e7dc73.tar.bz2 qmmp-7e7141599cd04c0d721cbc4cbad5c50ab8e7dc73.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/Input/mpeg/decoder_mad.cpp | 5 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/decoder_mad.h | 3 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/decodermpegfactory.cpp | 3 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/settingsdialog.cpp | 2 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/settingsdialog.ui | 46 |
5 files changed, 45 insertions, 14 deletions
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 @@ <rect> <x>0</x> <y>0</y> - <width>380</width> - <height>391</height> + <width>362</width> + <height>420</height> </rect> </property> <property name="windowTitle"> @@ -34,22 +34,22 @@ <property name="title"> <string>Decoder</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> <widget class="QRadioButton" name="madRadioButton"> <property name="text"> <string>MAD</string> </property> </widget> </item> - <item> + <item row="0" column="1"> <widget class="QRadioButton" name="mpg123RadioButton"> <property name="text"> <string>MPG123</string> </property> </widget> </item> - <item> + <item row="0" column="2" rowspan="2"> <spacer name="horizontalSpacer_3"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -62,6 +62,16 @@ </property> </spacer> </item> + <item row="1" column="0" colspan="2"> + <widget class="QCheckBox" name="enableCrcCheckBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable CRC checking</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -367,8 +377,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>168</x> - <y>351</y> + <x>174</x> + <y>413</y> </hint> <hint type="destinationlabel"> <x>70</x> @@ -383,8 +393,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>257</x> - <y>336</y> + <x>263</x> + <y>413</y> </hint> <hint type="destinationlabel"> <x>302</x> @@ -392,5 +402,21 @@ </hint> </hints> </connection> + <connection> + <sender>madRadioButton</sender> + <signal>toggled(bool)</signal> + <receiver>enableCrcCheckBox</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>60</x> + <y>38</y> + </hint> + <hint type="destinationlabel"> + <x>81</x> + <y>76</y> + </hint> + </hints> + </connection> </connections> </ui> |
