Two things:

- 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
This commit is contained in:
Scott Wheeler 2006-03-02 15:02:27 +00:00
parent c35d249195
commit 3a24d31b43
3 changed files with 22 additions and 3 deletions

View 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
////////////////////////////////////////////////////////////////////////////////

View File

@ -131,6 +131,8 @@ namespace TagLib {
*/
void setTextEncoding(String::Type encoding);
static CommentsFrame *findByDescription(const Tag *tag, const String &d);
protected:
// Reimplementations.

View 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