diff options
author | Uwe Klotz <uwe_klotz@web.de> | 2017-12-05 19:10:19 +0100 |
---|---|---|
committer | Uwe Klotz <uwe_klotz@web.de> | 2017-12-05 19:10:19 +0100 |
commit | e8fc77afe55910aaab379125212c2445048a501f (patch) | |
tree | 79d28c00da1824e06b4c0bfb04b5386f5975cde8 /src/track/trackmetadata.h | |
parent | 84778143a6267e9648ee569ae3e4fceb13463968 (diff) |
Do not consider audio properties when exporting metadata
Diffstat (limited to 'src/track/trackmetadata.h')
-rw-r--r-- | src/track/trackmetadata.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/track/trackmetadata.h b/src/track/trackmetadata.h index 5983d28845..7241e5d7f0 100644 --- a/src/track/trackmetadata.h +++ b/src/track/trackmetadata.h @@ -9,6 +9,18 @@ namespace mixxx { class TrackMetadata final { + // Audio properties + // - read-only + // - stored file tags + // - adjusted by audio decoder AFTER import from file tags + PROPERTY_SET_BYVAL_GET_BYREF(AudioSource::Bitrate, bitrate, Bitrate) + PROPERTY_SET_BYVAL_GET_BYREF(AudioSignal::ChannelCount, channels, Channels) + PROPERTY_SET_BYVAL_GET_BYREF(Duration, duration, Duration) + PROPERTY_SET_BYVAL_GET_BYREF(AudioSignal::SampleRate, sampleRate, SampleRate) + + // Track properties + // - read-write + // - stored in file tags PROPERTY_SET_BYVAL_GET_BYREF(AlbumInfo, albumInfo, AlbumInfo) PROPERTY_SET_BYVAL_GET_BYREF(TrackInfo, trackInfo, TrackInfo) @@ -21,6 +33,16 @@ public: TrackMetadata& operator=(TrackMetadata&&) = default; TrackMetadata& operator=(const TrackMetadata&) = default; + // Compares the contents with metadata that has been freshly imported + // from a file. + bool hasBeenModifiedAfterImport(const TrackMetadata& importedFromFile) const { + // NOTE(uklotzde): The read-only audio properties might differ after + // they have been updated while decoding audio data. They are read-only + // and must not be considered when exporting metadata. + return (getAlbumInfo() != importedFromFile.getAlbumInfo()) || + (getTrackInfo() != importedFromFile.getTrackInfo()); + } + // Parse an format date/time values according to ISO 8601 static QDate parseDate(QString str) { return QDate::fromString(str.trimmed().replace(" ", ""), Qt::ISODate); @@ -43,11 +65,7 @@ public: static QString reformatYear(QString year); }; -inline -bool operator==(const TrackMetadata& lhs, const TrackMetadata& rhs) { - return (lhs.getAlbumInfo() == rhs.getAlbumInfo()) && - (lhs.getTrackInfo() == rhs.getTrackInfo()); -} +bool operator==(const TrackMetadata& lhs, const TrackMetadata& rhs); inline bool operator!=(const TrackMetadata& lhs, const TrackMetadata& rhs) { |