예제 #1
2
ByteVector ID3v2::Tag::albumArt(TagLib::ID3v2::AttachedPictureFrame::Type arttype, TagLib::String &mimetype)
{
	if(!d->frameListMap["APIC"].isEmpty()) {
		ID3v2::AttachedPictureFrame *f = (ID3v2::AttachedPictureFrame *)d->frameListMap["APIC"].front();
		mimetype = f->mimeType();
		if(f->type() == arttype) {
			return f->picture();
		} else {
			// do nothing
		}
	} else {
		// do nothing
	}
	return ByteVector();
}
예제 #2
0
 void testCompressedFrameWithBrokenLength()
 {
   MPEG::File f(TEST_FILE_PATH_C("compressed_id3_frame.mp3"), false);
   CPPUNIT_ASSERT(f.ID3v2Tag()->frameListMap().contains("APIC"));
   ID3v2::AttachedPictureFrame *frame =
       static_cast<TagLib::ID3v2::AttachedPictureFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
   CPPUNIT_ASSERT(frame);
   CPPUNIT_ASSERT_EQUAL(String("image/bmp"), frame->mimeType());
   CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::Other, frame->type());
   CPPUNIT_ASSERT_EQUAL(String(""), frame->description());
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(86414), frame->picture().size());
 }
예제 #3
0
  void testParseAPICv22()
  {
    ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();
    ByteVector data = ByteVector("PIC"
                                 "\x00\x00\x08"
                                 "\x00"
                                 "JPG"
                                 "\x01"
                                 "d\x00"
                                 "\x00", 18);
    ID3v2::AttachedPictureFrame *frame =
        static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, TagLib::uint(2)));

    CPPUNIT_ASSERT(frame);
    CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), frame->mimeType());
    CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::FileIcon, frame->type());
    CPPUNIT_ASSERT_EQUAL(String("d"), frame->description());
  }