Java code that determines the headers in an mp3 file -
i've been writing program can determine , every data mp3 file. based on info on webpage (http://www.multiweb.cz/twoinches/mp3inside.htm), program reads whole mp3 file byte array, checks tag v2 @ start , tag v1 @ end of file.
my problem data can headers. far understand, need search bytes 1111_1111 , next 1 111x_xxxx. there fair few matches criteria aren't headers, random coincidence, i've made mp3header class, has fields mentioned on above webpage (id, layer, bitrate etc..) , overriden equals method return true if id, layer, , frequency match(i use first header find base, , compare every other 1 after one).
this method seems work cbr mp3 files, vbr ones giving me hard time. first header find incorrect, , point on, whole comparison screwed (i'm not checking bitrate equality can't reason). valid explanation can come with, tag @ start may contain characters extended ascii table, , since java doesn't have unsigned int, 1111_1111 (255) byte might interpreted -1 when converted int. question is, how can make sure bytes find indeed proper header? or should store matches criteria, , check 1 frequent, , go that?
thanks, istván
p.s: know solved few lines of code if used jmf, i'm enjoying challenge of writing this.
i understand there libraries available perform task (see id3.org/implementations). perhaps download source , see how it?
Comments
Post a Comment