From 7ce39a16d12257b74dc205112901b24bda585185 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 28 Apr 2016 05:30:48 +0000 Subject: using read-only mode for ReplayGain git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6273 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/flac/replaygainreader.cpp | 15 +++++++++++++++ src/plugins/Input/mad/replaygainreader.cpp | 9 +++++++++ src/plugins/Input/vorbis/replaygainreader.cpp | 10 ++++++++++ 3 files changed, 34 insertions(+) (limited to 'src') diff --git a/src/plugins/Input/flac/replaygainreader.cpp b/src/plugins/Input/flac/replaygainreader.cpp index 095e94fa9..b33dd0ffd 100644 --- a/src/plugins/Input/flac/replaygainreader.cpp +++ b/src/plugins/Input/flac/replaygainreader.cpp @@ -23,19 +23,34 @@ #include #include #include +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) +#include +#include +#endif #include "replaygainreader.h" ReplayGainReader::ReplayGainReader(const QString &path) { +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) + TagLib::FileStream stream(QStringToFileName(path), true); +#endif if(path.endsWith(".flac", Qt::CaseInsensitive)) { +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) + TagLib::FLAC::File fileRef(&stream, TagLib::ID3v2::FrameFactory::instance()); +#else TagLib::FLAC::File fileRef(QStringToFileName(path)); +#endif if(fileRef.xiphComment()) readVorbisComment(fileRef.xiphComment()); } else if(path.endsWith(".oga", Qt::CaseInsensitive)) { +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) + TagLib::Ogg::FLAC::File fileRef(&stream); +#else TagLib::Ogg::FLAC::File fileRef(QStringToFileName(path)); +#endif if(fileRef.tag()) readVorbisComment(fileRef.tag()); } diff --git a/src/plugins/Input/mad/replaygainreader.cpp b/src/plugins/Input/mad/replaygainreader.cpp index b8fac3ed4..fc8704a11 100644 --- a/src/plugins/Input/mad/replaygainreader.cpp +++ b/src/plugins/Input/mad/replaygainreader.cpp @@ -25,11 +25,20 @@ #include #include #include +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) +#include +#include +#endif #include "replaygainreader.h" ReplayGainReader::ReplayGainReader(const QString &path) { +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) + TagLib::FileStream stream(QStringToFileName(path), true); + TagLib::MPEG::File fileRef(&stream, TagLib::ID3v2::FrameFactory::instance()); +#else TagLib::MPEG::File fileRef(QStringToFileName(path)); +#endif if(fileRef.ID3v2Tag()) readID3v2(fileRef.ID3v2Tag()); if(m_values.isEmpty() && fileRef.APETag()) diff --git a/src/plugins/Input/vorbis/replaygainreader.cpp b/src/plugins/Input/vorbis/replaygainreader.cpp index aac5957f5..b44f06b81 100644 --- a/src/plugins/Input/vorbis/replaygainreader.cpp +++ b/src/plugins/Input/vorbis/replaygainreader.cpp @@ -22,11 +22,21 @@ #include #include #include +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) +#include +#include +#endif #include "replaygainreader.h" ReplayGainReader::ReplayGainReader(const QString &path) { +#if (TAGLIB_MAJOR_VERSION > 1) || ((TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION >= 8)) + TagLib::FileStream stream(QStringToFileName(path), true); + TagLib::Ogg::Vorbis::File fileRef(&stream); +#else TagLib::Ogg::Vorbis::File fileRef(QStringToFileName(path)); +#endif + if(fileRef.tag()) readVorbisComment(fileRef.tag()); } -- cgit v1.2.3-13-gbd6f