0
0

Hey all, I’ve been searching for days but unfortunately i don’t succeed in writing id3v2 tags in a mp3 file, i have a lot of problems, especially for calculating the tag size, could anyone provide me some help ?
I also checked id3.org, but i don’t understand how to set the id3v2 tag :/

  • You must to post comments
0
0

the size seems to be well calculated, the problem seems to be that i don’t succeed in writing it properly, i really need a hand plz guys
has anyone already written a tagger in C/C++ ?

  • You must to post comments
0
0

show your code, what you don’t understand in writing the tag size ?

  • You must to post comments
0
0

here is my code to calculate the size :
[code:2akciuxr]int CalculateTagSize(id3tagv2 tag)
{
int tagsize=0;
if (AnsiString(tag->track)!="")
{tagsize+=11 + strlen(tag->track);}
if (AnsiString(tag->encodedby)!="")
{tagsize+=11 + strlen(tag->encodedby);}
if (AnsiString(tag->url)!="")
{tagsize+=11 + 1 + 2
strlen(tag->url);}
if (AnsiString(tag->copyright)!="")
{tagsize+=11 + strlen(tag->copyright);}
if (AnsiString(tag->origartist)!="")
{tagsize+=11 + strlen(tag->origartist);}
if (AnsiString(tag->composer)!="")
{tagsize+=11 + strlen(tag->composer);}
if (AnsiString(tag->comment)!="")
{tagsize+=11 + 4 + strlen(tag->comment);}
if (AnsiString(tag->genre)!="")
{tagsize+=11 + strlen(tag->genre);}
if (AnsiString(tag->year)!="")
{tagsize+=11 + strlen(tag->year);}
if (AnsiString(tag->album)!="")
{tagsize+=11 + strlen(tag->album);}
if (AnsiString(tag->artist)!="")
{tagsize+=11 + strlen(tag->artist);}
if (AnsiString(tag->title)!="")
{tagsize+=11 + strlen(tag->title);}
return tagsize;
}[/code:2akciuxr]

The one to convert the size :
[code:2akciuxr]void WriteV2Chiffre(int num,FILE *fp)
{
int taille;
num++;
taille = ( (num & 0xFE00000) << 3) | ( (num & 0x1FC000) << 2)| ( (num & 0x3F80) << 1) | (num & 0x7F);
fputc(((taille & 0xFF000000) >> 24),fp);
fputc(((taille & 0xFF0000) >> 16),fp);
fputc(((taille & 0xFF00) >> 8),fp);
fputc(((taille & 0xFF)),fp);

}[/code:2akciuxr]

  • You must to post comments
0
0

I wrote a crappy idtag reader/writer in purebasic, you can read the sourcecode [url=http://starnetasso.free.fr/Upload/IDTags.pb:1ebq4vuh]here[/url:1ebq4vuh].
You can find a function wich calculate the tag size :)

  • You must to post comments
0
0

I’ll check it, thx a lot :)

  • You must to post comments
0
0

en fait on est ts les deux francais, je viens de voir. Mon programme est en C++ et le purebasic, je m’y perds un peu, est ce que tu peux me dire ce que fait cette ligne là :
[code:3m5rjm68]
m_tailleAEcrire = ( (chiffre & $FE00000) << 3) | ( (chiffre & $1FC000) << 2)| ( (chiffre & $3F80) << 1) | (chiffre & $7F)
[/code:3m5rjm68]

Est ce que les “|” correspondent à des “OU” et les << à des decalages de bits et à quoi correspondent les “&” ?

  • You must to post comments
0
0

We are in an english forum so let’s continue to talk in english 😀
There is no differences between the <<, >>, & and | purebasic commands and the C/C++ ones (left shift, right shift, AND bitwise, OR bitwise).

  • You must to post comments
0
0

thx and sorry for french post
so, if i understand clearly, I shoud use a char * type for the m_taillleAEcrire var, is it ?

  • You must to post comments
0
0

damn i really don’t succeed in writing the size !

  • You must to post comments
0
0

Once you have calculated the size of the tag to write, see how i write to the file in the WriteV2Chiffre function.
You should use a 32 bits int to store the size of the tag to write and shift to code the var in 7 bits.

  • You must to post comments
0
0

I tried, I tried, but I keep on trying

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.