Ejemplo n.º 1
0
 void testSetYear()
 {
   Ogg::XiphComment cmt;
   cmt.addField("YEAR", "2009");
   cmt.addField("DATE", "2008");
   cmt.setYear(1995);
   CPPUNIT_ASSERT(cmt.fieldListMap()["YEAR"].isEmpty());
   CPPUNIT_ASSERT_EQUAL(String("1995"), cmt.fieldListMap()["DATE"].front());
 }
Ejemplo n.º 2
0
 void testSetTrack()
 {
   Ogg::XiphComment cmt;
   cmt.addField("TRACKNUM", "7");
   cmt.addField("TRACKNUMBER", "8");
   cmt.setTrack(3);
   CPPUNIT_ASSERT(cmt.fieldListMap()["TRACKNUM"].isEmpty());
   CPPUNIT_ASSERT_EQUAL(String("3"), cmt.fieldListMap()["TRACKNUMBER"].front());
 }
Ejemplo n.º 3
0
void VorbisReader::read()
{
	std::auto_ptr<Ogg::File> of;
	Ogg::XiphComment *tag;

	switch(mType) {
		case ReaderSelector::OGG_FLAC:
			of.reset(new Ogg::FLAC::File(mValues["file"].c_str()));
			break;

		default:
			of.reset(new Ogg::Vorbis::File(mValues["file"].c_str()));
			break;
	}

	tag = (Ogg::XiphComment *)of.get()->tag();

	if(tag) {
		const Ogg::FieldListMap *flm = &tag->fieldListMap();

		std::map<std::string, std::string>::iterator it =
				sMapping.begin();

		const StringList *sl;

		while(it != sMapping.end()) {

			sl = &(*flm)[sMapping[it->first]];

			if(!sl->isEmpty()) {
				mValues[it->first.c_str()] = (*sl)[0].toCString(true);
			}

			++it;
		}
	} else {
		mErr = 1;
	}

	int len;
	char buff[16];
	if(of->audioProperties()) {
		len = of->audioProperties()->length();
		sprintf(buff, "%d", len);
		mValues["length"] = buff;
	}
}