Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MP3 tag code ?

7 views
Skip to first unread message

Jim Davis

unread,
Sep 5, 2007, 12:37:55 AM9/5/07
to
Seeking C or C++ source
to read *.MP3 ID3v2 tags

Mark Jacobs

unread,
Sep 22, 2007, 7:11:23 AM9/22/07
to
"Jim Davis" <jim...@hotmail.com> wrote in message
news:Xns99A1DC0C76EA7...@207.105.83.66...

> Seeking C or C++ source
> to read *.MP3 ID3v2 tags

OK. This is C-style code. It gets the info at the end of the mp3 file marked
with the letters 'TAG'. Some of this may be truncated. I assume mfnm is an
AnsiString holding the name of the MP3 file.

FILE *fpj=fopen(mfnm.c_str(),"rb"); int nbry=0;
char btgf[130],sngnm[35],artst[35],albm[35],yur[5],cmmnt[35];
if (fpj)
{
if (fseek(fpj,-128,SEEK_END)==0)
nbry=fread(btgf,sizeof(char),128,fpj);
fclose(fpj);
}
if (nbry>0 && btgf[0]=='T' && btgf[1]=='A' && btgf[2]=='G')
{
strncpy(sngnm,&btgf[3],30*sizeof(char)); sngnm[30]='\0';
strncpy(artst,&btgf[33],30*sizeof(char)); artst[30]='\0';
strncpy(albm,&btgf[63],30*sizeof(char)); albm[30]='\0';
strncpy(yur,&btgf[93],4*sizeof(char)); yur[4]='\0';
strncpy(cmmnt,&btgf[97],30*sizeof(char)); cmmnt[30]='\0';
}

HTH
--
Mark Jacobs
http://jacobsm.com


Brett

unread,
Nov 14, 2007, 8:28:47 AM11/14/07
to

Hi,

Please email me for source of Id3v2.3 tag reading
My code is in BCB6 and also extracts embedded JPG album art out of the file
in my Mp3 ID3 files the tags are at the start of the file and each Tag has its own unique identifer,
I found that in my ID3v2.3 files the TAgs at the end are blank
So the below code would no work

Also Maybe you can help me.
I have embedded WMP win media player on my form.
I cam play files fine. But I want to add media items to the media collection library

int sze;
sze = FileListBox1->Items->Strings[cnt].WideCharBufSize();
tmp = WideChar(FileListBox1->Items->Strings[cnt],sze);
MusicForm->WMP1->mediaCollection->add(tmp) ;


But the complier just complains that
[C++ Error] MusicPL.cpp(375): E2285 Could not find a match for 'IWMPMediaCollection::add(wchar_t)'

Do i have to create a new collection? All the examples Ive seen are in VB and look really simple I even just tried

MusicForm->WMP1->mediaCollection->add("c:\filex.mp3); // just like vb example
and it didnt work either?
Can anyone help?

Cheers
Brett

Mark Jacobs

unread,
Nov 15, 2007, 7:37:28 PM11/15/07
to
"Brett" <brett...@austereo.com.au> wrote in message
news:473b061f$1...@newsgroups.borland.com...

> Please email me for source of Id3v2.3 tag reading
> My code is in BCB6 and also extracts embedded JPG album art out of the
> file
> in my Mp3 ID3 files the tags are at the start of the file and each Tag has
> its own unique identifer,
> I found that in my ID3v2.3 files the TAgs at the end are blank

Have a look at the thread "iTunes ID3 Tag" in
Borland.Public.Delphi.Multimedia newsgroup. I put code to extract salient
details there.

>
> Also Maybe you can help me.
> I have embedded WMP win media player on my form.
> I cam play files fine. But I want to add media items to the media
> collection library

Sorry, I have never used this object. I use TMediaPlayer. Free app available
at http://www.jacobsm.com/mjsoft.htm#mjplyr

0 new messages