Methods Summary |
---|
public void | _parseDetails(java.nio.ByteBuffer content)
parseVersionAndFlags(content);
long sampleCount = IsoTypeReader.readUInt32(content);
if ((getFlags() & 0x1) == 1) { //dataOffsetPresent
dataOffset = l2i(IsoTypeReader.readUInt32(content));
} else {
dataOffset = -1;
}
if ((getFlags() & 0x4) == 0x4) { //firstSampleFlagsPresent
firstSampleFlags = new SampleFlags(content);
}
for (int i = 0; i < sampleCount; i++) {
Entry entry = new Entry();
if ((getFlags() & 0x100) == 0x100) { //sampleDurationPresent
entry.sampleDuration = IsoTypeReader.readUInt32(content);
}
if ((getFlags() & 0x200) == 0x200) { //sampleSizePresent
entry.sampleSize = IsoTypeReader.readUInt32(content);
}
if ((getFlags() & 0x400) == 0x400) { //sampleFlagsPresent
entry.sampleFlags = new SampleFlags(content);
}
if ((getFlags() & 0x800) == 0x800) { //sampleCompositionTimeOffsetPresent
entry.sampleCompositionTimeOffset = content.getInt();
}
entries.add(entry);
}
|
protected void | getContent(java.nio.ByteBuffer byteBuffer)
writeVersionAndFlags(byteBuffer);
IsoTypeWriter.writeUInt32(byteBuffer, entries.size());
int flags = getFlags();
if ((flags & 0x1) == 1) { //dataOffsetPresent
IsoTypeWriter.writeUInt32(byteBuffer, dataOffset);
}
if ((flags & 0x4) == 0x4) { //firstSampleFlagsPresent
firstSampleFlags.getContent(byteBuffer);
}
for (Entry entry : entries) {
if ((flags & 0x100) == 0x100) { //sampleDurationPresent
IsoTypeWriter.writeUInt32(byteBuffer, entry.sampleDuration);
}
if ((flags & 0x200) == 0x200) { //sampleSizePresent
IsoTypeWriter.writeUInt32(byteBuffer, entry.sampleSize);
}
if ((flags & 0x400) == 0x400) { //sampleFlagsPresent
entry.sampleFlags.getContent(byteBuffer);
}
if ((flags & 0x800) == 0x800) { //sampleCompositionTimeOffsetPresent
byteBuffer.putInt(entry.sampleCompositionTimeOffset);
}
}
|
protected long | getContentSize()
long size = 8;
int flags = getFlags();
if ((flags & 0x1) == 0x1) { //dataOffsetPresent
size += 4;
}
if ((flags & 0x4) == 0x4) { //firstSampleFlagsPresent
size += 4;
}
long entrySize = 0;
if ((flags & 0x100) == 0x100) { //sampleDurationPresent
entrySize += 4;
}
if ((flags & 0x200) == 0x200) { //sampleSizePresent
entrySize += 4;
}
if ((flags & 0x400) == 0x400) { //sampleFlagsPresent
entrySize += 4;
}
if ((flags & 0x800) == 0x800) { //sampleCompositionTimeOffsetPresent
entrySize += 4;
}
size += entrySize * entries.size();
return size;
|
public int | getDataOffset()
return dataOffset;
|
public java.util.List | getEntries()
return entries;
|
public SampleFlags | getFirstSampleFlags()
return firstSampleFlags;
|
public long[] | getSampleCompositionTimeOffsets()
if (isSampleCompositionTimeOffsetPresent()) {
long[] result = new long[entries.size()];
for (int i = 0; i < result.length; i++) {
result[i] = entries.get(i).getSampleCompositionTimeOffset();
}
return result;
}
return null;
|
public long | getSampleCount()
return entries.size();
|
public TrackExtendsBox | getTrackExtendsBox()
final TrackFragmentHeaderBox tfhd = ((TrackFragmentBox) getParent()).getTrackFragmentHeaderBox();
final List<MovieBox> movieBoxes = tfhd.getIsoFile().getBoxes(MovieBox.class);
if (movieBoxes.size() == 0) {
return null;
}
final List<TrackExtendsBox> trexBoxes = movieBoxes.get(0).getBoxes(TrackExtendsBox.class, true);
TrackExtendsBox trex = null;
for (TrackExtendsBox aTrex : trexBoxes) {
if (aTrex.getTrackId() == tfhd.getTrackId()) {
trex = aTrex;
}
}
return trex;
|
public boolean | isDataOffsetPresent()
return (getFlags() & 0x1) == 1;
|
public boolean | isFirstSampleFlagsPresent()
return (getFlags() & 0x4) == 0x4;
|
public boolean | isSampleCompositionTimeOffsetPresent()
return (getFlags() & 0x800) == 0x800;
|
public boolean | isSampleDurationPresent()
return (getFlags() & 0x100) == 0x100;
|
public boolean | isSampleFlagsPresent()
return (getFlags() & 0x400) == 0x400;
|
public boolean | isSampleSizePresent()
return (getFlags() & 0x200) == 0x200;
|
public void | setDataOffset(int dataOffset)
if (dataOffset == -1) {
setFlags(getFlags() & (0xFFFFFF ^ 1));
} else {
setFlags(getFlags() | 0x1); // turn on dataoffset
}
this.dataOffset = dataOffset;
|
public void | setDataOffsetPresent(boolean v)
if (v) {
setFlags(getFlags() | 0x01);
} else {
setFlags(getFlags() & (0xFFFFFF ^ 0x1));
}
|
public void | setEntries(java.util.List entries)
this.entries = entries;
|
public void | setFirstSampleFlags(SampleFlags firstSampleFlags)
if (firstSampleFlags == null) {
setFlags(getFlags() & (0xFFFFFF ^ 0x4));
} else {
setFlags(getFlags() | 0x4);
}
this.firstSampleFlags = firstSampleFlags;
|
public void | setSampleCompositionTimeOffsetPresent(boolean v)
if (v) {
setFlags(getFlags() | 0x800);
} else {
setFlags(getFlags() & (0xFFFFFF ^ 0x800));
}
|
public void | setSampleDurationPresent(boolean v)
if (v) {
setFlags(getFlags() | 0x100);
} else {
setFlags(getFlags() & (0xFFFFFF ^ 0x100));
}
|
public void | setSampleFlagsPresent(boolean v)
if (v) {
setFlags(getFlags() | 0x400);
} else {
setFlags(getFlags() & (0xFFFFFF ^ 0x400));
}
|
public void | setSampleSizePresent(boolean v)
if (v) {
setFlags(getFlags() | 0x200);
} else {
setFlags(getFlags() & (0xFFFFFF ^ 0x200));
}
|
public java.lang.String | toString()
final StringBuilder sb = new StringBuilder();
sb.append("TrackRunBox");
sb.append("{sampleCount=").append(entries.size());
sb.append(", dataOffset=").append(dataOffset);
sb.append(", dataOffsetPresent=").append(isDataOffsetPresent());
sb.append(", sampleSizePresent=").append(isSampleSizePresent());
sb.append(", sampleDurationPresent=").append(isSampleDurationPresent());
sb.append(", sampleFlagsPresentPresent=").append(isSampleFlagsPresent());
sb.append(", sampleCompositionTimeOffsetPresent=").append(isSampleCompositionTimeOffsetPresent());
sb.append(", firstSampleFlags=").append(firstSampleFlags);
sb.append('}");
return sb.toString();
|