Exemplo n.º 1
0
const std::vector<std::string> CTagLoaderTagLib::GetID3v2StringList(const ID3v2::FrameList& frameList)
{
  const ID3v2::TextIdentificationFrame *frame = dynamic_cast<ID3v2::TextIdentificationFrame *>(frameList.front());
  if (frame)
    return StringListToVectorString(frame->fieldList());
  return std::vector<std::string>();
}
Exemplo n.º 2
0
QMPlay_Tag::QMPlay_Tag( const char *_fileName )
{
	using namespace TagLib;

	fileName = _fileName;
	isNull = true;
	canWriteID3 = false;
	dontUse = false;

	isFLAC = fileName.right( 5 ) == ".flac";
	if ( !isFLAC )
	{
		QByteArray r4 = fileName.right( 4 );
		if ( r4 == ".wav" )
		{
			dontUse = true;
			return;
		}
		if ( r4 == ".mp3" )
			canWriteID3 = true;
	}

	//General tags
	{
		Load_FileRef
		if ( !f->isNull() && f->tag() )
		{
			Tag *tag = f->tag();

			title = tag->title();
			artist = tag->artist();
			album = tag->album();
			comment = tag->comment();
			genre = tag->genre();
			year = tag->year();
			track = tag->track();

			isNull = false;
		}
		delete f;
	}

	//ID3v2 picture
	if ( canWriteID3 )
	{
		Load_MPEG_File
		ID3v2::Tag *id3v2 = f->ID3v2Tag();
		if ( id3v2 && !id3v2->isEmpty() )
		{
			ID3v2::FrameList pict = id3v2->frameList( "APIC" );
			if ( !pict.isEmpty() )
			{
				picture = ID3v2::AttachedPictureFrame( pict.front()->render() ).picture();
				isNull = false;
			}
		}
		delete f;
	}

	//FLAC picture
	if ( isFLAC )
	{
		Load_FLAC_File
		if ( f->pictureList().size() )
		{
			FLAC::Picture *p = f->pictureList().front();
			if ( p )
			{
				picture = p->data();
				isNull = false;
			}
		}
		delete f;
	}
}