]> diplodocus.org Git - flac-archive/commitdiff
some cleanup
author <epg@pretzelnet.org> <>
Sun, 8 Dec 2013 23:19:20 +0000 (15:19 -0800)
committer <epg@pretzelnet.org> <>
Sun, 8 Dec 2013 23:19:20 +0000 (15:19 -0800)
apic-read.cc

index fd83ac8a1e3ffb87fb91b95a9658ce20b891226d..194e3406eb219556d8107e962214dd0646d8b7ec 100644 (file)
 
 // some demo apic reading code; would be nice to save all APIC frames.
 
+using TagLib::ID3v2::Tag;
+using TagLib::ID3v2::FrameList;
+using TagLib::ID3v2::AttachedPictureFrame;
+
 int
 main(int argc, char **argv)
 {
     const char *mp3_path = argv[1];
     TagLib::MPEG::File f(mp3_path);
-    TagLib::ID3v2::Tag *id3v2tag = f.ID3v2Tag();
+    Tag *id3v2tag = f.ID3v2Tag();
     if (!id3v2tag) {
         return 0;
     }
-    TagLib::ID3v2::FrameList::ConstIterator it;
-    for (it = id3v2tag->frameList().begin();
-         it != id3v2tag->frameList().end();
-         it++) {
+    const FrameList &frames = id3v2tag->frameList();
+    FrameList::ConstIterator it;
+    for (it = frames.begin(); it != frames.end(); it++) {
         TagLib::ByteVector frameid = (*it)->frameID();
         uint frameid_size = frameid.size();
         char *frameid_s = new char[frameid_size + 1];
@@ -34,8 +37,7 @@ main(int argc, char **argv)
         if (frameid != "APIC") {
             continue;
         }
-        TagLib::ID3v2::AttachedPictureFrame *frame =
-            (TagLib::ID3v2::AttachedPictureFrame *)(*it);
+        AttachedPictureFrame *frame = (AttachedPictureFrame *)(*it);
         TagLib::ByteVector data = frame->picture();
         int fd = open(argv[2], O_CREAT | O_WRONLY);
         ssize_t size = data.size();