From e94084ab46412950b49f82805a43c378dd365ac9 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 10 Feb 2016 11:27:33 +0000 Subject: fixed support of taglib versions less than 1.10 git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6127 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/rgscan/rgscandialog.cpp | 16 ++++++++++++++-- src/plugins/General/rgscan/rgscandialog.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/General/rgscan/rgscandialog.cpp b/src/plugins/General/rgscan/rgscandialog.cpp index bfd8b3cec..fcb88ad76 100644 --- a/src/plugins/General/rgscan/rgscandialog.cpp +++ b/src/plugins/General/rgscan/rgscandialog.cpp @@ -35,7 +35,10 @@ #include #include #include +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 10)) #include +#endif +#include #include "rgscanner.h" #include "gain_analysis.h" #include "rgscandialog.h" @@ -76,8 +79,12 @@ RGScanDialog::RGScanDialog(QList tracks, QWidget *parent) : Q ext == "flac" || //native flac ext == "oga" || //ogg flac ext == "ogg" || //ogg vorbis - ext == "wv" || //wavpack - ext == "m4a") //aac (mp4 container) + ext == "wv" //wavpack +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 10)) + || ext == "m4a") //aac (mp4 container) +#else + ) +#endif { paths.append(track->url()); QString name = formatter.format(track); @@ -369,8 +376,10 @@ void RGScanDialog::writeVorbisComment(TagLib::Ogg::XiphComment *tag, ReplayGainI } } +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 10)) void RGScanDialog::writeMP4Tag(TagLib::MP4::Tag *tag, ReplayGainInfoItem *item) { + if(m_ui.trackCheckBox->isChecked()) { tag->setItem("----:com.apple.iTunes:replaygain_track_gain", @@ -386,6 +395,7 @@ void RGScanDialog::writeMP4Tag(TagLib::MP4::Tag *tag, ReplayGainInfoItem *item) gainToStringList(item->info[Qmmp::REPLAYGAIN_ALBUM_PEAK])); } } +#endif void RGScanDialog::on_writeButton_clicked() { @@ -429,11 +439,13 @@ void RGScanDialog::on_writeButton_clicked() writeAPETag(file.APETag(true), item); file.save(); } +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 10)) else if(ext == "m4a") //MPEG-4 Part 14 { TagLib::MP4::File file(qPrintable(item->url)); writeMP4Tag(file.tag(), item); file.save(); } +#endif } } diff --git a/src/plugins/General/rgscan/rgscandialog.h b/src/plugins/General/rgscan/rgscandialog.h index 6b2d23afa..1500796c2 100644 --- a/src/plugins/General/rgscan/rgscandialog.h +++ b/src/plugins/General/rgscan/rgscandialog.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "ui_rgscandialog.h" @@ -47,10 +48,12 @@ namespace TagLib { class XiphComment; } +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 10)) namespace MP4 { class Tag; } +#endif } /** @@ -80,7 +83,9 @@ private: void writeAPETag(TagLib::APE::Tag *tag, ReplayGainInfoItem *item); void writeID3v2Tag(TagLib::ID3v2::Tag *tag, ReplayGainInfoItem *item); void writeVorbisComment(TagLib::Ogg::XiphComment *tag, ReplayGainInfoItem *item); +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 10)) void writeMP4Tag(TagLib::MP4::Tag *tag, ReplayGainInfoItem *item); +#endif Ui::RGScanDialog m_ui; QList m_scanners; QList m_replayGainItemList; -- cgit v1.2.3-13-gbd6f