]> granicus.if.org Git - taglib/commitdiff
Two things:
authorScott Wheeler <wheeler@kde.org>
Thu, 2 Mar 2006 15:02:27 +0000 (15:02 +0000)
committerScott Wheeler <wheeler@kde.org>
Thu, 2 Mar 2006 15:02:27 +0000 (15:02 +0000)
 - Fix the channel mode, copyright and original flags, as noticed by
   Bjoern Petersen.
 - Check in the "findByDescription()" function that I've had sitting
   around for a while.

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@515068 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

mpeg/id3v2/frames/commentsframe.cpp
mpeg/id3v2/frames/commentsframe.h
mpeg/mpegheader.cpp

index 6abcb54ea59465f77ad0026c77d8e4ca02dfc218..0b7faaa19eeed41da79b00892891a5e6a28fec75 100644 (file)
@@ -20,6 +20,7 @@
  ***************************************************************************/
 
 #include <tbytevectorlist.h>
+#include <id3v2tag.h>
 #include <tdebug.h>
 
 #include "commentsframe.h"
@@ -104,6 +105,22 @@ void CommentsFrame::setTextEncoding(String::Type encoding)
   d->textEncoding = encoding;
 }
 
+CommentsFrame *CommentsFrame::findByDescription(const ID3v2::Tag *tag, const String &d) // static
+{
+  ID3v2::FrameList comments = tag->frameList("COMM");
+
+  for(ID3v2::FrameList::ConstIterator it = comments.begin();
+      it != comments.end();
+      ++it)
+  {
+    CommentsFrame *frame = dynamic_cast<CommentsFrame *>(*it);
+    if(frame && frame->description() == d)
+      return frame;
+  }
+
+  return 0;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // protected members
 ////////////////////////////////////////////////////////////////////////////////
index 2c8b2c0036c47a19ca8fe021fc6b5c4d47e17f23..d44cf99772bd5d587062c4e6e828e0a43430fd12 100644 (file)
@@ -131,6 +131,8 @@ namespace TagLib {
        */
       void setTextEncoding(String::Type encoding);
 
+      static CommentsFrame *findByDescription(const Tag *tag, const String &d);
+
     protected:
       // Reimplementations.
 
index eb93db4511616023e81d36192ef008923bca4b2b..f575b02f28a056340d1e50f421ddf82f092a3070 100644 (file)
@@ -233,12 +233,12 @@ void MPEG::Header::parse(const ByteVector &data)
   // The channel mode is encoded as a 2 bit value at the end of the 3nd byte,
   // i.e. xxxxxx11
 
-  d->channelMode = ChannelMode(uchar(data[2]) & 0x3);
+  d->channelMode = ChannelMode((uchar(data[3]) & 0xC0) >> 6);
 
   // TODO: Add mode extension for completeness
 
-  d->isCopyrighted = flags[0];
-  d->isOriginal = flags[1];
+  d->isOriginal = flags[2];
+  d->isCopyrighted = flags[3];
 
   // Calculate the frame length