--- /dev/null
+extern "C" {
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+};
+
+#include <attachedpictureframe.h>
+#include <id3v2tag.h>
+#include <mpegfile.h>
+
+int main(int argc, char *argv[])
+{
+ struct stat st;
+ stat(argv[2], &st);
+ int fd = open(argv[2], O_RDONLY);
+ char *m = (char *)malloc(st.st_size);
+ read(fd, m, st.st_size);
+
+ TagLib::MPEG::File f(argv[1]);
+ TagLib::ID3v2::AttachedPictureFrame p;
+ p.setMimeType("image/jpeg");
+ p.setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
+ TagLib::ByteVector bv;
+ bv.setData(m, st.st_size);
+ p.setPicture(bv);
+ TagLib::ID3v2::Tag *t = f.ID3v2Tag(true);
+ t->addFrame(&p);
+ f.save();
+ return 0;
+}