[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/taglib/taglib/riff
From:       Lukáš Lalinský <lalinsky () gmail ! com>
Date:       2010-08-24 15:49:47
Message-ID: 20100824154947.8C907AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1167432 by lalinsky:

Added information about the number of bits per sample in WAVE and AIFF files

Patch by Stephen F. Booth


 M  +10 -3     aiff/aiffproperties.cpp  
 M  +2 -0      aiff/aiffproperties.h  
 M  +8 -0      wav/wavproperties.cpp  
 M  +2 -0      wav/wavproperties.h  


--- trunk/kdesupport/taglib/taglib/riff/aiff/aiffproperties.cpp #1167431:1167432
@@ -84,7 +84,8 @@
     length(0),
     bitrate(0),
     sampleRate(0),
-    channels(0)
+    channels(0),
+    sampleWidth(0)
   {
 
   }
@@ -93,6 +94,7 @@
   int bitrate;
   int sampleRate;
   int channels;
+  int sampleWidth;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -130,6 +132,11 @@
   return d->channels;
 }
 
+int RIFF::AIFF::Properties::sampleWidth() const
+{
+  return d->sampleWidth;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
@@ -138,9 +145,9 @@
 {
   d->channels       = data.mid(0, 2).toShort();
   uint sampleFrames = data.mid(2, 4).toUInt();
-  short sampleSize  = data.mid(6, 2).toShort();
+  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 * sampleSize * d->channels) / 1024.0;
+  d->bitrate        = (sampleRate * d->sampleWidth * d->channels) / 1024.0;
   d->length         = sampleFrames / d->sampleRate;
 }
--- trunk/kdesupport/taglib/taglib/riff/aiff/aiffproperties.h #1167431:1167432
@@ -64,6 +64,8 @@
 	virtual int sampleRate() const;
 	virtual int channels() const;
 
+	int sampleWidth() const;
+
       private:
 	Properties(const Properties &);
 	Properties &operator=(const Properties &);
--- trunk/kdesupport/taglib/taglib/riff/wav/wavproperties.cpp #1167431:1167432
@@ -41,6 +41,7 @@
     bitrate(0),
     sampleRate(0),
     channels(0),
+    sampleWidth(0),
 	streamLength(streamLength)
   {
 
@@ -51,6 +52,7 @@
   int bitrate;
   int sampleRate;
   int channels;
+  int sampleWidth;
   uint streamLength;
 };
 
@@ -95,6 +97,11 @@
   return d->channels;
 }
 
+int RIFF::WAV::Properties::sampleWidth() const
+{
+  return d->sampleWidth;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
@@ -104,6 +111,7 @@
   d->format = data.mid(0, 2).toShort(false);
   d->channels = data.mid(2, 2).toShort(false);
   d->sampleRate = data.mid(4, 4).toUInt(false);
+  d->sampleWidth = data.mid(14, 2).toShort(false);
 
   uint byteRate = data.mid(8, 4).toUInt(false);
   d->bitrate = byteRate * 8 / 1024;
--- trunk/kdesupport/taglib/taglib/riff/wav/wavproperties.h #1167431:1167432
@@ -73,6 +73,8 @@
 	virtual int sampleRate() const;
 	virtual int channels() const;
 
+	int sampleWidth() const;
+
       private:
 	Properties(const Properties &);
 	Properties &operator=(const Properties &);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic