diff options
author | Chris Roberts <croberts@bongle.co.uk> | 2012-07-13 01:49:00 +0800 |
---|---|---|
committer | Chris Roberts <croberts@bongle.co.uk> | 2012-09-10 19:30:40 +0800 |
commit | 6fec2a5a93985a85435fa46f095afc382a94519f (patch) | |
tree | 6e76452d591484d774520285e21a8420bb5cb291 | |
parent | 50e896d9d27cc775a65ed860c10df44f171b0e2d (diff) |
[tags+replaygain] Make ReplayGain normal tags in CMusicInfoTag - we have to read all the tags to get the data anyway.
-rw-r--r-- | XBMC.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | xbmc/cores/paplayer/AudioDecoder.cpp | 24 | ||||
-rw-r--r-- | xbmc/cores/paplayer/FLACcodec.cpp | 4 | ||||
-rw-r--r-- | xbmc/cores/paplayer/ICodec.h | 4 | ||||
-rw-r--r-- | xbmc/cores/paplayer/MP3codec.cpp | 6 | ||||
-rw-r--r-- | xbmc/cores/paplayer/OGGcodec.cpp | 4 | ||||
-rw-r--r-- | xbmc/cores/paplayer/ReplayGain.cpp | 58 | ||||
-rw-r--r-- | xbmc/cores/paplayer/ReplayGain.h | 44 | ||||
-rw-r--r-- | xbmc/music/tags/MusicInfoTag.cpp | 60 | ||||
-rw-r--r-- | xbmc/music/tags/MusicInfoTag.h | 20 | ||||
-rw-r--r-- | xbmc/music/tags/TagLoaderTagLib.cpp | 36 | ||||
-rw-r--r-- | xbmc/music/tags/TagLoaderTagLib.h | 3 |
12 files changed, 111 insertions, 158 deletions
diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index cdd45bb6aa..d11d7ca17c 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -538,7 +538,6 @@ E38E1FCF0D25F9FD00618676 /* MP3codec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16130D25F9FA00618676 /* MP3codec.cpp */; }; E38E1FD10D25F9FD00618676 /* NSFCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E161B0D25F9FA00618676 /* NSFCodec.cpp */; }; E38E1FD20D25F9FD00618676 /* OGGcodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16230D25F9FA00618676 /* OGGcodec.cpp */; }; - E38E1FD70D25F9FD00618676 /* ReplayGain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E162A0D25F9FA00618676 /* ReplayGain.cpp */; }; E38E1FD90D25F9FD00618676 /* SIDCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16310D25F9FA00618676 /* SIDCodec.cpp */; }; E38E1FDA0D25F9FD00618676 /* SPCCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16350D25F9FA00618676 /* SPCCodec.cpp */; }; E38E1FDB0D25F9FD00618676 /* TimidityCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16370D25F9FA00618676 /* TimidityCodec.cpp */; }; @@ -2222,8 +2221,6 @@ E38E161C0D25F9FA00618676 /* NSFCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSFCodec.h; sourceTree = "<group>"; }; E38E16230D25F9FA00618676 /* OGGcodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OGGcodec.cpp; sourceTree = "<group>"; }; E38E16240D25F9FA00618676 /* OGGcodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGGcodec.h; sourceTree = "<group>"; }; - E38E162A0D25F9FA00618676 /* ReplayGain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplayGain.cpp; sourceTree = "<group>"; }; - E38E162B0D25F9FA00618676 /* ReplayGain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplayGain.h; sourceTree = "<group>"; }; E38E16310D25F9FA00618676 /* SIDCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SIDCodec.cpp; sourceTree = "<group>"; }; E38E16320D25F9FA00618676 /* SIDCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SIDCodec.h; sourceTree = "<group>"; }; E38E16350D25F9FA00618676 /* SPCCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SPCCodec.cpp; sourceTree = "<group>"; }; @@ -5154,8 +5151,6 @@ F5987FD90FBE2DFD008EF4FB /* PAPlayer.h */, 7CCFD98A151494E100211D82 /* PCMCodec.cpp */, 7CCFD98B151494E100211D82 /* PCMCodec.h */, - E38E162A0D25F9FA00618676 /* ReplayGain.cpp */, - E38E162B0D25F9FA00618676 /* ReplayGain.h */, E38E16310D25F9FA00618676 /* SIDCodec.cpp */, E38E16320D25F9FA00618676 /* SIDCodec.h */, E38E16350D25F9FA00618676 /* SPCCodec.cpp */, @@ -6708,7 +6703,6 @@ E38E1FCF0D25F9FD00618676 /* MP3codec.cpp in Sources */, E38E1FD10D25F9FD00618676 /* NSFCodec.cpp in Sources */, E38E1FD20D25F9FD00618676 /* OGGcodec.cpp in Sources */, - E38E1FD70D25F9FD00618676 /* ReplayGain.cpp in Sources */, E38E1FD90D25F9FD00618676 /* SIDCodec.cpp in Sources */, E38E1FDA0D25F9FD00618676 /* SPCCodec.cpp in Sources */, E38E1FDB0D25F9FD00618676 /* TimidityCodec.cpp in Sources */, diff --git a/xbmc/cores/paplayer/AudioDecoder.cpp b/xbmc/cores/paplayer/AudioDecoder.cpp index 94e376db2a..10d55058fa 100644 --- a/xbmc/cores/paplayer/AudioDecoder.cpp +++ b/xbmc/cores/paplayer/AudioDecoder.cpp @@ -243,28 +243,28 @@ float CAudioDecoder::GetReplayGain() float peak = 0.0f; if (g_guiSettings.m_replayGain.iType == REPLAY_GAIN_ALBUM) { - if (m_codec->m_replayGain.iHasGainInfo & REPLAY_GAIN_HAS_ALBUM_INFO) + if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_ALBUM_INFO) { - replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_replayGain.iAlbumGain * 0.01f; - peak = m_codec->m_replayGain.fAlbumPeak; + replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_tag.GetReplayGainAlbumGain() * 0.01f; + peak = m_codec->m_tag.GetReplayGainAlbumPeak(); } - else if (m_codec->m_replayGain.iHasGainInfo & REPLAY_GAIN_HAS_TRACK_INFO) + else if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_TRACK_INFO) { - replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_replayGain.iTrackGain * 0.01f; - peak = m_codec->m_replayGain.fTrackPeak; + replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_tag.GetReplayGainTrackGain() * 0.01f; + peak = m_codec->m_tag.GetReplayGainTrackPeak(); } } else if (g_guiSettings.m_replayGain.iType == REPLAY_GAIN_TRACK) { - if (m_codec->m_replayGain.iHasGainInfo & REPLAY_GAIN_HAS_TRACK_INFO) + if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_TRACK_INFO) { - replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_replayGain.iTrackGain * 0.01f; - peak = m_codec->m_replayGain.fTrackPeak; + replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_tag.GetReplayGainTrackGain() * 0.01f; + peak = m_codec->m_tag.GetReplayGainTrackPeak(); } - else if (m_codec->m_replayGain.iHasGainInfo & REPLAY_GAIN_HAS_ALBUM_INFO) + else if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_ALBUM_INFO) { - replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_replayGain.iAlbumGain * 0.01f; - peak = m_codec->m_replayGain.fAlbumPeak; + replaydB = (float)g_guiSettings.m_replayGain.iPreAmp + (float)m_codec->m_tag.GetReplayGainAlbumGain() * 0.01f; + peak = m_codec->m_tag.GetReplayGainAlbumPeak(); } } // convert to a gain type diff --git a/xbmc/cores/paplayer/FLACcodec.cpp b/xbmc/cores/paplayer/FLACcodec.cpp index 49b5010b97..e0f3954cc6 100644 --- a/xbmc/cores/paplayer/FLACcodec.cpp +++ b/xbmc/cores/paplayer/FLACcodec.cpp @@ -58,9 +58,7 @@ bool FLACCodec::Init(const CStdString &strFile, unsigned int filecache) // Extract ReplayGain info CTagLoaderTagLib tagLoaderTagLib(strFile); - CMusicInfoTag tag; - tagLoaderTagLib.Load(strFile, tag); - tagLoaderTagLib.GetReplayGain(m_replayGain); + tagLoaderTagLib.Load(strFile, m_tag); m_pFlacDecoder=m_dll.FLAC__stream_decoder_new(); diff --git a/xbmc/cores/paplayer/ICodec.h b/xbmc/cores/paplayer/ICodec.h index d11a128538..8a41279145 100644 --- a/xbmc/cores/paplayer/ICodec.h +++ b/xbmc/cores/paplayer/ICodec.h @@ -20,9 +20,9 @@ * */ -#include "ReplayGain.h" #include "utils/StdString.h" #include "filesystem/File.h" +#include "music/tags/MusicInfoTag.h" #include "cores/AudioEngine/AEAudioFormat.h" @@ -104,7 +104,7 @@ public: enum AEDataFormat m_DataFormat; int m_Bitrate; CStdString m_CodecName; - CReplayGain m_replayGain; + MUSIC_INFO::CMusicInfoTag m_tag; XFILE::CFile m_file; protected: diff --git a/xbmc/cores/paplayer/MP3codec.cpp b/xbmc/cores/paplayer/MP3codec.cpp index d6b2542622..93618aa61f 100644 --- a/xbmc/cores/paplayer/MP3codec.cpp +++ b/xbmc/cores/paplayer/MP3codec.cpp @@ -168,7 +168,6 @@ bool MP3Codec::Init(const CStdString &strFile, unsigned int filecache) int64_t length = 0; bool bTags = false; - CMusicInfoTag musicInfoTag; CTagLoaderTagLib tagLoaderTagLib(strFile); if (!m_file.Open(strFile, READ_CACHED)) @@ -178,12 +177,9 @@ bool MP3Codec::Init(const CStdString &strFile, unsigned int filecache) } // Guess Bitrate and obtain replayGain information etc. - bTags = tagLoaderTagLib.Load(strFile, musicInfoTag); + bTags = tagLoaderTagLib.Load(strFile, m_tag); if (bTags) - { - tagLoaderTagLib.GetReplayGain(m_replayGain); ReadDuration(); - } length = m_file.GetLength(); if (bTags) diff --git a/xbmc/cores/paplayer/OGGcodec.cpp b/xbmc/cores/paplayer/OGGcodec.cpp index 0b083cf9ed..df9423ab9f 100644 --- a/xbmc/cores/paplayer/OGGcodec.cpp +++ b/xbmc/cores/paplayer/OGGcodec.cpp @@ -136,9 +136,7 @@ bool OGGCodec::Init(const CStdString &strFile1, unsigned int filecache) if (pComments) { CTagLoaderTagLib tagLoaderTagLib(strFile); - CMusicInfoTag tag; - tagLoaderTagLib.Load(strFile, tag); - tagLoaderTagLib.GetReplayGain(m_replayGain); + tagLoaderTagLib.Load(strFile, m_tag); } // Seek to the logical bitstream to play diff --git a/xbmc/cores/paplayer/ReplayGain.cpp b/xbmc/cores/paplayer/ReplayGain.cpp deleted file mode 100644 index 6777a21023..0000000000 --- a/xbmc/cores/paplayer/ReplayGain.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * 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, 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 XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "ReplayGain.h" - -CReplayGain::CReplayGain() -{ - iTrackGain = 0; - iAlbumGain = 0; - fTrackPeak = 0.0f; - fAlbumPeak = 0.0f; - iHasGainInfo = 0; -} - -CReplayGain::~CReplayGain() -{ -} - -void CReplayGain::SetTrackGain(int trackGain) -{ - iTrackGain = trackGain; - iHasGainInfo |= REPLAY_GAIN_HAS_TRACK_INFO; -} - -void CReplayGain::SetAlbumGain(int albumGain) -{ - iTrackGain = albumGain; - iHasGainInfo |= REPLAY_GAIN_HAS_ALBUM_INFO; -} - -void CReplayGain::SetTrackPeak(float trackPeak) -{ - fTrackPeak = trackPeak; - iHasGainInfo |= REPLAY_GAIN_HAS_TRACK_PEAK; -} - -void CReplayGain::SetAlbumPeak(float albumPeak) -{ - fAlbumPeak = albumPeak; - iHasGainInfo |= REPLAY_GAIN_HAS_ALBUM_PEAK; -} diff --git a/xbmc/cores/paplayer/ReplayGain.h b/xbmc/cores/paplayer/ReplayGain.h deleted file mode 100644 index 7702d07497..0000000000 --- a/xbmc/cores/paplayer/ReplayGain.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * 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, 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 XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#define REPLAY_GAIN_HAS_TRACK_INFO 1 -#define REPLAY_GAIN_HAS_ALBUM_INFO 2 -#define REPLAY_GAIN_HAS_TRACK_PEAK 4 -#define REPLAY_GAIN_HAS_ALBUM_PEAK 8 - -class CReplayGain -{ -public: - CReplayGain(); - ~CReplayGain(); - - void SetTrackGain(int trackGain); - void SetAlbumGain(int albumGain); - void SetTrackPeak(float trackPeak); - void SetAlbumPeak(float albumPeak); - - int iTrackGain; // measured in milliBels - int iAlbumGain; - float fTrackPeak; // 1.0 == full digital scale - float fAlbumPeak; - int iHasGainInfo; // valid info -}; diff --git a/xbmc/music/tags/MusicInfoTag.cpp b/xbmc/music/tags/MusicInfoTag.cpp index ad2f6f199a..000bd8937c 100644 --- a/xbmc/music/tags/MusicInfoTag.cpp +++ b/xbmc/music/tags/MusicInfoTag.cpp @@ -107,6 +107,12 @@ const CMusicInfoTag& CMusicInfoTag::operator =(const CMusicInfoTag& tag) m_iDbId = tag.m_iDbId; m_type = tag.m_type; m_iAlbumId = tag.m_iAlbumId; + m_iTrackGain = tag.m_iTrackGain; + m_iAlbumGain = tag.m_iAlbumGain; + m_fTrackPeak = tag.m_fTrackPeak; + m_fAlbumPeak = tag.m_fAlbumPeak; + m_iHasGainInfo = tag.m_iHasGainInfo; + memcpy(&m_dwReleaseDate, &tag.m_dwReleaseDate, sizeof(m_dwReleaseDate) ); m_coverArt = tag.m_coverArt; return *this; @@ -253,6 +259,31 @@ const EmbeddedArtInfo &CMusicInfoTag::GetCoverArtInfo() const return m_coverArt; } +int CMusicInfoTag::GetReplayGainTrackGain() const +{ + return m_iTrackGain; +} + +int CMusicInfoTag::GetReplayGainAlbumGain() const +{ + return m_iAlbumGain; +} + +float CMusicInfoTag::GetReplayGainTrackPeak() const +{ + return m_fTrackPeak; +} + +float CMusicInfoTag::GetReplayGainAlbumPeak() const +{ + return m_fAlbumPeak; +} + +int CMusicInfoTag::HasReplayGainInfo() const +{ + return m_iHasGainInfo; +} + void CMusicInfoTag::SetURL(const CStdString& strURL) { m_strURL = strURL; @@ -454,6 +485,30 @@ void CMusicInfoTag::SetCoverArtInfo(size_t size, const std::string &mimeType) m_coverArt.set(size, mimeType); } +void CMusicInfoTag::SetReplayGainTrackGain(int trackGain) +{ + m_iTrackGain = trackGain; + m_iHasGainInfo |= REPLAY_GAIN_HAS_TRACK_INFO; +} + +void CMusicInfoTag::SetReplayGainAlbumGain(int albumGain) +{ + m_iTrackGain = albumGain; + m_iHasGainInfo |= REPLAY_GAIN_HAS_ALBUM_INFO; +} + +void CMusicInfoTag::SetReplayGainTrackPeak(float trackPeak) +{ + m_fTrackPeak = trackPeak; + m_iHasGainInfo |= REPLAY_GAIN_HAS_TRACK_PEAK; +} + +void CMusicInfoTag::SetReplayGainAlbumPeak(float albumPeak) +{ + m_fAlbumPeak = albumPeak; + m_iHasGainInfo |= REPLAY_GAIN_HAS_ALBUM_PEAK; +} + void CMusicInfoTag::SetAlbum(const CAlbum& album) { SetArtist(album.artist); @@ -623,6 +678,11 @@ void CMusicInfoTag::Clear() memset(&m_dwReleaseDate, 0, sizeof(m_dwReleaseDate) ); m_iAlbumId = -1; m_coverArt.clear(); + m_iTrackGain = 0; + m_iAlbumGain = 0; + m_fTrackPeak = 0.0f; + m_fAlbumPeak = 0.0f; + m_iHasGainInfo = 0; } void CMusicInfoTag::AppendArtist(const CStdString &artist) diff --git a/xbmc/music/tags/MusicInfoTag.h b/xbmc/music/tags/MusicInfoTag.h index ab1dff3028..c99766bd56 100644 --- a/xbmc/music/tags/MusicInfoTag.h +++ b/xbmc/music/tags/MusicInfoTag.h @@ -32,6 +32,11 @@ class CAlbum; #include "utils/ISortable.h" #include "XBDateTime.h" +#define REPLAY_GAIN_HAS_TRACK_INFO 1 +#define REPLAY_GAIN_HAS_ALBUM_INFO 2 +#define REPLAY_GAIN_HAS_TRACK_PEAK 4 +#define REPLAY_GAIN_HAS_ALBUM_PEAK 8 + namespace MUSIC_INFO { class EmbeddedArtInfo @@ -95,6 +100,11 @@ public: int GetListeners() const; int GetPlayCount() const; const EmbeddedArtInfo &GetCoverArtInfo() const; + int GetReplayGainTrackGain() const; + int GetReplayGainAlbumGain() const; + float GetReplayGainTrackPeak() const; + float GetReplayGainAlbumPeak() const; + int HasReplayGainInfo() const; void SetURL(const CStdString& strURL); void SetTitle(const CStdString& strTitle); @@ -130,6 +140,10 @@ public: void SetLastPlayed(const CDateTime& strLastPlayed); void SetCompilation(bool compilation); void SetCoverArtInfo(size_t size, const std::string &mimeType); + void SetReplayGainTrackGain(int trackGain); + void SetReplayGainAlbumGain(int albumGain); + void SetReplayGainTrackPeak(float trackPeak); + void SetReplayGainAlbumPeak(float albumPeak); /*! \brief Append a unique artist to the artist list Checks if we have this artist already added, and if not adds it to the songs artist list. @@ -187,6 +201,12 @@ protected: int m_iAlbumId; SYSTEMTIME m_dwReleaseDate; + // ReplayGain + int m_iTrackGain; // measured in milliBels + int m_iAlbumGain; + float m_fTrackPeak; // 1.0 == full digital scale + float m_fAlbumPeak; + int m_iHasGainInfo; // valid info EmbeddedArtInfo m_coverArt; ///< art information }; } diff --git a/xbmc/music/tags/TagLoaderTagLib.cpp b/xbmc/music/tags/TagLoaderTagLib.cpp index 0d591b737c..1e10e85239 100644 --- a/xbmc/music/tags/TagLoaderTagLib.cpp +++ b/xbmc/music/tags/TagLoaderTagLib.cpp @@ -292,13 +292,13 @@ bool CTagLoaderTagLib::ParseID3v2Tag(ID3v2::Tag *id3v2, EmbeddedArt *art, CMusic // First field is the same as the description StringList stringList = frame->fieldList(); stringList.erase(stringList.begin()); - if (frame->description() == "MusicBrainz Artist Id") tag.SetMusicBrainzArtistID(stringList.front().toCString()); - else if (frame->description() == "MusicBrainz Album Id") tag.SetMusicBrainzAlbumID(stringList.front().toCString()); + if (frame->description() == "MusicBrainz Artist Id") tag.SetMusicBrainzArtistID(stringList.front().toCString()); + else if (frame->description() == "MusicBrainz Album Id") tag.SetMusicBrainzAlbumID(stringList.front().toCString()); else if (frame->description() == "MusicBrainz Album Artist Id") tag.SetMusicBrainzAlbumArtistID(stringList.front().toCString()); - else if (frame->description() == "replaygain_track_gain") m_rg.SetTrackGain(atof(stringList.front().toCString()) * 100 + 0.5); - else if (frame->description() == "replaygain_album_gain") m_rg.SetAlbumGain(atof(stringList.front().toCString()) * 100 + 0.5); - else if (frame->description() == "replaygain_track_peak") m_rg.SetTrackPeak(atof(stringList.front().toCString())); - else if (frame->description() == "replaygain_album_peak") m_rg.SetAlbumPeak(atof(stringList.front().toCString())); + else if (frame->description() == "replaygain_track_gain") tag.SetReplayGainTrackGain(atof(stringList.front().toCString()) * 100 + 0.5); + else if (frame->description() == "replaygain_album_gain") tag.SetReplayGainTrackGain(atof(stringList.front().toCString()) * 100 + 0.5); + else if (frame->description() == "replaygain_track_peak") tag.SetReplayGainTrackGain(atof(stringList.front().toCString())); + else if (frame->description() == "replaygain_album_peak") tag.SetReplayGainTrackGain(atof(stringList.front().toCString())); else CLog::Log(LOGDEBUG, "unrecognized user text tag detected: TXXX:%s", frame->description().toCString()); } @@ -388,10 +388,10 @@ bool CTagLoaderTagLib::ParseAPETag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTa else if (it->first == "ENCODEDBY") {} else if (it->first == "COMPILATION") tag.SetCompilation(it->second.toString().toInt() == 1); else if (it->first == "LYRICS") tag.SetLyrics(it->second.toString().toCString()); - else if (it->first == "REPLAYGAIN_TRACK_GAIN") m_rg.SetTrackGain((int)(atof(it->second.toString().toCString()) * 100 + 0.5)); - else if (it->first == "REPLAYGAIN_ALBUM_GAIN") m_rg.SetAlbumGain((int)(atof(it->second.toString().toCString()) * 100 + 0.5)); - else if (it->first == "REPLAYGAIN_TRACK_PEAK") m_rg.SetTrackPeak((float)atof(it->second.toString().toCString())); - else if (it->first == "REPLAYGAIN_ALBUM_PEAK") m_rg.SetAlbumPeak((float)atof(it->second.toString().toCString())); + else if (it->first == "REPLAYGAIN_TRACK_GAIN") tag.SetReplayGainTrackGain((int)(atof(it->second.toString().toCString()) * 100 + 0.5)); + else if (it->first == "REPLAYGAIN_ALBUM_GAIN") tag.SetReplayGainTrackGain((int)(atof(it->second.toString().toCString()) * 100 + 0.5)); + else if (it->first == "REPLAYGAIN_TRACK_PEAK") tag.SetReplayGainTrackGain((float)atof(it->second.toString().toCString())); + else if (it->first == "REPLAYGAIN_ALBUM_PEAK") tag.SetReplayGainTrackGain((float)atof(it->second.toString().toCString())); else if (it->first == "MUSICBRAINZ_ARTISTID") tag.SetMusicBrainzArtistID(it->second.toString().toCString()); else if (it->first == "MUSICBRAINZ_ALBUMARTISTID") tag.SetMusicBrainzAlbumArtistID(it->second.toString().toCString()); else if (it->first == "MUSICBRAINZ_ALBUMID") tag.SetMusicBrainzAlbumID(it->second.toString().toCString()); @@ -423,10 +423,10 @@ bool CTagLoaderTagLib::ParseXiphComment(Ogg::XiphComment *xiph, EmbeddedArt *art else if (it->first == "ENCODEDBY") {} else if (it->first == "COMPILATION") tag.SetCompilation(it->second.front().toInt() == 1); else if (it->first == "LYRICS") tag.SetLyrics(it->second.front().toCString()); - else if (it->first == "REPLAYGAIN_TRACK_GAIN") m_rg.SetTrackGain((int)(atof(it->second.front().toCString()) * 100 + 0.5)); - else if (it->first == "REPLAYGAIN_ALBUM_GAIN") m_rg.SetAlbumGain((int)(atof(it->second.front().toCString()) * 100 + 0.5)); - else if (it->first == "REPLAYGAIN_TRACK_PEAK") m_rg.SetTrackPeak((float)atof(it->second.front().toCString())); - else if (it->first == "REPLAYGAIN_ALBUM_PEAK") m_rg.SetAlbumPeak((float)atof(it->second.front().toCString())); + else if (it->first == "REPLAYGAIN_TRACK_GAIN") tag.SetReplayGainTrackGain((int)(atof(it->second.front().toCString()) * 100 + 0.5)); + else if (it->first == "REPLAYGAIN_ALBUM_GAIN") tag.SetReplayGainTrackGain((int)(atof(it->second.front().toCString()) * 100 + 0.5)); + else if (it->first == "REPLAYGAIN_TRACK_PEAK") tag.SetReplayGainTrackGain((float)atof(it->second.front().toCString())); + else if (it->first == "REPLAYGAIN_ALBUM_PEAK") tag.SetReplayGainTrackGain((float)atof(it->second.front().toCString())); else if (it->first == "MUSICBRAINZ_ARTISTID") tag.SetMusicBrainzArtistID(it->second.front().toCString()); else if (it->first == "MUSICBRAINZ_ALBUMARTISTID") tag.SetMusicBrainzAlbumArtistID(it->second.front().toCString()); else if (it->first == "MUSICBRAINZ_ALBUMID") tag.SetMusicBrainzAlbumID(it->second.front().toCString()); @@ -528,11 +528,3 @@ const vector<string> CTagLoaderTagLib::GetID3v2StringList(const ID3v2::FrameList return StringListToVectorString(frame->fieldList()); return vector<string>(); } - -bool CTagLoaderTagLib::GetReplayGain(CReplayGain &info) const -{ - if (!m_rg.iHasGainInfo) - return false; - info = m_rg; - return true; -} diff --git a/xbmc/music/tags/TagLoaderTagLib.h b/xbmc/music/tags/TagLoaderTagLib.h index 547a85e3e1..8bdf5ad60b 100644 --- a/xbmc/music/tags/TagLoaderTagLib.h +++ b/xbmc/music/tags/TagLoaderTagLib.h @@ -44,7 +44,6 @@ #include <taglib/xiphcomment.h> #include <taglib/mp4tag.h> #include "TagLibVFSStream.h" -#include "cores/paplayer/ReplayGain.h" namespace MUSIC_INFO { @@ -58,7 +57,6 @@ public: CTagLoaderTagLib(const std::string& strFileName); virtual ~CTagLoaderTagLib(); virtual bool Load(const std::string& strFileName, MUSIC_INFO::CMusicInfoTag& tag, MUSIC_INFO::EmbeddedArt *art = NULL); - bool GetReplayGain(CReplayGain &info) const; private: bool Open(const std::string& strFileName, bool readOnly); const std::vector<std::string> GetASFStringList(const TagLib::List<TagLib::ASF::Attribute>& list); @@ -71,6 +69,5 @@ private: bool ParseMP4Tag(TagLib::MP4::Tag *mp4, MUSIC_INFO::EmbeddedArt *art, MUSIC_INFO::CMusicInfoTag& tag); bool ParseGenericTag(TagLib::Tag *generic, MUSIC_INFO::EmbeddedArt *art, MUSIC_INFO::CMusicInfoTag& tag); - CReplayGain m_rg; MUSIC_INFO::TagLibVFSStream m_tagLibVFSStream; };
\ No newline at end of file |