[id3lib-devel] Writing an id3v2 Tag to an MP3
Brought to you by:
t1mpy
|
From: Jeremy G. <jer...@gm...> - 2011-02-27 05:34:56
|
Hi all,
How do I write an ID3v2 Tag to an MP3? I want to be able to write unicode
characters to my mp3s, but ID3v1.X doesn't support unicode...
I wrote a simple tagging function trying to make a v2 tag, like so:
//The following includes are to make the ID3v2 stuff compile...
#include "id3v2tag.h"
#include "mpegfile.h"
#include <tlist.h>
#include <fileref.h>
#include <tfile.h>
#include <tag.h>
Tag(const wchar_t *path, const wchar_t *title, const wchar_t *artist, const
wchar_t *album, const wchar_t *comment, const wchar_t *genre, const wchar_t
*year, const wchar_t *track)
{// Function takes 8 parameters.
TagLib::FileName fs(path);
TagLib::MPEG::File f(fs);
TagLib::ID3v2::Tag *t = f.ID3v2Tag(true);
TagLib::String tlTitle(title);
t->setTitle(tlTitle);
f.save();
}//END FUNCTION TAG
But it only creates v1 tags, and so if there are unicode characters (like
Japanese, Korean, Chinese, etc), it can't/doesn't write the tag.
How do I force a v2 tag to be written?
|