FileDocCategorySizeDatePackage
SampleToChunkBoxTest.javaAPI Docmp4parser 1.0-RC-171302Wed Dec 19 20:10:22 GMT 2012com.coremedia.iso.boxes

SampleToChunkBoxTest

public class SampleToChunkBoxTest extends TestCase
Created by IntelliJ IDEA. User: sannies Date: 24.02.11 Time: 12:41 To change this template use File | Settings | File Templates.

Fields Summary
Constructors Summary
Methods Summary
public voidtestParse()

        SampleToChunkBox stsc = new SampleToChunkBox();
        List<SampleToChunkBox.Entry> l = new LinkedList<SampleToChunkBox.Entry>();
        for (int i = 0; i < 5; i++) {
            SampleToChunkBox.Entry e = new SampleToChunkBox.Entry(i, 1, i * i);
            l.add(e);
        }
        stsc.setEntries(l);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        stsc.getBox(Channels.newChannel(baos));
        byte[] content = baos.toByteArray();

        SampleToChunkBox stsc2 = new SampleToChunkBox();
        stsc2.parse(new ByteBufferByteChannel(ByteBuffer.wrap(content, 8, content.length - 8)), null, content.length - 8, null);
        Assert.assertEquals(content.length, stsc2.getSize());