コード例 #1
0
int main(int argc, char **argv) {
  if (argc != 2) {
    std::cout << "usage: " << argv[0] << " file.mp3" << std::endl;
    exit(1);
  }
  char *filename = argv[1];

  Vorbis::File file(filename);
  Ogg::XiphComment *tag = file.tag();

  tag->setTitle("Title");
  tag->setArtist("Artist");
  tag->setAlbum("Album");
  tag->setComment("Comment");
  tag->setGenre("Pop");
  tag->setYear(2011);
  tag->setTrack(7);

  tag->addField("VERSION", "original");
  tag->addField("PERFORMER", "Performer");
  tag->addField("COPYRIGHT", "2011 Me, myself and I");
  tag->addField("LICENSE", "Any Use Permitted");
  tag->addField("ORGANIZATION", "Organization");
  tag->addField("DESCRIPTION", "Test file");
  tag->addField("LOCATION", "Earth");
  tag->addField("CONTACT", "Contact");

  tag->addField("MULTIPLE", "A");
  tag->addField("MULTIPLE", "B", false);

  file.save();
}
コード例 #2
0
ファイル: test_xiphcomment.cpp プロジェクト: DiodeZ/taglib
 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());
 }