kurcoba / mp4parser

Automatically exported from code.google.com/p/mp4parser
0 stars 0 forks source link

ChunckOffsetBox Index Out of Bonds Exception #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Parsinsg a mp4 file
2. When I try to get a stco box with (ChunkOffsetBox stco = 
stbl.getBoxes(ChunkOffsetBox.class).get(0);)
3. I get the exception

What is the expected output? What do you see instead?
The expected output is a stco box

What version of the product are you using? On what operating system?
latest maven repository version (1.0-beta-3) Ubuntu 11.10 64-bits

Please provide any additional information below.
Parsing with java code got in the example page.

Original issue reported on code.google.com by lucaschi...@gmail.com on 8 Dec 2011 at 6:36

GoogleCodeExporter commented 9 years ago
Hi Luca, 

could please have a look into the complete list that is returned by 
stbl.getBoxes() [without class argument]. Is a ChunkOffsetBox in this list? 
Please also turn on assertion by adding the VM param '-ea'. Can you see the box 
if you open the file with the latest isoviewer (please use webstart).
The getBox(Class clazz) stuff is used all over the place. It would be really 
surprising if there was a bug! 

Best Regards,
Sebastian

Original comment by Sebastian.Annies on 8 Dec 2011 at 6:44

GoogleCodeExporter commented 9 years ago
Hi Sebastians,

Yes, i thought exactly the same thing about the getBox(Class class).
I did your suggestion, and for my surprise, the class name of the box
is StaticChunkOffsetBox, and not ChunkOffsetBox.
In the iso specification i did not saw this name for this box.

Thank for the help and sorry for the trouble.

I also wanna thank you for this project. It saved my life. I needed exactly
this type of project to my project !

Thanks !

Original comment by lucaschi...@gmail.com on 8 Dec 2011 at 7:01

GoogleCodeExporter commented 9 years ago
StaticChunkOffsetBox is a subclass of ChunkOffsetBox, there is also have a 
DynamicChunkOffset Box that automagically re-calculates the offsets of the 
chunks if you add data before the mdat box.

It seems that my co-committer changed the behavior some time ago, I think it 
should work the way you tried it. I'll change the behavior back to also return 
subclasses. 

No problem, thank you for revealing this pitfall!

Original comment by Sebastian.Annies on 8 Dec 2011 at 7:22

GoogleCodeExporter commented 9 years ago
fixed it in trunk. getBoxes(clazz) now also returns subclasses

Original comment by Sebastian.Annies on 15 Dec 2011 at 9:48