rpms/amarok/F-12 amarok-taglib.patch, NONE, 1.1 amarok.spec, 1.162, 1.163

Rex Dieter rdieter at fedoraproject.org
Thu Sep 17 19:03:38 UTC 2009


Author: rdieter

Update of /cvs/pkgs/rpms/amarok/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14593/F-12

Modified Files:
	amarok.spec 
Added Files:
	amarok-taglib.patch 
Log Message:
* Thu Sep 17 2009 Rex Dieter <rdieter at fedoraproject.org> 2.1.85-2
- BR: taglib-devel >= 1.6, taglib-extras-devel >= 1.0


amarok-taglib.patch:
 b/CMakeLists.txt                                    |    4 
 b/shared/MetaReplayGain.cpp                         |    6 
 b/src/App.cpp                                       |    6 
 b/src/meta/MetaUtility.cpp                          |    4 
 b/src/meta/file/File_p.h                            |    5 
 b/src/podcasts/sql/SqlPodcastMeta.cpp               |    3 
 b/utilities/collectionscanner/AFTUtility.cpp        |   14 
 b/utilities/collectionscanner/CollectionScanner.cpp |   14 
 utilities/collectionscanner/MetaReplayGain.cpp      |  354 --------------------
 utilities/collectionscanner/MetaReplayGain.h        |   49 --
 10 files changed, 8 insertions(+), 451 deletions(-)

--- NEW FILE amarok-taglib.patch ---
# git diff 3ee0ef70c0c9d5de982091e353804c990c35ea4e
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8219bc6..e4b6b94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,10 +13,10 @@ option(WITH_IPOD "Enable iPod support in Amarok" ON)
 include(CheckLibraryExists)
 check_library_exists(dl dlopen "" LIBDL_FOUND)
 
-set(TAGLIB_MIN_VERSION "1.5")
+set(TAGLIB_MIN_VERSION "1.6")
 find_package(Taglib REQUIRED)
 
-find_package(Taglib-Extras 0.1 REQUIRED)
+find_package(Taglib-Extras 1.0 REQUIRED)
 if( TAGLIB-EXTRAS_FOUND )
     add_definitions( -DTAGLIB_EXTRAS_FOUND )
 endif( TAGLIB-EXTRAS_FOUND )
diff --git a/shared/MetaReplayGain.cpp b/shared/MetaReplayGain.cpp
index d6edd95..97073d5 100644
--- a/shared/MetaReplayGain.cpp
+++ b/shared/MetaReplayGain.cpp
@@ -38,10 +38,8 @@
 #include <trueaudiofile.h>
 #include <vorbisfile.h>
 #include <wavpackfile.h>
-#ifdef TAGLIB_EXTRAS_FOUND
 #include <asffile.h>
 #include <mp4file.h>
-#endif
 
 // converts a peak value from the normal digital scale form to the more useful decibel form
 // decibels are relative to the /adjusted/ waveform
@@ -229,7 +227,6 @@ static Meta::ReplayGainTagMap readXiphTags( TagLib::Ogg::XiphComment *tag )
     return outputMap;
 }
 
-#ifdef TAGLIB_EXTRAS_FOUND
 static Meta::ReplayGainTagMap readASFTags( TagLib::ASF::Tag *tag )
 {
     const TagLib::ASF::AttributeListMap &tagMap = tag->attributeListMap();
@@ -251,7 +248,6 @@ static Meta::ReplayGainTagMap readASFTags( TagLib::ASF::Tag *tag )
 
     return outputMap;
 }
-#endif
 // Bad news: ReplayGain in MP4 is not actually standardized in any way.  Maybe reimplement at some point...maybe.  See
 // http://www.hydrogenaudio.org/forums/lofiversion/index.php/t14322.html
 #ifdef DO_NOT_USE_THIS_UNTIL_FIXED
@@ -332,13 +328,11 @@ Meta::readReplayGainTags( TagLib::FileRef fileref )
         if ( file->APETag() )
             map = readAPETags( file->APETag() );
     }
