* xxxx <- id de l'info
* data
* ]
*/
public Mp4Tag read( RandomAccessFile raf ) throws CannotReadException, IOException {
Mp4Tag tag = new Mp4Tag();
Mp4Box box = new Mp4Box();
byte[] b = new byte[4];
//Get to the facts
//1-Searching for "moov"
seek(raf, box, "moov");
//2-Searching for "udta"
seek(raf, box, "udta");
//3-Searching for "meta"
seek(raf, box, "meta");
//4-skip the meta flags
raf.read(b);
if(b[0] != 0)
throw new CannotReadException();
//5-Seek the "ilst"
seek(raf, box, "ilst");
int length = box.getOffset() - 8;
int read = 0;
while(read < length) {
b = new byte[8];
raf.read(b);
box.update(b);
int fieldLength = box.getOffset() - 8;
b = new byte[fieldLength];
raf.read(b);
tag.add(createMp4Field(box.getId(), b));
read += 8+fieldLength;
}
System.out.println(tag);
return tag;