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

ProgressiveDownloadInformationBoxTest

public class ProgressiveDownloadInformationBoxTest extends Object

Fields Summary
Constructors Summary
Methods Summary
public voidtestInAndOut()

        ProgressiveDownloadInformationBox pdin = new ProgressiveDownloadInformationBox();
        List<ProgressiveDownloadInformationBox.Entry> entries = new LinkedList<ProgressiveDownloadInformationBox.Entry>();
        entries.add(new ProgressiveDownloadInformationBox.Entry(10, 20));
        entries.add(new ProgressiveDownloadInformationBox.Entry(20, 10));
        pdin.setEntries(entries);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pdin.getBox(Channels.newChannel(baos));
        byte[] fullBox = baos.toByteArray();
        ByteBuffer bb = ByteBuffer.wrap(fullBox);
        long lengthWritten = IsoTypeReader.readUInt32(bb);
        Assert.assertEquals(fullBox.length, lengthWritten);
        String type = IsoTypeReader.read4cc(bb);
        Assert.assertEquals("pdin", type);

        ProgressiveDownloadInformationBox pdin2 = new ProgressiveDownloadInformationBox();
        pdin2.parse(new ByteBufferByteChannel(bb), null, lengthWritten - 8, null);
        List<ProgressiveDownloadInformationBox.Entry> parsedEntries = pdin2.getEntries();

        Assert.assertEquals(20, parsedEntries.get(0).getInitialDelay());
        Assert.assertEquals(10, parsedEntries.get(0).getRate());
        Assert.assertEquals(10, parsedEntries.get(1).getInitialDelay());
        Assert.assertEquals(20, parsedEntries.get(1).getRate());