-#ifdef TAGLIB_EXTRAS_FOUND
     else if ( TagLib::ASF::File *file = dynamic_cast<TagLib::ASF::File *>( fileref.file() ) )
     {
         if ( file->tag() )
             map = readASFTags( file->tag() );
     }
-#endif
 // See comment above
 #ifdef DO_NOT_USE_THIS_UNTIL_FIXED
     else if ( TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File *>( fileref.file() ) )
diff --git a/src/App.cpp b/src/App.cpp
index bd01517..637a0ad 100644
--- a/src/App.cpp
+++ b/src/App.cpp
@@ -70,10 +70,7 @@
 
 #ifdef TAGLIB_EXTRAS_FOUND
 #include <audiblefiletyperesolver.h>
-#include <asffiletyperesolver.h>
-#include <wavfiletyperesolver.h>
 #include <realmediafiletyperesolver.h>
-#include <mp4filetyperesolver.h>
 #endif
 
 QMutex Debug::mutex;
@@ -143,11 +140,8 @@ App::App()
 
 #ifdef TAGLIB_EXTRAS_FOUND
     PERF_LOG( "Registering taglib plugins" )
-    TagLib::FileRef::addFileTypeResolver(new MP4FileTypeResolver);
-    TagLib::FileRef::addFileTypeResolver(new ASFFileTypeResolver);
     TagLib::FileRef::addFileTypeResolver(new RealMediaFileTypeResolver);
     TagLib::FileRef::addFileTypeResolver(new AudibleFileTypeResolver);
-    TagLib::FileRef::addFileTypeResolver(new WavFileTypeResolver);
     PERF_LOG( "Done Registering taglib plugins" )
 #endif
 
diff --git a/src/meta/MetaUtility.cpp b/src/meta/MetaUtility.cpp
index b78ef92..314db57 100644
--- a/src/meta/MetaUtility.cpp
+++ b/src/meta/MetaUtility.cpp
@@ -41,12 +41,10 @@
 #include <vorbisfile.h>
 #include <textidentificationframe.h>
 #include <xiphcomment.h>
-#ifdef TAGLIB_EXTRAS_FOUND
 #include <mp4file.h>
 #include <mp4item.h>
 #include <mp4tag.h>
 #include <asftag.h>
-#endif
 
         static const QString XESAM_ALBUM          = "http://freedesktop.org/standards/xesam/1.0/core#album";
         static const QString XESAM_ARTIST         = "http://freedesktop.org/standards/xesam/1.0/core#artist";
@@ -320,7 +318,6 @@ Meta::Field::writeFields( TagLib::FileRef fileref, const QVariantMap &changes )
             file->xiphComment()->addField("DISCNUMBER", disc);
         }
     }
-#ifdef TAGLIB_EXTRAS_FOUND
     else if ( TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File *>( fileref.file() ) )
     {
         if( changes.contains( Meta::Field::COMPOSER ) )
@@ -338,7 +335,6 @@ Meta::Field::writeFields( TagLib::FileRef fileref, const QVariantMap &changes )
             mp4tag->itemListMap()["disk"] = TagLib::MP4::Item( discnumber, 0 );
         }
     }
-#endif
     if( shouldSave )
         fileref.save();
 }
diff --git a/src/meta/file/File_p.h b/src/meta/file/File_p.h
index 57c5195..f9e9daf 100644
--- a/src/meta/file/File_p.h
+++ b/src/meta/file/File_p.h
@@ -50,10 +50,7 @@
 #include <tlist.h>
 #include <tstring.h>
 #include <vorbisfile.h>
-
-#ifdef TAGLIB_EXTRAS_FOUND
 #include <mp4file.h>
-#endif
 
 namespace MetaFile
 {
@@ -283,7 +280,6 @@ void Track::Private::readMetaData()
                 disc = strip( flm[ "DISCNUMBER" ].front() );
         }
     }
-#ifdef TAGLIB_EXTRAS_FOUND
     else if( TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File *>( fileRef.file() ) )
     {
         TagLib::MP4::Tag *mp4tag = dynamic_cast< TagLib::MP4::Tag *>( file->tag() );
@@ -296,7 +292,6 @@ void Track::Private::readMetaData()
                 disc = QString::number( mp4tag->itemListMap()["disk"].toIntPair().first );
         }
     }
