Re: Display Artist-Song

Dean Sellis <[email protected]> Tue, 12 Aug 2003 00:40:12 -0500
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <[email protected]>
I wrote new functions for reading the v2.2 tags and this seems to be 
working.  I'm going to do more testing and see what I'm missing and add 
the rest of the tags.  I replaced id_2_2 with id_2_2_new and created a 
new function called get_framesize_2 to get the framesize of a v2.2 
frame.  This seems to be working for me an the title and artist are now 
displayed in the stream instead of the full filename.

void id_2_2_new(pool *p, unsigned char *buffer, mp3_data *bank, 
unsigned long tagsize) {
   int framesize = 0;
   int processedsize = 0;

   while (processedsize < tagsize)
     {
       if(!strncmp("TT2",buffer,3)) {
	framesize = get_framesize_2(buffer);
	bank->name = ap_pstrndup(p, buffer+7, framesize);
	buffer += framesize-4;
	processedsize += framesize;
       } else if(!strncmp("TP1",buffer,3)) {
	framesize = get_framesize_2(buffer);
	bank->artist = ap_pstrndup(p, buffer+7, framesize);
	buffer += framesize-4;
	processedsize += framesize;
       } else {
	framesize = get_framesize_2(buffer);
	buffer += framesize-4;
	processedsize += framesize;
       }
     }
}

unsigned int get_framesize_2(unsigned char *buffer) {
	/* An ID3v2.2 frame length is a 3 byte unsigned number. Naturally, 
we're
	not going to handle anything that large. We should handle large frames
	intelligently, but for now I'm going to pretend that length is only 2
	bytes long */

	return ((buffer[4] << 8) + (buffer[5])) + 10;
}


On Monday, August 11, 2003, at 09:59  AM, Brian Aker wrote:

> On Sun, 2003-08-10 at 19:11, Dean Sellis wrote:
>> I think I found the problem.  It seems mod_mp3 won't read id3v2 tags,
>> and iTunes doesn't write id3v1 tags.  Most of my files were encoded
>> with iTunes and so there is no information for mod_mp3 to read.  I'm
> Actually it should be able to. What program did you use to do the
> encoding?
> 	-Brian
> -- 
> _______________________________________________________
> Brian "Krow" Aker, [email protected]
> Seattle, Washington
> http://krow.net/
> http://askbrian.org/
> _______________________________________________________
> You can't grep a dead tree.
>
> _______________________________________________
> Mod_mp3 mailing list
> [email protected]
> http://lists.tangent.org/mailman/listinfo/mod_mp3