package net.katsuster.strview.media.ts;

import net.katsuster.strview.io.*;
import net.katsuster.strview.media.*;

/**
 * @author katsuhiro
 */
public class TSPacketList extends AbstractLargeList<TSPacket> {
    public LargeBitList buf;

    public TSPacketList() {
        super(LENGTH_UNKNOWN);
    }

    public TSPacketList(LargeBitList l) {
        super(LENGTH_UNKNOWN);

        buf = l;
    }

    @Override
    public void count() {
        setLength(buf.length() / 188 / 8);
    }

    @Override
    protected TSPacket getInner(long index) {
        TSPacket p = new TSPacket();
        FromBitBufferConverter c = new FromBitBufferConverter(BitBuffer.wrap(buf));

        c.doInit();
        c.position(index * 188 * 8);
        p.setNumber(index);
        p.setLevel(0);
        p.read(c);
        c.doFinal();

        return p;
    }

    @Override
    protected void setInner(long index, TSPacket data) {

    }
}

@@ -589,38 +589,36 @@
 %0A        FromBit
-Buffer
+List
 Converter c = ne
@@ -626,22 +626,20 @@
  FromBit
-Buffer
+List
 Converte
@@ -644,28 +644,12 @@
 ter(
-BitBuffer.wrap(
 buf)
-)
 ;%0A%0A 

Use LargeBitList instead of BitBuffer.