package com.hwdmedia.media.mp4.atom;

import com.hwdmedia.media.mp4.Atom;

import java.nio.ByteBuffer;
import java.nio.LongBuffer;

/**
 * @author Gennadiy Kozlenko
 */
public class ChunkOffset64BitAtom extends Atom {

    public static final String TYPE_CO64 = "co64";

    private long[] entries = new long[0];

    /**
     * Class constructor
     *
     * @param size   Atom size
     * @param offset Atom offset
     */
    public ChunkOffset64BitAtom(int size, int offset) {
        super(TYPE_CO64, size, offset);
    }

    public long[] getEntries() {
        return entries;
    }

    @Override
    public void parse(ByteBuffer buffer) {
        buffer.position(buffer.position() + 4);
        int entryCount = buffer.getInt();
        entries = new long[entryCount];
        LongBuffer buf = buffer.asLongBuffer();
        buf.get(entries);
    }

}
