#1
  1. Cast down
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    321
    Rep Power
    12

    mp3 ID track field, how to write it?


    I am writing code to write a id3 tag (1.1), It's all fine except the track is not written, the comment should be 28 bytes and the track goes right after, right?

    Code:
    	fseek(fp,-125,SEEK_END); 
    	//fwrite("TAG",sizeof(char),3,fp); 
    	fwrite(ID3.title,sizeof(char),30,fp); 
    	fwrite(ID3.artist,sizeof(char),30,fp); 
    	fwrite(ID3.album,sizeof(char),30,fp); 
    	fwrite(ID3.year,sizeof(char),4,fp); 
    	fwrite(ID3.comment,sizeof(char),28,fp); //29 would be the track? 
    	fputc(ID3.track,fp); 
    	fputc(ID3.genre,fp);
  2. #2
  3. Cast down
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    321
    Rep Power
    12
    Also I have this code, it isn't working right, If the TAG exists.. it works, it overwrites it, but if the TAG doesn't, it's supposed to write 128 new bytes to the end of the file (to not overwrite audio data)..

    Code:
    	fp = fopen("C:\\x.mp3","r+b"); 
    
    	TAGExists(fp) ? fseek(fp,-128,SEEK_END) : fseek(fp,0,SEEK_END); 
    
    	//fwrite("TAG",sizeof(char),3,fp); 
    	fputc('T',fp); fputc('A',fp); fputc('G',fp); 
    	fwrite(ID3.title,sizeof(char),30,fp); 
    	fwrite(ID3.artist,sizeof(char),30,fp); 
    	fwrite(ID3.album,sizeof(char),30,fp); 
    	fwrite(ID3.year,sizeof(char),4,fp); 
    	fwrite(ID3.comment,sizeof(char),28,fp); //29 would be the track? 
    	fputc(ID3.track,fp); 
    	fputc(ID3.genre,fp); 
    
    	fclose(fp);
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    i don't know if you've seen this but it might help at some stage:http://sourceforge.net/projects/massid3lib

IMN logo majestic logo threadwatch logo seochat tools logo