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

org.mp4parser.boxes.dece.TrickPlayBox 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.dece;

import org.mp4parser.support.AbstractFullBox;
import org.mp4parser.tools.IsoTypeReader;
import org.mp4parser.tools.IsoTypeWriter;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

/**
 * 

4cc = "{@value #TYPE}"

*
 * aligned(8) class TrickPlayBox extends FullBox(‘trik’, version=0, flags=0)
 * {
 *  for (i=0; I < sample_count; i++) {
 *   unsigned int(2) pic_type;
 *   unsigned int(6) dependency_level;
 *  }
 * }
 * 
*/ public class TrickPlayBox extends AbstractFullBox { public static final String TYPE = "trik"; private List entries = new ArrayList(); public TrickPlayBox() { super(TYPE); } public List getEntries() { return entries; } public void setEntries(List entries) { this.entries = entries; } @Override protected long getContentSize() { return 4 + entries.size(); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); while (content.remaining() > 0) { entries.add(new Entry(IsoTypeReader.readUInt8(content))); } } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); for (Entry entry : entries) { IsoTypeWriter.writeUInt8(byteBuffer, entry.value); } } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("TrickPlayBox"); sb.append("{entries=").append(entries); sb.append('}'); return sb.toString(); } public static class Entry { private int value; public Entry() { } public Entry(int value) { this.value = value; } public int getPicType() { return (value >> 6) & 0x03; } public void setPicType(int picType) { value = value & (0xff >> 3); value = (picType & 0x03) << 6 | value; } public int getDependencyLevel() { return value & 0x3f; } public void setDependencyLevel(int dependencyLevel) { value = (dependencyLevel & 0x3f) | value; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Entry"); sb.append("{picType=").append(getPicType()); sb.append(",dependencyLevel=").append(getDependencyLevel()); sb.append('}'); return sb.toString(); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy