All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mp4parser.boxes.adobe.ActionMessageFormat0SampleEntryBox Maven / Gradle / Ivy

Go to download

A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)

The newest version!
package org.mp4parser.boxes.adobe;

import org.mp4parser.BoxParser;
import org.mp4parser.boxes.sampleentry.AbstractSampleEntry;
import org.mp4parser.tools.IsoTypeReader;
import org.mp4parser.tools.IsoTypeWriter;

import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;

/**
 * 

4cc = "{@value #TYPE}"

* Sample Entry as used for Action Message Format tracks. */ public class ActionMessageFormat0SampleEntryBox extends AbstractSampleEntry { public static final String TYPE = "amf0"; public ActionMessageFormat0SampleEntryBox() { super(TYPE); } @Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer bb = ByteBuffer.allocate(8); dataSource.read(bb); ((Buffer)bb).position(6);// ignore 6 reserved bytes; dataReferenceIndex = IsoTypeReader.readUInt16(bb); initContainer(dataSource, contentSize - 8, boxParser); } @Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer bb = ByteBuffer.allocate(8); ((Buffer)bb).position(6); IsoTypeWriter.writeUInt16(bb, dataReferenceIndex); writableByteChannel.write((ByteBuffer) ((Buffer)bb).rewind()); writeContainer(writableByteChannel); } @Override public long getSize() { long s = getContainerSize(); long t = 8; // bytes to container start return s + t + ((largeBox || (s + t) >= (1L << 32)) ? 16 : 8); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy