diff options
author | Mathias Panzenböck <grosser.meister.morti@gmx.net> | 2011-06-26 20:58:32 +0200 |
---|---|---|
committer | Mathias Panzenböck <grosser.meister.morti@gmx.net> | 2011-06-26 20:58:32 +0200 |
commit | 57bf96d169cf1ad00ffe2ae3833f240ebd7d3869 (patch) | |
tree | d943c637fbbf06c5fa71220f4dd0d16ab534179c | |
parent | f3447ae38dfdd17dd9ef6a200f5bbd92baf2a82e (diff) | |
parent | 937d69f91d12615315b743a8da62adb825d97a8d (diff) |
Merge branch 'master' of https://github.com/taglib/taglib
-rw-r--r-- | taglib/riff/aiff/aiffproperties.cpp | 13 | ||||
-rw-r--r-- | taglib/riff/aiff/aiffproperties.h | 1 | ||||
-rw-r--r-- | taglib/riff/wav/wavproperties.cpp | 8 | ||||
-rw-r--r-- | taglib/riff/wav/wavproperties.h | 1 |
4 files changed, 20 insertions, 3 deletions
diff --git a/taglib/riff/aiff/aiffproperties.cpp b/taglib/riff/aiff/aiffproperties.cpp index 77c3d277..c7cbaa34 100644 --- a/taglib/riff/aiff/aiffproperties.cpp +++ b/taglib/riff/aiff/aiffproperties.cpp @@ -85,7 +85,8 @@ public: bitrate(0), sampleRate(0), channels(0), - sampleWidth(0) + sampleWidth(0), + sampleFrames(0) { } @@ -95,6 +96,7 @@ public: int sampleRate; int channels; int sampleWidth; + uint sampleFrames; }; //////////////////////////////////////////////////////////////////////////////// @@ -137,6 +139,11 @@ int RIFF::AIFF::Properties::sampleWidth() const return d->sampleWidth; } +uint RIFF::AIFF::Properties::sampleFrames() const +{ + return d->sampleFrames; +} + //////////////////////////////////////////////////////////////////////////////// // private members //////////////////////////////////////////////////////////////////////////////// @@ -144,10 +151,10 @@ int RIFF::AIFF::Properties::sampleWidth() const void RIFF::AIFF::Properties::read(const ByteVector &data) { d->channels = data.mid(0, 2).toShort(); - uint sampleFrames = data.mid(2, 4).toUInt(); + d->sampleFrames = data.mid(2, 4).toUInt(); d->sampleWidth = data.mid(6, 2).toShort(); double sampleRate = ConvertFromIeeeExtended(reinterpret_cast<unsigned char *>(data.mid(8, 10).data())); d->sampleRate = sampleRate; d->bitrate = (sampleRate * d->sampleWidth * d->channels) / 1000.0; - d->length = sampleFrames / d->sampleRate; + d->length = d->sampleFrames / d->sampleRate; } diff --git a/taglib/riff/aiff/aiffproperties.h b/taglib/riff/aiff/aiffproperties.h index 4c578dc6..ceefe32e 100644 --- a/taglib/riff/aiff/aiffproperties.h +++ b/taglib/riff/aiff/aiffproperties.h @@ -65,6 +65,7 @@ namespace TagLib { virtual int channels() const; int sampleWidth() const; + uint sampleFrames() const; private: Properties(const Properties &); diff --git a/taglib/riff/wav/wavproperties.cpp b/taglib/riff/wav/wavproperties.cpp index 37216860..6c3e2f41 100644 --- a/taglib/riff/wav/wavproperties.cpp +++ b/taglib/riff/wav/wavproperties.cpp @@ -42,6 +42,7 @@ public: sampleRate(0), channels(0), sampleWidth(0), + sampleFrames(0), streamLength(streamLength) { @@ -53,6 +54,7 @@ public: int sampleRate; int channels; int sampleWidth; + uint sampleFrames; uint streamLength; }; @@ -102,6 +104,11 @@ int RIFF::WAV::Properties::sampleWidth() const return d->sampleWidth; } +uint RIFF::WAV::Properties::sampleFrames() const +{ + return d->sampleFrames; +} + //////////////////////////////////////////////////////////////////////////////// // private members //////////////////////////////////////////////////////////////////////////////// @@ -117,4 +124,5 @@ void RIFF::WAV::Properties::read(const ByteVector &data) d->bitrate = byteRate * 8 / 1000; d->length = byteRate > 0 ? d->streamLength / byteRate : 0; + d->sampleFrames = d->streamLength / (d->channels * (d->sampleWidth / 8)); } diff --git a/taglib/riff/wav/wavproperties.h b/taglib/riff/wav/wavproperties.h index bf87ffe2..e75ec0fb 100644 --- a/taglib/riff/wav/wavproperties.h +++ b/taglib/riff/wav/wavproperties.h @@ -74,6 +74,7 @@ namespace TagLib { virtual int channels() const; int sampleWidth() const; + uint sampleFrames() const; private: Properties(const Properties &); |