-#endif
     if( !disc.isEmpty() )
     {
         int i = disc.indexOf( '/' );
diff --git a/src/podcasts/sql/SqlPodcastMeta.cpp b/src/podcasts/sql/SqlPodcastMeta.cpp
index 8b5a96b..4f82eb0 100644
--- a/src/podcasts/sql/SqlPodcastMeta.cpp
+++ b/src/podcasts/sql/SqlPodcastMeta.cpp
@@ -42,10 +42,7 @@
 #include <tlist.h>
 #include <tstring.h>
 #include <vorbisfile.h>
-
-#ifdef TAGLIB_EXTRAS_FOUND
 #include <mp4file.h>
-#endif
 
 class TimecodeWriteCapabilityPodcastImpl : public Meta::TimecodeWriteCapability
 {
diff --git a/utilities/collectionscanner/AFTUtility.cpp b/utilities/collectionscanner/AFTUtility.cpp
index 98552c5..3dc009b 100644
--- a/utilities/collectionscanner/AFTUtility.cpp
+++ b/utilities/collectionscanner/AFTUtility.cpp
@@ -26,6 +26,9 @@
 #include <id3v2tag.h>
 #include <mpcfile.h>
 #include <mpegfile.h>
+#include <mp4item.h>
+#include <mp4file.h>
+#include <mp4tag.h>
 #include <oggfile.h>
 #include <oggflacfile.h>
 #include <speexfile.h>
@@ -35,17 +38,6 @@
 #include <vorbisfile.h>
 #include <xiphcomment.h>
 
-#ifdef TAGLIB_EXTRAS_FOUND
-#include <mp4file.h>
-#include <mp4tag.h>
-#include <mp4item.h>
-#include <audiblefiletyperesolver.h>
-#include <asffiletyperesolver.h>
-#include <wavfiletyperesolver.h>
-#include <realmediafiletyperesolver.h>
-#include <mp4filetyperesolver.h>
-#endif
-
 #include <QFile>
 #include <QTime>
 
diff --git a/utilities/collectionscanner/CollectionScanner.cpp b/utilities/collectionscanner/CollectionScanner.cpp
index 673be1c..c3d961e 100644
--- a/utilities/collectionscanner/CollectionScanner.cpp
+++ b/utilities/collectionscanner/CollectionScanner.cpp
@@ -49,6 +49,9 @@
 #include <flacfile.h>
 #include <id3v1tag.h>
 #include <id3v2tag.h>
+#include <mp4file.h>
+#include <mp4tag.h>
+#include <mp4item.h>
 #include <mpcfile.h>
 #include <mpegfile.h>
 #include <oggfile.h>
@@ -59,14 +62,8 @@
 #include <vorbisfile.h>
 
 #ifdef TAGLIB_EXTRAS_FOUND
-#include <mp4file.h>
-#include <mp4tag.h>
-#include <mp4item.h>
 #include <audiblefiletyperesolver.h>
-#include <asffiletyperesolver.h>
-#include <wavfiletyperesolver.h>
 #include <realmediafiletyperesolver.h>
-#include <mp4filetyperesolver.h>
 #endif
 
 #include <textidentificationframe.h>
@@ -101,11 +98,8 @@ CollectionScanner::CollectionScanner( int &argc, char **argv )
     readArgs();
 
 #ifdef TAGLIB_EXTRAS_FOUND
-    TagLib::FileRef::addFileTypeResolver(new MP4FileTypeResolver);
-    TagLib::FileRef::addFileTypeResolver(new ASFFileTypeResolver);
     TagLib::FileRef::addFileTypeResolver(new RealMediaFileTypeResolver);
     TagLib::FileRef::addFileTypeResolver(new AudibleFileTypeResolver);
-    TagLib::FileRef::addFileTypeResolver(new WavFileTypeResolver);
 #endif
 
     m_logfile = ( m_batch ? ( m_incremental ? "amarokcollectionscanner_batchincrementalscan.log" : "amarokcollectionscanner_batchfullscan.log" )
@@ -644,7 +638,6 @@ CollectionScanner::readTags( const QString &path, TagLib::AudioProperties::ReadS
 //             if ( images && file->ID3v2Tag() )
 //                 loadImagesFromTag( *file->ID3v2Tag(), *images );
         }
-#ifdef TAGLIB_EXTRAS_FOUND
         else if ( TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File *>( fileref.file() ) )
         {
             fileType = mp4;
@@ -667,7 +660,6 @@ CollectionScanner::readTags( const QString &path, TagLib::AudioProperties::ReadS
 //                     images->push_back( EmbeddedImage( mp4tag->cover(), "" ) );
             }
         }
-#endif
 
         if ( !disc.isEmpty() )
         {
diff --git a/utilities/collectionscanner/MetaReplayGain.cpp b/utilities/collectionscanner/MetaReplayGain.cpp
deleted file mode 100644
index 8e789cf..0000000
--- a/utilities/collectionscanner/MetaReplayGain.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
-   Copyright (C) 2009 Alex Merry <alex.merry at kdemail.net>
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2
-   of the License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-// NOTE: this file is used by amarokcollectionscanner and CANNOT use any amaroklib
-//       code [this includes debug()]
-
-#include "MetaReplayGain.h"
-
-#include <QString>
-#include <cmath>
-
-// Taglib
-#include <tag.h>
-#include <tlist.h>
-#include <tstring.h>
-#include <textidentificationframe.h>
-#include <apetag.h>
-#include <flacfile.h>
-#include <id3v2tag.h>
-#include <mpcfile.h>
-#include <mpegfile.h>
-#include <oggfile.h>
-#include <oggflacfile.h>
-#include <speexfile.h>
-#include <trueaudiofile.h>
-#include <vorbisfile.h>
-#include <wavpackfile.h>
-#ifdef TAGLIB_EXTRAS_FOUND
-#include <asffile.h>
-#include <mp4file.h>
-#endif
-
-// converts a peak value from the normal digital scale form to the more useful decibel form
-// decibels are relative to the /adjusted/ waveform
-static qreal peakToDecibels( qreal scaleVal )
-{
-    if ( scaleVal > 0 )
-        return 20 * log10( scaleVal );
-    else
-        return 0;
-}
-
-// NOTE: representation is taken to be a binary value with units in the first column,
-//       1/2 in the second and so on.
-static qreal readRVA2PeakValue( const TagLib::ByteVector &data, int bits, bool *ok )
-{
-    qreal peak = 0.0;
-    // discarding digits at the end reduces precision, but doesn't otherwise change the value
-    if ( bits > 32 )
-        bits = 32;
-    // the +7 makes sure we round up when we divide by 8
-    unsigned int bytes = (bits + 7) / 8;
-
-    // normalize appears not to write a peak at all, and hence sets bits to 0
-    if ( bits == 0 )
-    {
-        if ( ok )
-            *ok = true;
-    }
-    else if ( bits >= 4 && data.size() >= bytes ) // fewer than 4 bits would just be daft
-    {
-        // excessBits is the number of bits we have to discard at the end
-        unsigned int excessBits = (8 * bytes) - bits;
-        // mask has 1s everywhere but the last /excessBits/ bits
-        quint32 mask = 0xffffffff << excessBits;
-        quint32 rawValue = 0;
-        for ( unsigned int i = 0; i < bytes; ++i )
-        {
-            rawValue <<= 8;
-            rawValue += (unsigned char)data[i];
-        }
-        rawValue &= mask;
-        peak = rawValue;
-        // amount we need to "shift" the value right to make the first digit the unit column
-        unsigned int rightShift = (8 * bytes) - 1;
-        peak /= (qreal)(1 << rightShift);
-        if ( ok )
-            *ok = true;
-    }
-    else
-    {
-        if ( ok )
-            *ok = false;
-    }
-    return peak;
-}
-
-// adds the converted version of the scale value if it is a valid, non-negative float
-static void maybeAddPeak( const TagLib::String &scaleVal, Meta::ReplayGainTag key, Meta::ReplayGainTagMap *map )
-{
-    // scale value is >= 0, and typically not much bigger than 1
-    QString value = TStringToQString( scaleVal );
-    bool ok = false;
-    qreal peak = value.toFloat( &ok );
-    if ( ok && peak >= 0 )
-        (*map)[key] = peakToDecibels( peak );
-}
-
-static void maybeAddGain( const TagLib::String &input, Meta::ReplayGainTag key, Meta::ReplayGainTagMap *map )
-{
-    QString value = TStringToQString( input ).remove( " dB" );
-    bool ok = false;
-    qreal gain = value.toFloat( &ok );
-    if (ok)
-        (*map)[key] = gain;
-}
-
-static Meta::ReplayGainTagMap readID3v2Tags( TagLib::ID3v2::Tag *tag )
-{
-    Meta::ReplayGainTagMap map;
-    {   // ID3v2.4.0 native replay gain tag support (as written by Quod Libet, for example).
-        TagLib::ID3v2::FrameList frames = tag->frameListMap()["RVA2"];
-        frames.append(tag->frameListMap()["XRVA"]);
-        if ( !frames.isEmpty() )
-        {
-            for ( unsigned int i = 0; i < frames.size(); ++i )
-            {
-                // we have to parse this frame ourselves
-                // ID3v2 frame header is 10 bytes, so skip that
-                TagLib::ByteVector data = frames[i]->render().mid( 10 );
-                unsigned int offset = 0;
-                QString desc( data.data() );
-                offset += desc.count() + 1;
-                unsigned int channel = data.mid( offset, 1 ).toUInt( true );
-                // channel 1 is the main volume - the only one we care about
-                if ( channel == 1 )
-                {
-                    ++offset;
-                    qint16 adjustment512 = data.mid( offset, 2 ).toShort( true );
-                    qreal adjustment = ( (qreal)adjustment512 ) / 512.0;
-                    offset += 2;
-                    unsigned int peakBits = data.mid( offset, 1 ).toUInt( true );
-                    ++offset;
-                    bool ok = false;
-                    qreal peak = readRVA2PeakValue( data.mid( offset ), peakBits, &ok );
-                    if ( ok )
-                    {
-                        if ( desc.toLower() == "album" )
-                        {
-                            map[Meta::ReplayGain_Album_Gain] = adjustment;
-                            map[Meta::ReplayGain_Album_Peak] = peakToDecibels( peak );
-                        }
-                        else if ( desc.toLower() == "track" || !map.contains( Meta::ReplayGain_Track_Gain ) )
-                        {
-                            map[Meta::ReplayGain_Track_Gain] = adjustment;
-                            map[Meta::ReplayGain_Track_Peak] = peakToDecibels( peak );
-                        }
-                    }
-                }
-            }
-            if ( !map.isEmpty() )
-                return map;
-        }
-    }
-
-    {   // Foobar2000-style ID3v2.3.0 tags
-        TagLib::ID3v2::FrameList frames = tag->frameListMap()["TXXX"];
-        for ( TagLib::ID3v2::FrameList::Iterator it = frames.begin(); it != frames.end(); ++it ) {
-            TagLib::ID3v2::UserTextIdentificationFrame* frame =
-                dynamic_cast<TagLib::ID3v2::UserTextIdentificationFrame*>( *it );
-            if ( frame && frame->fieldList().size() >= 2 )
-            {
-                QString desc = TStringToQString( frame->description() ).toLower();
-                if ( desc == "replaygain_album_gain" )
-                    maybeAddGain( frame->fieldList()[1], Meta::ReplayGain_Album_Gain, &map );
-                if ( desc == "replaygain_album_peak" )
-                    maybeAddPeak( frame->fieldList()[1], Meta::ReplayGain_Album_Peak, &map );
-                if ( desc == "replaygain_track_gain" )
-                    maybeAddGain( frame->fieldList()[1], Meta::ReplayGain_Track_Gain, &map );
-                if ( desc == "replaygain_track_peak" )
-                    maybeAddPeak( frame->fieldList()[1], Meta::ReplayGain_Track_Peak, &map );
-            }
-        }
-    }
-    return map;
-}
-
-static Meta::ReplayGainTagMap readAPETags( TagLib::APE::Tag *tag )
-{
-    Meta::ReplayGainTagMap map;
-    const TagLib::APE::ItemListMap &items = tag->itemListMap();
-    if ( items.contains("REPLAYGAIN_TRACK_GAIN") )
-    {
-        maybeAddGain( items["REPLAYGAIN_TRACK_GAIN"].values()[0], Meta::ReplayGain_Track_Gain, &map );
-        if ( items.contains("REPLAYGAIN_TRACK_PEAK") )
-            maybeAddPeak( items["REPLAYGAIN_TRACK_PEAK"].values()[0], Meta::ReplayGain_Track_Peak, &map );
-    }
-    if ( items.contains("REPLAYGAIN_ALBUM_GAIN") )
-    {
-        maybeAddGain( items["REPLAYGAIN_ALBUM_GAIN"].values()[0], Meta::ReplayGain_Album_Gain, &map );
-        if ( items.contains("REPLAYGAIN_ALBUM_PEAK") )
-            maybeAddPeak( items["REPLAYGAIN_ALBUM_PEAK"].values()[0], Meta::ReplayGain_Album_Peak, &map );
-    }
-    return map;
-}
-
-static Meta::ReplayGainTagMap readXiphTags( TagLib::Ogg::XiphComment *tag )
-{
-    const TagLib::Ogg::FieldListMap &tagMap = tag->fieldListMap();
-    Meta::ReplayGainTagMap outputMap;
-
-    if ( !tagMap["REPLAYGAIN_TRACK_GAIN"].isEmpty() )
-    {
-        maybeAddGain( tagMap["REPLAYGAIN_TRACK_GAIN"].front(), Meta::ReplayGain_Track_Gain, &outputMap );
-        if ( !tagMap["REPLAYGAIN_TRACK_PEAK"].isEmpty() )
-            maybeAddPeak( tagMap["REPLAYGAIN_TRACK_PEAK"].front(), Meta::ReplayGain_Track_Peak, &outputMap );
-    }
-
-    if ( !tagMap["REPLAYGAIN_ALBUM_GAIN"].isEmpty() )
-    {
-        maybeAddGain( tagMap["REPLAYGAIN_ALBUM_GAIN"].front(), Meta::ReplayGain_Album_Gain, &outputMap );
-        if ( !tagMap["REPLAYGAIN_ALBUM_PEAK"].isEmpty() )
-            maybeAddPeak( tagMap["REPLAYGAIN_ALBUM_PEAK"].front(), Meta::ReplayGain_Album_Peak, &outputMap );
-    }
-
-    return outputMap;
-}
-
-#ifdef TAGLIB_EXTRAS_FOUND
-static Meta::ReplayGainTagMap readASFTags( TagLib::ASF::Tag *tag )
-{
-    const TagLib::ASF::AttributeListMap &tagMap = tag->attributeListMap();
-    Meta::ReplayGainTagMap outputMap;
-
-    if ( !tagMap["REPLAYGAIN_TRACK_GAIN"].isEmpty() )
-    {
-        maybeAddGain( tagMap["REPLAYGAIN_TRACK_GAIN"].front().toString(), Meta::ReplayGain_Track_Gain, &outputMap );
-        if ( !tagMap["REPLAYGAIN_TRACK_PEAK"].isEmpty() )
-            maybeAddPeak( tagMap["REPLAYGAIN_TRACK_PEAK"].front().toString(), Meta::ReplayGain_Track_Peak, &outputMap );
-    }
-
-    if ( !tagMap["REPLAYGAIN_ALBUM_GAIN"].isEmpty() )
-    {
-        maybeAddGain( tagMap["REPLAYGAIN_ALBUM_GAIN"].front().toString(), Meta::ReplayGain_Album_Gain, &outputMap );
-        if ( !tagMap["REPLAYGAIN_ALBUM_PEAK"].isEmpty() )
-            maybeAddPeak( tagMap["REPLAYGAIN_ALBUM_PEAK"].front().toString(), Meta::ReplayGain_Album_Peak, &outputMap );
-    }
-
-    return outputMap;
-}
-#endif
-// Bad news: ReplayGain in MP4 is not actually standardized in any way.  Maybe reimplement at some point...maybe.  See
-// http://www.hydrogenaudio.org/forums/lofiversion/index.php/t14322.html
-#ifdef DO_NOT_USE_THIS_UNTIL_FIXED
-static Meta::ReplayGainTagMap readMP4Tags( TagLib::MP4::Tag *tag )
-{
-    Meta::ReplayGainTagMap outputMap;
-
-    if ( !tag->trackReplayGain().isNull() ) {
-        maybeAddGain( tag->trackReplayGain(), Meta::ReplayGain_Track_Gain, &outputMap );
-        if ( !tag->trackReplayGainPeak().isNull() )
-            maybeAddPeak( tag->trackReplayGainPeak(), Meta::ReplayGain_Track_Peak, &outputMap );
-    }
-
-    if ( !tag->albumReplayGain().isNull() ) {
-        maybeAddGain( tag->albumReplayGain(), Meta::ReplayGain_Album_Gain, &outputMap );
-        if ( !tag->albumReplayGainPeak().isNull() )
-            maybeAddPeak( tag->albumReplayGainPeak(), Meta::ReplayGain_Album_Peak, &outputMap );
-    }
-
-    return outputMap;
-}
-#endif 
-
-Meta::ReplayGainTagMap
-Meta::readReplayGainTags( TagLib::FileRef fileref )
-{
-    Meta::ReplayGainTagMap map;
-    // NB: we can't get replay gain info from MPC files, since it's stored in some magic place
-    //     and not in the APE tags, and taglib doesn't let us access the information (unless
-    //     we want to parse the file ourselves).
-    // FIXME: should we try getting the info from the MPC APE tag just in case?
-
-    if ( TagLib::MPEG::File *file = dynamic_cast<TagLib::MPEG::File *>( fileref.file() ) )
-    {
-        if ( file->ID3v2Tag() )
-            map = readID3v2Tags( file->ID3v2Tag() );
-        if ( map.isEmpty() && file->APETag() )
-            map = readAPETags( file->APETag() );
-    }
-    else if ( TagLib::Ogg::Vorbis::File *file = dynamic_cast<TagLib::Ogg::Vorbis::File *>( fileref.file() ) )
-    {
-        if ( file->tag() )
-            map = readXiphTags( file->tag() );
-    }
-    else if ( TagLib::FLAC::File *file = dynamic_cast<TagLib::FLAC::File *>( fileref.file() ) )
-    {
-        if ( file->xiphComment() )
-            map = readXiphTags( file->xiphComment() );
-        if ( map.isEmpty() && file->ID3v2Tag() )
-            map = readID3v2Tags( file->ID3v2Tag() );
-    }
-    else if ( TagLib::Ogg::FLAC::File *file = dynamic_cast<TagLib::Ogg::FLAC::File *>( fileref.file() ) )
-    {
-        if ( file->tag() )
-            map = readXiphTags( file->tag() );
-    }
-    else if ( TagLib::WavPack::File *file = dynamic_cast<TagLib::WavPack::File *>( fileref.file() ) )
-    {
-        if ( file->APETag() )
-            map = readAPETags( file->APETag() );
-    }
-    else if ( TagLib::TrueAudio::File *file = dynamic_cast<TagLib::TrueAudio::File *>( fileref.file() ) )
-    {
-        if ( file->ID3v2Tag() )
-            map = readID3v2Tags( file->ID3v2Tag() );
-    }
-    else if ( TagLib::Ogg::Speex::File *file = dynamic_cast<TagLib::Ogg::Speex::File *>( fileref.file() ) )
-    {
-        if ( file->tag() )
-            map = readXiphTags( file->tag() );
-    }
-    else if ( TagLib::MPC::File *file = dynamic_cast<TagLib::MPC::File *>( fileref.file() ) )
-    {
-        // This is NOT the correct way to get replay gain tags from MPC files, but
-        // taglib doesn't allow us access to the real information.
-        // This allows people to work around this issue by copying their replay gain
-        // information to the APE tag.
-        if ( file->APETag() )
-            map = readAPETags( file->APETag() );
-    }
-#ifdef TAGLIB_EXTRAS_FOUND
-    else if ( TagLib::ASF::File *file = dynamic_cast<TagLib::ASF::File *>( fileref.file() ) )
-    {
-        if ( file->tag() )
-            map = readASFTags( file->tag() );
-    }
-#endif
-// See comment above
-#ifdef DO_NOT_USE_THIS_UNTIL_FIXED
-    else if ( TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File *>( fileref.file() ) )
-    {
-        if ( file->tag() )
-            map = readMP4Tags( file->getMP4Tag() );
-    }
-#endif
-    return map;
-}
-
diff --git a/utilities/collectionscanner/MetaReplayGain.h b/utilities/collectionscanner/MetaReplayGain.h
deleted file mode 100644
index eba860a..0000000
--- a/utilities/collectionscanner/MetaReplayGain.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-   Copyright (C) 2009 Alex Merry <alex.merry at kdemail.net>
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2
-   of the License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-#ifndef AMAROK_METAREPLAYGAIN_H
-#define AMAROK_METAREPLAYGAIN_H
-
-#include <QMap>
-
-// Taglib
-#include <fileref.h>
-
-/* This file exists (rather than putting the method in MetaUtility.h and
- * MetaUtility.cpp) because we need to share the implementation between
- * amaroklib and amarokcollectionscanner (which doesn't link to amaroklib).
- */
-namespace Meta
-{
-    enum ReplayGainTag
-    {
-        ReplayGain_Track_Gain,
-        ReplayGain_Track_Peak,
-        ReplayGain_Album_Gain,
-        ReplayGain_Album_Peak
-    };
-
-    typedef QMap<ReplayGainTag, qreal> ReplayGainTagMap;
-
-    /**
-     * Reads the replay gain tags from a taglib file.
-     */
-    ReplayGainTagMap readReplayGainTags( TagLib::FileRef fileref );
-}
-
-#endif // AMAROK_METAREPLAYGAIN_H


Index: amarok.spec
===================================================================
RCS file: /cvs/pkgs/rpms/amarok/F-12/amarok.spec,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -p -r1.162 -r1.163
--- amarok.spec	14 Sep 2009 20:51:03 -0000	1.162
+++ amarok.spec	17 Sep 2009 19:03:37 -0000	1.163
@@ -2,7 +2,7 @@
 Name:    amarok
 Summary: Media player
 Version: 2.1.85
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 Group: 	 Applications/Multimedia
 License: GPLv2+
@@ -13,6 +13,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version
 Patch50: amarok-2.0.90-qtscript_not_required.patch
 
 ## upstream patches
+Patch100: amarok-taglib.patch
 
 BuildRequires: curl-devel
 BuildRequires: desktop-file-utils
@@ -31,8 +32,8 @@ BuildRequires: libxml2-devel
 BuildRequires: loudmouth-devel
 BuildRequires: mysql-embedded-devel
 BuildRequires: soprano-devel
-BuildRequires: taglib-devel
-BuildRequires: taglib-extras-devel
+BuildRequires: taglib-devel >= 1.6
+BuildRequires: taglib-extras-devel >= 1.0.0
 
 %global kdelibs4_version %((kde4-config --version 2>/dev/null || echo KDE 4.2.0) | grep '^KDE' | cut -d' ' -f2 | cut -d'-' -f1)
 %{?_qt4_version:Requires: qt4%{?_isa} >= %{_qt4_version}}
@@ -78,6 +79,8 @@ Obsoletes: amarok-utilities < 2.0.96
 
 %patch50 -p1 -b .qtscript_not_required
 
+%patch100 -p1 -b .taglib
+
 
 %build
 mkdir -p %{_target_platform}
@@ -168,6 +171,9 @@ fi
 
 
 %changelog
+* Thu Sep 17 2009 Rex Dieter <rdieter at fedoraproject.org> 2.1.85-2
+- BR: taglib-devel >= 1.6, taglib-extras-devel >= 1.0
+
 * Mon Sep 14 2009 Rex Dieter <rdieter at fedoraproject.org> 2.1.85-1
 - amarok-2.1.85 (2.2beta2)
 




More information about the fedora-extras-commits mailing list