proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SampleAuxiliaryInformationSizesBox.java
SampleAuxiliaryInformationSizesBox
_parseDetails
class SampleAuxiliaryInformationSizesBox extends AbstractFullBox { public static final String TYPE = "saiz"; private short defaultSampleInfoSize; private short[] sampleInfoSizes = new short[0]; private int sampleCount; private String auxInfoType; private String auxInfoTypeParameter; public SampleAuxiliaryInformationSizesBox() { super(TYPE); } @Override protected long getContentSize() { int size = 4; if ((getFlags() & 1) == 1) { size += 8; } size += 5; size += defaultSampleInfoSize == 0 ? sampleInfoSizes.length : 0; return size; } public short getSize(int index) { if (getDefaultSampleInfoSize() == 0) { return sampleInfoSizes[index]; } else { return defaultSampleInfoSize; } } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); if ((getFlags() & 1) == 1) { byteBuffer.put(IsoFile.fourCCtoBytes(auxInfoType)); byteBuffer.put(IsoFile.fourCCtoBytes(auxInfoTypeParameter)); } IsoTypeWriter.writeUInt8(byteBuffer, defaultSampleInfoSize); if (defaultSampleInfoSize == 0) { IsoTypeWriter.writeUInt32(byteBuffer, sampleInfoSizes.length); for (short sampleInfoSize : sampleInfoSizes) { IsoTypeWriter.writeUInt8(byteBuffer, sampleInfoSize); } } else { IsoTypeWriter.writeUInt32(byteBuffer, sampleCount); } } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} public String getAuxInfoType() { return auxInfoType; } public void setAuxInfoType(String auxInfoType) { this.auxInfoType = auxInfoType; } public String getAuxInfoTypeParameter() { return auxInfoTypeParameter; } public void setAuxInfoTypeParameter(String auxInfoTypeParameter) { this.auxInfoTypeParameter = auxInfoTypeParameter; } public int getDefaultSampleInfoSize() { return defaultSampleInfoSize; } public void setDefaultSampleInfoSize(int defaultSampleInfoSize) { assert defaultSampleInfoSize <= 255; this.defaultSampleInfoSize = (short) defaultSampleInfoSize; } public short[] getSampleInfoSizes() { short copy[] = new short[sampleInfoSizes.length]; System.arraycopy(sampleInfoSizes, 0, copy, 0, sampleInfoSizes.length); return copy; } public void setSampleInfoSizes(short[] sampleInfoSizes) { this.sampleInfoSizes = new short[sampleInfoSizes.length]; System.arraycopy(sampleInfoSizes, 0, this.sampleInfoSizes, 0, sampleInfoSizes.length); } public int getSampleCount() { return sampleCount; } public void setSampleCount(int sampleCount) { this.sampleCount = sampleCount; } @Override public String toString() { return "SampleAuxiliaryInformationSizesBox{" + "defaultSampleInfoSize=" + defaultSampleInfoSize + ", sampleCount=" + sampleCount + ", auxInfoType='" + auxInfoType + '\'' + ", auxInfoTypeParameter='" + auxInfoTypeParameter + '\'' + '}'; } }
parseVersionAndFlags(content); if ((getFlags() & 1) == 1) { auxInfoType = IsoTypeReader.read4cc(content); auxInfoTypeParameter = IsoTypeReader.read4cc(content); } defaultSampleInfoSize = (short) IsoTypeReader.readUInt8(content); sampleCount = CastUtils.l2i(IsoTypeReader.readUInt32(content)); if (defaultSampleInfoSize == 0) { sampleInfoSizes = new short[sampleCount]; for (int i = 0; i < sampleCount; i++) { sampleInfoSizes[i] = (short) IsoTypeReader.readUInt8(content); } }
944
189
1,133
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SampleDependencyTypeBox.java
SampleDependencyTypeBox
getContent
class SampleDependencyTypeBox extends AbstractFullBox { public static final String TYPE = "sdtp"; private List<Entry> entries = new ArrayList<Entry>(); public SampleDependencyTypeBox() { super(TYPE); } @Override protected long getContentSize() { return 4 + entries.size(); } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); while (content.remaining() > 0) { entries.add(new Entry(IsoTypeReader.readUInt8(content))); } } public List<Entry> getEntries() { return entries; } public void setEntries(List<Entry> entries) { this.entries = entries; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("SampleDependencyTypeBox"); sb.append("{entries=").append(entries); sb.append('}'); return sb.toString(); } public static class Entry { private int value; public Entry(int value) { this.value = value; } public byte getIsLeading() { return (byte) ((value >> 6) & 0x03); } public void setIsLeading(int res) { value = (res & 0x03) << 6 | value & 0x3f; } public byte getSampleDependsOn() { return (byte) ((value >> 4) & 0x03); } public void setSampleDependsOn(int sdo) { value = (sdo & 0x03) << 4 | value & 0xcf; } public byte getSampleIsDependedOn() { return (byte) ((value >> 2) & 0x03); } public void setSampleIsDependedOn(int sido) { value = (sido & 0x03) << 2 | value & 0xf3; } public byte getSampleHasRedundancy() { return (byte) (value & 0x03); } public void setSampleHasRedundancy(int shr) { value = shr & 0x03 | value & 0xfc; } @Override public String toString() { return "Entry{" + "isLeading=" + getIsLeading() + ", sampleDependsOn=" + getSampleDependsOn() + ", sampleIsDependentOn=" + getSampleIsDependedOn() + ", sampleHasRedundancy=" + getSampleHasRedundancy() + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Entry entry = (Entry) o; if (value != entry.value) return false; return true; } @Override public int hashCode() { return value; } } }
writeVersionAndFlags(byteBuffer); for (Entry entry : entries) { IsoTypeWriter.writeUInt8(byteBuffer, entry.value); }
842
45
887
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SampleDescriptionBox.java
SampleDescriptionBox
parse
class SampleDescriptionBox extends AbstractContainerBox implements FullBox { public static final String TYPE = "stsd"; private int version; private int flags; public SampleDescriptionBox() { super(TYPE); } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public int getFlags() { return flags; } public void setFlags(int flags) { this.flags = flags; } @Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException {<FILL_FUNCTION_BODY>} @Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer versionFlagNumOfChildBoxes = ByteBuffer.allocate(8); IsoTypeWriter.writeUInt8(versionFlagNumOfChildBoxes, version); IsoTypeWriter.writeUInt24(versionFlagNumOfChildBoxes, flags); IsoTypeWriter.writeUInt32(versionFlagNumOfChildBoxes, getBoxes().size()); writableByteChannel.write((ByteBuffer) ((Buffer)versionFlagNumOfChildBoxes).rewind()); writeContainer(writableByteChannel); } public AbstractSampleEntry getSampleEntry() { for (AbstractSampleEntry box : getBoxes(AbstractSampleEntry.class)) { return box; } return null; } @Override public long getSize() { long s = getContainerSize(); long t = 8; return s + t + ((largeBox || (s + t + 8) >= (1L << 32)) ? 16 : 8); } }
ByteBuffer versionFlagNumOfChildBoxes = ByteBuffer.allocate(8); dataSource.read(versionFlagNumOfChildBoxes); ((Buffer)versionFlagNumOfChildBoxes).rewind(); version = IsoTypeReader.readUInt8(versionFlagNumOfChildBoxes); flags = IsoTypeReader.readUInt24(versionFlagNumOfChildBoxes); // number of child boxes is not required initContainer(dataSource, contentSize - 8, boxParser);
466
126
592
<methods>public void <init>(java.lang.String) ,public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setParent(org.mp4parser.Container) <variables>protected boolean largeBox,org.mp4parser.Container parent,protected java.lang.String type
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SampleSizeBox.java
SampleSizeBox
getContent
class SampleSizeBox extends AbstractFullBox { public static final String TYPE = "stsz"; int sampleCount; private long sampleSize; private long[] sampleSizes = new long[0]; public SampleSizeBox() { super(TYPE); } /** * Returns the field sample size. * If sampleSize &gt; 0 every sample has the same size. * If sampleSize == 0 the samples have different size as stated in the sampleSizes field. * * @return the sampleSize field */ public long getSampleSize() { return sampleSize; } public void setSampleSize(long sampleSize) { this.sampleSize = sampleSize; } public long getSampleSizeAtIndex(int index) { if (sampleSize > 0) { return sampleSize; } else { return sampleSizes[index]; } } public long getSampleCount() { if (sampleSize > 0) { return sampleCount; } else { return sampleSizes.length; } } public long[] getSampleSizes() { return sampleSizes; } public void setSampleSizes(long[] sampleSizes) { this.sampleSizes = sampleSizes; } protected long getContentSize() { return 12 + (sampleSize == 0 ? sampleSizes.length * 4 : 0); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); sampleSize = IsoTypeReader.readUInt32(content); sampleCount = CastUtils.l2i(IsoTypeReader.readUInt32(content)); if (sampleSize == 0) { sampleSizes = new long[sampleCount]; for (int i = 0; i < sampleCount; i++) { sampleSizes[i] = IsoTypeReader.readUInt32(content); } } } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} public String toString() { return "SampleSizeBox[sampleSize=" + getSampleSize() + ";sampleCount=" + getSampleCount() + "]"; } }
writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, sampleSize); if (sampleSize == 0) { IsoTypeWriter.writeUInt32(byteBuffer, sampleSizes.length); for (long sampleSize1 : sampleSizes) { IsoTypeWriter.writeUInt32(byteBuffer, sampleSize1); } } else { IsoTypeWriter.writeUInt32(byteBuffer, sampleCount); }
591
130
721
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SampleTableBox.java
SampleTableBox
getChunkOffsetBox
class SampleTableBox extends AbstractContainerBox { public static final String TYPE = "stbl"; private SampleToChunkBox sampleToChunkBox; public SampleTableBox() { super(TYPE); } public SampleDescriptionBox getSampleDescriptionBox() { return Path.getPath(this, "stsd"); } public SampleSizeBox getSampleSizeBox() { return Path.getPath(this, "stsz"); } public SampleToChunkBox getSampleToChunkBox() { return Path.getPath(this, "stsc"); } public ChunkOffsetBox getChunkOffsetBox() {<FILL_FUNCTION_BODY>} public TimeToSampleBox getTimeToSampleBox() { return Path.getPath(this, "stts"); } public SyncSampleBox getSyncSampleBox() { return Path.getPath(this, "stss"); } public CompositionTimeToSample getCompositionTimeToSample() { return Path.getPath(this, "ctts"); } public SampleDependencyTypeBox getSampleDependencyTypeBox() { return Path.getPath(this, "sdtp"); } }
for (Box box : getBoxes()) { if (box instanceof ChunkOffsetBox) { return (ChunkOffsetBox) box; } } return null;
312
49
361
<methods>public void <init>(java.lang.String) ,public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setParent(org.mp4parser.Container) <variables>protected boolean largeBox,org.mp4parser.Container parent,protected java.lang.String type
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SampleToChunkBox.java
Entry
equals
class Entry { long firstChunk; long samplesPerChunk; long sampleDescriptionIndex; public Entry(long firstChunk, long samplesPerChunk, long sampleDescriptionIndex) { this.firstChunk = firstChunk; this.samplesPerChunk = samplesPerChunk; this.sampleDescriptionIndex = sampleDescriptionIndex; } public long getFirstChunk() { return firstChunk; } public void setFirstChunk(long firstChunk) { this.firstChunk = firstChunk; } public long getSamplesPerChunk() { return samplesPerChunk; } public void setSamplesPerChunk(long samplesPerChunk) { this.samplesPerChunk = samplesPerChunk; } public long getSampleDescriptionIndex() { return sampleDescriptionIndex; } public void setSampleDescriptionIndex(long sampleDescriptionIndex) { this.sampleDescriptionIndex = sampleDescriptionIndex; } @Override public String toString() { return "Entry{" + "firstChunk=" + firstChunk + ", samplesPerChunk=" + samplesPerChunk + ", sampleDescriptionIndex=" + sampleDescriptionIndex + '}'; } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { int result = (int) (firstChunk ^ (firstChunk >>> 32)); result = 31 * result + (int) (samplesPerChunk ^ (samplesPerChunk >>> 32)); result = 31 * result + (int) (sampleDescriptionIndex ^ (sampleDescriptionIndex >>> 32)); return result; } }
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Entry entry = (Entry) o; if (firstChunk != entry.firstChunk) return false; if (sampleDescriptionIndex != entry.sampleDescriptionIndex) return false; if (samplesPerChunk != entry.samplesPerChunk) return false; return true;
457
111
568
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SegmentTypeBox.java
SegmentTypeBox
toString
class SegmentTypeBox extends AbstractBox { public static final String TYPE = "styp"; private String majorBrand; private long minorVersion; private List<String> compatibleBrands = Collections.emptyList(); public SegmentTypeBox() { super(TYPE); } public SegmentTypeBox(String majorBrand, long minorVersion, List<String> compatibleBrands) { super(TYPE); this.majorBrand = majorBrand; this.minorVersion = minorVersion; this.compatibleBrands = compatibleBrands; } protected long getContentSize() { return 8 + compatibleBrands.size() * 4; } @Override public void _parseDetails(ByteBuffer content) { majorBrand = IsoTypeReader.read4cc(content); minorVersion = IsoTypeReader.readUInt32(content); int compatibleBrandsCount = content.remaining() / 4; compatibleBrands = new LinkedList<String>(); for (int i = 0; i < compatibleBrandsCount; i++) { compatibleBrands.add(IsoTypeReader.read4cc(content)); } } @Override protected void getContent(ByteBuffer byteBuffer) { byteBuffer.put(IsoFile.fourCCtoBytes(majorBrand)); IsoTypeWriter.writeUInt32(byteBuffer, minorVersion); for (String compatibleBrand : compatibleBrands) { byteBuffer.put(IsoFile.fourCCtoBytes(compatibleBrand)); } } /** * Gets the brand identifier. * * @return the brand identifier */ public String getMajorBrand() { return majorBrand; } /** * Sets the major brand of the file used to determine an appropriate reader. * * @param majorBrand the new major brand */ public void setMajorBrand(String majorBrand) { this.majorBrand = majorBrand; } /** * Gets an informative integer for the minor version of the major brand. * * @return an informative integer * @see SegmentTypeBox#getMajorBrand() */ public long getMinorVersion() { return minorVersion; } /** * Sets the "informative integer for the minor version of the major brand". * * @param minorVersion the version number of the major brand */ public void setMinorVersion(long minorVersion) { this.minorVersion = minorVersion; } /** * Gets an array of 4-cc brands. * * @return the compatible brands */ public List<String> getCompatibleBrands() { return compatibleBrands; } public void setCompatibleBrands(List<String> compatibleBrands) { this.compatibleBrands = compatibleBrands; } @DoNotParseDetail public String toString() {<FILL_FUNCTION_BODY>} }
StringBuilder result = new StringBuilder(); result.append("SegmentTypeBox["); result.append("majorBrand=").append(getMajorBrand()); result.append(";"); result.append("minorVersion=").append(getMinorVersion()); for (String compatibleBrand : compatibleBrands) { result.append(";"); result.append("compatibleBrand=").append(compatibleBrand); } result.append("]"); return result.toString();
777
126
903
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/StaticChunkOffsetBox.java
StaticChunkOffsetBox
_parseDetails
class StaticChunkOffsetBox extends ChunkOffsetBox { public static final String TYPE = "stco"; private long[] chunkOffsets = new long[0]; public StaticChunkOffsetBox() { super(TYPE); } public long[] getChunkOffsets() { return chunkOffsets; } @Override public void setChunkOffsets(long[] chunkOffsets) { this.chunkOffsets = chunkOffsets; } protected long getContentSize() { return 8 + chunkOffsets.length * 4; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length); for (long chunkOffset : chunkOffsets) { IsoTypeWriter.writeUInt32(byteBuffer, chunkOffset); } } }
parseVersionAndFlags(content); int entryCount = CastUtils.l2i(IsoTypeReader.readUInt32(content)); chunkOffsets = new long[entryCount]; for (int i = 0; i < entryCount; i++) { chunkOffsets[i] = IsoTypeReader.readUInt32(content); }
273
94
367
<methods>public void <init>(java.lang.String) ,public abstract long[] getChunkOffsets() ,public abstract void setChunkOffsets(long[]) ,public java.lang.String toString() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SubSampleInformationBox.java
SubSampleInformationBox
getContentSize
class SubSampleInformationBox extends AbstractFullBox { public static final String TYPE = "subs"; private List<SubSampleEntry> entries = new ArrayList<SubSampleEntry>(); public SubSampleInformationBox() { super(TYPE); } public List<SubSampleEntry> getEntries() { return entries; } public void setEntries(List<SubSampleEntry> entries) { this.entries = entries; } @Override protected long getContentSize() {<FILL_FUNCTION_BODY>} @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); long entryCount = IsoTypeReader.readUInt32(content); for (int i = 0; i < entryCount; i++) { SubSampleEntry SubSampleEntry = new SubSampleEntry(); SubSampleEntry.setSampleDelta(IsoTypeReader.readUInt32(content)); int subsampleCount = IsoTypeReader.readUInt16(content); for (int j = 0; j < subsampleCount; j++) { SubSampleEntry.SubsampleEntry subsampleEntry = new SubSampleEntry.SubsampleEntry(); subsampleEntry.setSubsampleSize(getVersion() == 1 ? IsoTypeReader.readUInt32(content) : IsoTypeReader.readUInt16(content)); subsampleEntry.setSubsamplePriority(IsoTypeReader.readUInt8(content)); subsampleEntry.setDiscardable(IsoTypeReader.readUInt8(content)); subsampleEntry.setReserved(IsoTypeReader.readUInt32(content)); SubSampleEntry.getSubsampleEntries().add(subsampleEntry); } entries.add(SubSampleEntry); } } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, entries.size()); for (SubSampleEntry subSampleEntry : entries) { IsoTypeWriter.writeUInt32(byteBuffer, subSampleEntry.getSampleDelta()); IsoTypeWriter.writeUInt16(byteBuffer, subSampleEntry.getSubsampleCount()); List<SubSampleEntry.SubsampleEntry> subsampleEntries = subSampleEntry.getSubsampleEntries(); for (SubSampleEntry.SubsampleEntry subsampleEntry : subsampleEntries) { if (getVersion() == 1) { IsoTypeWriter.writeUInt32(byteBuffer, subsampleEntry.getSubsampleSize()); } else { IsoTypeWriter.writeUInt16(byteBuffer, CastUtils.l2i(subsampleEntry.getSubsampleSize())); } IsoTypeWriter.writeUInt8(byteBuffer, subsampleEntry.getSubsamplePriority()); IsoTypeWriter.writeUInt8(byteBuffer, subsampleEntry.getDiscardable()); IsoTypeWriter.writeUInt32(byteBuffer, subsampleEntry.getReserved()); } } } @Override public String toString() { return "SubSampleInformationBox{" + "entryCount=" + entries.size() + ", entries=" + entries + '}'; } public static class SubSampleEntry { private long sampleDelta; private List<SubsampleEntry> subsampleEntries = new ArrayList<SubsampleEntry>(); public long getSampleDelta() { return sampleDelta; } public void setSampleDelta(long sampleDelta) { this.sampleDelta = sampleDelta; } public int getSubsampleCount() { return subsampleEntries.size(); } public List<SubsampleEntry> getSubsampleEntries() { return subsampleEntries; } @Override public String toString() { return "SampleEntry{" + "sampleDelta=" + sampleDelta + ", subsampleCount=" + subsampleEntries.size() + ", subsampleEntries=" + subsampleEntries + '}'; } public static class SubsampleEntry { private long subsampleSize; private int subsamplePriority; private int discardable; private long reserved; public long getSubsampleSize() { return subsampleSize; } public void setSubsampleSize(long subsampleSize) { this.subsampleSize = subsampleSize; } public int getSubsamplePriority() { return subsamplePriority; } public void setSubsamplePriority(int subsamplePriority) { this.subsamplePriority = subsamplePriority; } public int getDiscardable() { return discardable; } public void setDiscardable(int discardable) { this.discardable = discardable; } public long getReserved() { return reserved; } public void setReserved(long reserved) { this.reserved = reserved; } @Override public String toString() { return "SubsampleEntry{" + "subsampleSize=" + subsampleSize + ", subsamplePriority=" + subsamplePriority + ", discardable=" + discardable + ", reserved=" + reserved + '}'; } } } }
long size = 8; for (SubSampleEntry entry : entries) { size += 4; size += 2; for (int j = 0; j < entry.getSubsampleEntries().size(); j++) { if (getVersion() == 1) { size += 4; } else { size += 2; } size += 2; size += 4; } } return size;
1,359
115
1,474
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/SyncSampleBox.java
SyncSampleBox
_parseDetails
class SyncSampleBox extends AbstractFullBox { public static final String TYPE = "stss"; private long[] sampleNumber; public SyncSampleBox() { super(TYPE); } /** * Gives the numbers of the samples that are random access points in the stream. * * @return random access sample numbers. */ public long[] getSampleNumber() { return sampleNumber; } public void setSampleNumber(long[] sampleNumber) { this.sampleNumber = sampleNumber; } protected long getContentSize() { return sampleNumber.length * 4L + 8; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, sampleNumber.length); for (long aSampleNumber : sampleNumber) { IsoTypeWriter.writeUInt32(byteBuffer, aSampleNumber); } } public String toString() { return "SyncSampleBox[entryCount=" + sampleNumber.length + "]"; } }
parseVersionAndFlags(content); int entryCount = CastUtils.l2i(IsoTypeReader.readUInt32(content)); sampleNumber = new long[entryCount]; for (int i = 0; i < entryCount; i++) { sampleNumber[i] = IsoTypeReader.readUInt32(content); }
320
92
412
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TimeToSampleBox.java
TimeToSampleBox
_parseDetails
class TimeToSampleBox extends AbstractFullBox { public static final String TYPE = "stts"; static Map<List<Entry>, SoftReference<long[]>> cache = new WeakHashMap<List<Entry>, SoftReference<long[]>>(); List<Entry> entries = Collections.emptyList(); public TimeToSampleBox() { super(TYPE); } /** * Decompresses the list of entries and returns the list of decoding times. * * @param entries compressed entries * @return decoding time per sample */ public static synchronized long[] blowupTimeToSamples(List<TimeToSampleBox.Entry> entries) { SoftReference<long[]> cacheEntry; if ((cacheEntry = cache.get(entries)) != null) { long[] cacheVal; if ((cacheVal = cacheEntry.get()) != null) { return cacheVal; } } long numOfSamples = 0; for (TimeToSampleBox.Entry entry : entries) { numOfSamples += entry.getCount(); } assert numOfSamples <= Integer.MAX_VALUE; long[] decodingTime = new long[(int) numOfSamples]; int current = 0; for (TimeToSampleBox.Entry entry : entries) { for (int i = 0; i < entry.getCount(); i++) { decodingTime[current++] = entry.getDelta(); } } cache.put(entries, new SoftReference<long[]>(decodingTime)); return decodingTime; } protected long getContentSize() { return 8 + entries.size() * 8; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, entries.size()); for (Entry entry : entries) { IsoTypeWriter.writeUInt32(byteBuffer, entry.getCount()); IsoTypeWriter.writeUInt32(byteBuffer, entry.getDelta()); } } public List<Entry> getEntries() { return entries; } public void setEntries(List<Entry> entries) { this.entries = entries; } public String toString() { return "TimeToSampleBox[entryCount=" + entries.size() + "]"; } public static class Entry { long count; long delta; public Entry(long count, long delta) { this.count = count; this.delta = delta; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } public long getDelta() { return delta; } public void setDelta(long delta) { this.delta = delta; } @Override public String toString() { return "Entry{" + "count=" + count + ", delta=" + delta + '}'; } } }
parseVersionAndFlags(content); int entryCount = CastUtils.l2i(IsoTypeReader.readUInt32(content)); entries = new ArrayList<Entry>(entryCount); for (int i = 0; i < entryCount; i++) { entries.add(new Entry(IsoTypeReader.readUInt32(content), IsoTypeReader.readUInt32(content))); }
831
109
940
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TrackBox.java
TrackBox
getSampleTableBox
class TrackBox extends AbstractContainerBox { public static final String TYPE = "trak"; private SampleTableBox sampleTableBox; public TrackBox() { super(TYPE); } public TrackHeaderBox getTrackHeaderBox() { return Path.getPath(this, "tkhd[0]"); } /** * Gets the SampleTableBox at mdia/minf/stbl if existing. * * @return the SampleTableBox or <code>null</code> */ public SampleTableBox getSampleTableBox() {<FILL_FUNCTION_BODY>} public MediaBox getMediaBox() { return Path.getPath(this, "mdia[0]"); } @Override public void setBoxes(List<? extends Box> boxes) { super.setBoxes(boxes); sampleTableBox = null; } }
if (sampleTableBox != null) { return sampleTableBox; } MediaBox mdia = getMediaBox(); if (mdia != null) { MediaInformationBox minf = mdia.getMediaInformationBox(); if (minf != null) { sampleTableBox = minf.getSampleTableBox(); return sampleTableBox; } } return null;
232
107
339
<methods>public void <init>(java.lang.String) ,public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setParent(org.mp4parser.Container) <variables>protected boolean largeBox,org.mp4parser.Container parent,protected java.lang.String type
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TrackExtendsBox.java
TrackExtendsBox
_parseDetails
class TrackExtendsBox extends AbstractFullBox { public static final String TYPE = "trex"; private long trackId; private long defaultSampleDescriptionIndex; private long defaultSampleDuration; private long defaultSampleSize; private SampleFlags defaultSampleFlags; public TrackExtendsBox() { super(TYPE); } @Override protected long getContentSize() { return 5 * 4 + 4; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, trackId); IsoTypeWriter.writeUInt32(byteBuffer, defaultSampleDescriptionIndex); IsoTypeWriter.writeUInt32(byteBuffer, defaultSampleDuration); IsoTypeWriter.writeUInt32(byteBuffer, defaultSampleSize); defaultSampleFlags.getContent(byteBuffer); } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} public long getTrackId() { return trackId; } public void setTrackId(long trackId) { this.trackId = trackId; } public long getDefaultSampleDescriptionIndex() { return defaultSampleDescriptionIndex; } public void setDefaultSampleDescriptionIndex(long defaultSampleDescriptionIndex) { this.defaultSampleDescriptionIndex = defaultSampleDescriptionIndex; } public long getDefaultSampleDuration() { return defaultSampleDuration; } public void setDefaultSampleDuration(long defaultSampleDuration) { this.defaultSampleDuration = defaultSampleDuration; } public long getDefaultSampleSize() { return defaultSampleSize; } public void setDefaultSampleSize(long defaultSampleSize) { this.defaultSampleSize = defaultSampleSize; } public SampleFlags getDefaultSampleFlags() { return defaultSampleFlags; } public void setDefaultSampleFlags(SampleFlags defaultSampleFlags) { this.defaultSampleFlags = defaultSampleFlags; } public String getDefaultSampleFlagsStr() { return defaultSampleFlags.toString(); } }
parseVersionAndFlags(content); trackId = IsoTypeReader.readUInt32(content); defaultSampleDescriptionIndex = IsoTypeReader.readUInt32(content); defaultSampleDuration = IsoTypeReader.readUInt32(content); defaultSampleSize = IsoTypeReader.readUInt32(content); defaultSampleFlags = new SampleFlags(content);
553
100
653
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TrackFragmentBaseMediaDecodeTimeBox.java
TrackFragmentBaseMediaDecodeTimeBox
_parseDetails
class TrackFragmentBaseMediaDecodeTimeBox extends AbstractFullBox { public static final String TYPE = "tfdt"; private long baseMediaDecodeTime; public TrackFragmentBaseMediaDecodeTimeBox() { super(TYPE); } @Override protected long getContentSize() { return getVersion() == 0 ? 8 : 12; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); if (getVersion() == 1) { IsoTypeWriter.writeUInt64(byteBuffer, baseMediaDecodeTime); } else { IsoTypeWriter.writeUInt32(byteBuffer, baseMediaDecodeTime); } } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} public long getBaseMediaDecodeTime() { return baseMediaDecodeTime; } public void setBaseMediaDecodeTime(long baseMediaDecodeTime) { this.baseMediaDecodeTime = baseMediaDecodeTime; } @Override public String toString() { return "TrackFragmentBaseMediaDecodeTimeBox{" + "baseMediaDecodeTime=" + baseMediaDecodeTime + '}'; } }
parseVersionAndFlags(content); if (getVersion() == 1) { baseMediaDecodeTime = IsoTypeReader.readUInt64(content); } else { baseMediaDecodeTime = IsoTypeReader.readUInt32(content); }
338
74
412
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TrackFragmentBox.java
TrackFragmentBox
getTrackFragmentHeaderBox
class TrackFragmentBox extends AbstractContainerBox { public static final String TYPE = "traf"; public TrackFragmentBox() { super(TYPE); } @DoNotParseDetail public TrackFragmentHeaderBox getTrackFragmentHeaderBox() {<FILL_FUNCTION_BODY>} }
for (Box box : getBoxes()) { if (box instanceof TrackFragmentHeaderBox) { return (TrackFragmentHeaderBox) box; } } return null;
77
49
126
<methods>public void <init>(java.lang.String) ,public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setParent(org.mp4parser.Container) <variables>protected boolean largeBox,org.mp4parser.Container parent,protected java.lang.String type
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TrackFragmentHeaderBox.java
TrackFragmentHeaderBox
getContentSize
class TrackFragmentHeaderBox extends AbstractFullBox { public static final String TYPE = "tfhd"; private long trackId; private long baseDataOffset = -1; private long sampleDescriptionIndex; private long defaultSampleDuration = -1; private long defaultSampleSize = -1; private SampleFlags defaultSampleFlags; private boolean durationIsEmpty; private boolean defaultBaseIsMoof; public TrackFragmentHeaderBox() { super(TYPE); } @Override protected long getContentSize() {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, trackId); if ((getFlags() & 0x1) == 1) { //baseDataOffsetPresent IsoTypeWriter.writeUInt64(byteBuffer, getBaseDataOffset()); } if ((getFlags() & 0x2) == 0x2) { //sampleDescriptionIndexPresent IsoTypeWriter.writeUInt32(byteBuffer, getSampleDescriptionIndex()); } if ((getFlags() & 0x8) == 0x8) { //defaultSampleDurationPresent IsoTypeWriter.writeUInt32(byteBuffer, getDefaultSampleDuration()); } if ((getFlags() & 0x10) == 0x10) { //defaultSampleSizePresent IsoTypeWriter.writeUInt32(byteBuffer, getDefaultSampleSize()); } if ((getFlags() & 0x20) == 0x20) { //defaultSampleFlagsPresent defaultSampleFlags.getContent(byteBuffer); } } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); trackId = IsoTypeReader.readUInt32(content); if ((getFlags() & 0x1) == 1) { //baseDataOffsetPresent baseDataOffset = IsoTypeReader.readUInt64(content); } if ((getFlags() & 0x2) == 0x2) { //sampleDescriptionIndexPresent sampleDescriptionIndex = IsoTypeReader.readUInt32(content); } if ((getFlags() & 0x8) == 0x8) { //defaultSampleDurationPresent defaultSampleDuration = IsoTypeReader.readUInt32(content); } if ((getFlags() & 0x10) == 0x10) { //defaultSampleSizePresent defaultSampleSize = IsoTypeReader.readUInt32(content); } if ((getFlags() & 0x20) == 0x20) { //defaultSampleFlagsPresent defaultSampleFlags = new SampleFlags(content); } if ((getFlags() & 0x10000) == 0x10000) { //durationIsEmpty durationIsEmpty = true; } if ((getFlags() & 0x20000) == 0x20000) { //defaultBaseIsMoof defaultBaseIsMoof = true; } } public boolean hasBaseDataOffset() { return (getFlags() & 0x1) != 0; } public boolean hasSampleDescriptionIndex() { return (getFlags() & 0x2) != 0; } public boolean hasDefaultSampleDuration() { return (getFlags() & 0x8) != 0; } public boolean hasDefaultSampleSize() { return (getFlags() & 0x10) != 0; } public boolean hasDefaultSampleFlags() { return (getFlags() & 0x20) != 0; } public long getTrackId() { return trackId; } public void setTrackId(long trackId) { this.trackId = trackId; } public long getBaseDataOffset() { return baseDataOffset; } public void setBaseDataOffset(long baseDataOffset) { if (baseDataOffset == -1) { setFlags(getFlags() & (Integer.MAX_VALUE ^ 0x1)); } else { setFlags(getFlags() | 0x1); // activate the field } this.baseDataOffset = baseDataOffset; } public long getSampleDescriptionIndex() { return sampleDescriptionIndex; } public void setSampleDescriptionIndex(long sampleDescriptionIndex) { if (sampleDescriptionIndex == -1) { setFlags(getFlags() & (Integer.MAX_VALUE ^ 0x2)); } else { setFlags(getFlags() | 0x2); // activate the field } this.sampleDescriptionIndex = sampleDescriptionIndex; } public long getDefaultSampleDuration() { return defaultSampleDuration; } public void setDefaultSampleDuration(long defaultSampleDuration) { setFlags(getFlags() | 0x8); // activate the field this.defaultSampleDuration = defaultSampleDuration; } public long getDefaultSampleSize() { return defaultSampleSize; } public void setDefaultSampleSize(long defaultSampleSize) { setFlags(getFlags() | 0x10); // activate the field this.defaultSampleSize = defaultSampleSize; } public SampleFlags getDefaultSampleFlags() { return defaultSampleFlags; } public void setDefaultSampleFlags(SampleFlags defaultSampleFlags) { setFlags(getFlags() | 0x20); // activate the field this.defaultSampleFlags = defaultSampleFlags; } public boolean isDurationIsEmpty() { return durationIsEmpty; } public void setDurationIsEmpty(boolean durationIsEmpty) { setFlags(getFlags() | 0x10000); // activate the field this.durationIsEmpty = durationIsEmpty; } public boolean isDefaultBaseIsMoof() { return defaultBaseIsMoof; } public void setDefaultBaseIsMoof(boolean defaultBaseIsMoof) { setFlags(getFlags() | 0x20000); // activate the field this.defaultBaseIsMoof = defaultBaseIsMoof; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("TrackFragmentHeaderBox"); sb.append("{trackId=").append(trackId); sb.append(", baseDataOffset=").append(baseDataOffset); sb.append(", sampleDescriptionIndex=").append(sampleDescriptionIndex); sb.append(", defaultSampleDuration=").append(defaultSampleDuration); sb.append(", defaultSampleSize=").append(defaultSampleSize); sb.append(", defaultSampleFlags=").append(defaultSampleFlags); sb.append(", durationIsEmpty=").append(durationIsEmpty); sb.append(", defaultBaseIsMoof=").append(defaultBaseIsMoof); sb.append('}'); return sb.toString(); } }
long size = 8; int flags = getFlags(); if ((flags & 0x1) == 1) { //baseDataOffsetPresent size += 8; } if ((flags & 0x2) == 0x2) { //sampleDescriptionIndexPresent size += 4; } if ((flags & 0x8) == 0x8) { //defaultSampleDurationPresent size += 4; } if ((flags & 0x10) == 0x10) { //defaultSampleSizePresent size += 4; } if ((flags & 0x20) == 0x20) { //defaultSampleFlagsPresent size += 4; } return size;
1,784
180
1,964
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/TrackReferenceTypeBox.java
TrackReferenceTypeBox
_parseDetails
class TrackReferenceTypeBox extends AbstractBox { long[] trackIds = new long[0]; // ‘hint’ the referenced track(s) contain the original media for this hint track // ‘cdsc‘ this track describes the referenced track. // 'hind' this track depends on the referenced hint track, i.e., it should only be used if the referenced hint track is used. // 'vdep' this track contains auxiliary depth video information for the referenced video track // 'vplx' this track contains auxiliary parallax video information for the referenced video track public TrackReferenceTypeBox(String type) { super(type); } @Override protected long getContentSize() { return trackIds.length * 4; } @Override protected void getContent(ByteBuffer byteBuffer) { for (long trackId : trackIds) { IsoTypeWriter.writeUInt32(byteBuffer, trackId); } } @Override protected void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} public long[] getTrackIds() { return trackIds; } public void setTrackIds(long[] trackIds) { this.trackIds = trackIds; } }
while (content.remaining() >= 4) { trackIds = Mp4Arrays.copyOfAndAppend(trackIds, new long[]{IsoTypeReader.readUInt32(content)}); }
324
56
380
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/VideoMediaHeaderBox.java
VideoMediaHeaderBox
getContent
class VideoMediaHeaderBox extends AbstractMediaHeaderBox { public static final String TYPE = "vmhd"; private int graphicsmode = 0; private int[] opcolor = new int[]{0, 0, 0}; public VideoMediaHeaderBox() { super(TYPE); this.flags = 1; } public int getGraphicsmode() { return graphicsmode; } public void setGraphicsmode(int graphicsmode) { this.graphicsmode = graphicsmode; } public int[] getOpcolor() { return opcolor; } public void setOpcolor(int[] opcolor) { this.opcolor = opcolor; } protected long getContentSize() { return 12; } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); graphicsmode = IsoTypeReader.readUInt16(content); opcolor = new int[3]; for (int i = 0; i < 3; i++) { opcolor[i] = IsoTypeReader.readUInt16(content); } } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} public String toString() { return "VideoMediaHeaderBox[graphicsmode=" + getGraphicsmode() + ";opcolor0=" + getOpcolor()[0] + ";opcolor1=" + getOpcolor()[1] + ";opcolor2=" + getOpcolor()[2] + "]"; } }
writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt16(byteBuffer, graphicsmode); for (int anOpcolor : opcolor) { IsoTypeWriter.writeUInt16(byteBuffer, anOpcolor); }
403
68
471
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/XmlBox.java
XmlBox
toString
class XmlBox extends AbstractFullBox { public static final String TYPE = "xml "; String xml = ""; public XmlBox() { super(TYPE); } public String getXml() { return xml; } public void setXml(String xml) { this.xml = xml; } @Override protected long getContentSize() { return 4 + Utf8.utf8StringLengthInBytes(xml); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); xml = IsoTypeReader.readString(content, content.remaining()); } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); byteBuffer.put(Utf8.convert(xml)); } @Override public String toString() {<FILL_FUNCTION_BODY>} }
return "XmlBox{" + "xml='" + xml + '\'' + '}';
243
28
271
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part14/AbstractDescriptorBox.java
AbstractDescriptorBox
_parseDetails
class AbstractDescriptorBox extends AbstractFullBox { private static Logger LOG = LoggerFactory.getLogger(AbstractDescriptorBox.class.getName()); protected BaseDescriptor descriptor; protected ByteBuffer data; public AbstractDescriptorBox(String type) { super(type); } public ByteBuffer getData() { return data; } public void setData(ByteBuffer data) { this.data = data; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); ((Buffer)data).rewind(); // has been fforwarded by parsing byteBuffer.put(data); } @Override protected long getContentSize() { return 4 + data.limit(); } public BaseDescriptor getDescriptor() { return descriptor; } public void setDescriptor(BaseDescriptor descriptor) { this.descriptor = descriptor; } public String getDescriptorAsString() { return descriptor.toString(); } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} }
parseVersionAndFlags(content); data = content.slice(); ((Buffer)content).position(content.position() + content.remaining()); try { ((Buffer)data).rewind(); descriptor = ObjectDescriptorFactory.createFrom(-1, data.duplicate()); } catch (IOException e) { LOG.warn("Error parsing ObjectDescriptor", e); //that's why we copied it ;) } catch (IndexOutOfBoundsException e) { LOG.warn("Error parsing ObjectDescriptor", e); //that's why we copied it ;) }
295
149
444
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part14/ESDescriptorBox.java
ESDescriptorBox
equals
class ESDescriptorBox extends AbstractDescriptorBox { public static final String TYPE = "esds"; public ESDescriptorBox() { super(TYPE); } public ESDescriptor getEsDescriptor() { return (ESDescriptor) super.getDescriptor(); } public void setEsDescriptor(ESDescriptor esDescriptor) { super.setDescriptor(esDescriptor); } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { return data != null ? data.hashCode() : 0; } protected long getContentSize() { ESDescriptor esd = getEsDescriptor(); if (esd != null) { return 4 + esd.getSize(); } else { return 4 + data.remaining(); } } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); ESDescriptor esd = getEsDescriptor(); if (esd != null) { byteBuffer.put((ByteBuffer)((Buffer)esd.serialize()).rewind()); } else { byteBuffer.put(data.duplicate()); } } }
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ESDescriptorBox that = (ESDescriptorBox) o; if (data != null ? !data.equals(that.data) : that.data != null) return false; return true;
328
87
415
<methods>public void <init>(java.lang.String) ,public void _parseDetails(java.nio.ByteBuffer) ,public java.nio.ByteBuffer getData() ,public org.mp4parser.boxes.iso14496.part1.objectdescriptors.BaseDescriptor getDescriptor() ,public java.lang.String getDescriptorAsString() ,public void setData(java.nio.ByteBuffer) ,public void setDescriptor(org.mp4parser.boxes.iso14496.part1.objectdescriptors.BaseDescriptor) <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer data,protected org.mp4parser.boxes.iso14496.part1.objectdescriptors.BaseDescriptor descriptor
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/HevcConfigurationBox.java
HevcConfigurationBox
equals
class HevcConfigurationBox extends AbstractBox { public static final String TYPE = "hvcC"; private HevcDecoderConfigurationRecord hevcDecoderConfigurationRecord; public HevcConfigurationBox() { super(TYPE); hevcDecoderConfigurationRecord = new HevcDecoderConfigurationRecord(); } @Override protected long getContentSize() { return hevcDecoderConfigurationRecord.getSize(); } @Override protected void getContent(ByteBuffer byteBuffer) { hevcDecoderConfigurationRecord.write(byteBuffer); } @Override protected void _parseDetails(ByteBuffer content) { hevcDecoderConfigurationRecord.parse(content); } public HevcDecoderConfigurationRecord getHevcDecoderConfigurationRecord() { return hevcDecoderConfigurationRecord; } public void setHevcDecoderConfigurationRecord(HevcDecoderConfigurationRecord hevcDecoderConfigurationRecord) { this.hevcDecoderConfigurationRecord = hevcDecoderConfigurationRecord; } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { return hevcDecoderConfigurationRecord != null ? hevcDecoderConfigurationRecord.hashCode() : 0; } public int getConfigurationVersion() { return hevcDecoderConfigurationRecord.configurationVersion; } public int getGeneral_profile_space() { return hevcDecoderConfigurationRecord.general_profile_space; } public boolean isGeneral_tier_flag() { return hevcDecoderConfigurationRecord.general_tier_flag; } public int getGeneral_profile_idc() { return hevcDecoderConfigurationRecord.general_profile_idc; } public long getGeneral_profile_compatibility_flags() { return hevcDecoderConfigurationRecord.general_profile_compatibility_flags; } public long getGeneral_constraint_indicator_flags() { return hevcDecoderConfigurationRecord.general_constraint_indicator_flags; } public int getGeneral_level_idc() { return hevcDecoderConfigurationRecord.general_level_idc; } public int getMin_spatial_segmentation_idc() { return hevcDecoderConfigurationRecord.min_spatial_segmentation_idc; } public int getParallelismType() { return hevcDecoderConfigurationRecord.parallelismType; } public int getChromaFormat() { return hevcDecoderConfigurationRecord.chromaFormat; } public int getBitDepthLumaMinus8() { return hevcDecoderConfigurationRecord.bitDepthLumaMinus8; } public int getBitDepthChromaMinus8() { return hevcDecoderConfigurationRecord.bitDepthChromaMinus8; } public int getAvgFrameRate() { return hevcDecoderConfigurationRecord.avgFrameRate; } public int getNumTemporalLayers() { return hevcDecoderConfigurationRecord.numTemporalLayers; } public int getLengthSizeMinusOne() { return hevcDecoderConfigurationRecord.lengthSizeMinusOne; } public boolean isTemporalIdNested() { return hevcDecoderConfigurationRecord.temporalIdNested; } public int getConstantFrameRate() { return hevcDecoderConfigurationRecord.constantFrameRate; } public List<HevcDecoderConfigurationRecord.Array> getArrays() { return hevcDecoderConfigurationRecord.arrays; } }
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HevcConfigurationBox that = (HevcConfigurationBox) o; if (hevcDecoderConfigurationRecord != null ? !hevcDecoderConfigurationRecord.equals(that.hevcDecoderConfigurationRecord) : that.hevcDecoderConfigurationRecord != null) return false; return true;
939
111
1,050
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/PriotityRangeBox.java
PriotityRangeBox
_parseDetails
class PriotityRangeBox extends AbstractBox { public static final String TYPE = "svpr"; int reserved1 = 0; int min_priorityId; int reserved2 = 0; int max_priorityId; public PriotityRangeBox() { super(TYPE); } @Override protected long getContentSize() { return 2; } @Override protected void getContent(ByteBuffer byteBuffer) { IsoTypeWriter.writeUInt8(byteBuffer, (reserved1 << 6) + min_priorityId); IsoTypeWriter.writeUInt8(byteBuffer, (reserved2 << 6) + max_priorityId); } @Override protected void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} public int getReserved1() { return reserved1; } public void setReserved1(int reserved1) { this.reserved1 = reserved1; } public int getMin_priorityId() { return min_priorityId; } public void setMin_priorityId(int min_priorityId) { this.min_priorityId = min_priorityId; } public int getReserved2() { return reserved2; } public void setReserved2(int reserved2) { this.reserved2 = reserved2; } public int getMax_priorityId() { return max_priorityId; } public void setMax_priorityId(int max_priorityId) { this.max_priorityId = max_priorityId; } }
min_priorityId = IsoTypeReader.readUInt8(content); reserved1 = (min_priorityId & 0xC0) >> 6; min_priorityId &= 0x3F; max_priorityId = IsoTypeReader.readUInt8(content); reserved2 = (max_priorityId & 0xC0) >> 6; max_priorityId &= 0x3F;
438
115
553
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/StepwiseTemporalLayerEntry.java
StepwiseTemporalLayerEntry
equals
class StepwiseTemporalLayerEntry extends GroupEntry { public static final String TYPE = "stsa"; @Override public void parse(ByteBuffer byteBuffer) { } @Override public String getType() { return TYPE; } @Override public ByteBuffer get() { return ByteBuffer.allocate(0); } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { return 37; } }
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return true;
146
41
187
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/SyncSampleEntry.java
SyncSampleEntry
equals
class SyncSampleEntry extends GroupEntry { public static final String TYPE = "sync"; int reserved; int nalUnitType; @Override public void parse(ByteBuffer byteBuffer) { int a = IsoTypeReader.readUInt8(byteBuffer); reserved = (a & 0xC0) >> 6; nalUnitType = a & 0x3F; } @Override public ByteBuffer get() { ByteBuffer b = ByteBuffer.allocate(1); IsoTypeWriter.writeUInt8(b, (nalUnitType + (reserved << 6))); return (ByteBuffer) ((Buffer)b).rewind(); } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { int result = reserved; result = 31 * result + nalUnitType; return result; } public int getReserved() { return reserved; } public void setReserved(int reserved) { this.reserved = reserved; } public int getNalUnitType() { return nalUnitType; } public void setNalUnitType(int nalUnitType) { this.nalUnitType = nalUnitType; } @Override public String getType() { return TYPE; } @Override public String toString() { return "SyncSampleEntry{" + "reserved=" + reserved + ", nalUnitType=" + nalUnitType + '}'; } }
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SyncSampleEntry that = (SyncSampleEntry) o; if (nalUnitType != that.nalUnitType) return false; if (reserved != that.reserved) return false; return true;
424
96
520
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/TemporalSubLayerSampleGroup.java
TemporalSubLayerSampleGroup
equals
class TemporalSubLayerSampleGroup extends GroupEntry { public static final String TYPE = "tsas"; int i; @Override public void parse(ByteBuffer byteBuffer) { } @Override public String getType() { return TYPE; } @Override public ByteBuffer get() { return ByteBuffer.allocate(0); } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { return 41; } }
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return true;
150
42
192
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/TierBitRateBox.java
TierBitRateBox
_parseDetails
class TierBitRateBox extends AbstractBox { public static final String TYPE = "tibr"; long baseBitRate; long maxBitRate; long avgBitRate; long tierBaseBitRate; long tierMaxBitRate; long tierAvgBitRate; public TierBitRateBox() { super(TYPE); } @Override protected long getContentSize() { return 24; } @Override protected void getContent(ByteBuffer byteBuffer) { IsoTypeWriter.writeUInt32(byteBuffer, baseBitRate); IsoTypeWriter.writeUInt32(byteBuffer, maxBitRate); IsoTypeWriter.writeUInt32(byteBuffer, avgBitRate); IsoTypeWriter.writeUInt32(byteBuffer, tierBaseBitRate); IsoTypeWriter.writeUInt32(byteBuffer, tierMaxBitRate); IsoTypeWriter.writeUInt32(byteBuffer, tierAvgBitRate); } @Override protected void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} public long getBaseBitRate() { return baseBitRate; } public void setBaseBitRate(long baseBitRate) { this.baseBitRate = baseBitRate; } public long getMaxBitRate() { return maxBitRate; } public void setMaxBitRate(long maxBitRate) { this.maxBitRate = maxBitRate; } public long getAvgBitRate() { return avgBitRate; } public void setAvgBitRate(long avgBitRate) { this.avgBitRate = avgBitRate; } public long getTierBaseBitRate() { return tierBaseBitRate; } public void setTierBaseBitRate(long tierBaseBitRate) { this.tierBaseBitRate = tierBaseBitRate; } public long getTierMaxBitRate() { return tierMaxBitRate; } public void setTierMaxBitRate(long tierMaxBitRate) { this.tierMaxBitRate = tierMaxBitRate; } public long getTierAvgBitRate() { return tierAvgBitRate; } public void setTierAvgBitRate(long tierAvgBitRate) { this.tierAvgBitRate = tierAvgBitRate; } }
baseBitRate = IsoTypeReader.readUInt32(content); maxBitRate = IsoTypeReader.readUInt32(content); avgBitRate = IsoTypeReader.readUInt32(content); tierBaseBitRate = IsoTypeReader.readUInt32(content); tierMaxBitRate = IsoTypeReader.readUInt32(content); tierAvgBitRate = IsoTypeReader.readUInt32(content);
661
125
786
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part15/TierInfoBox.java
TierInfoBox
getContent
class TierInfoBox extends AbstractBox { public static final String TYPE = "tiri"; int tierID; int profileIndication; int profile_compatibility; int levelIndication; int reserved1 = 0; int visualWidth; int visualHeight; int discardable; int constantFrameRate; int reserved2 = 0; int frameRate; public TierInfoBox() { super(TYPE); } @Override protected long getContentSize() { return 13; } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} @Override protected void _parseDetails(ByteBuffer content) { tierID = IsoTypeReader.readUInt16(content); profileIndication = IsoTypeReader.readUInt8(content); profile_compatibility = IsoTypeReader.readUInt8(content); levelIndication = IsoTypeReader.readUInt8(content); reserved1 = IsoTypeReader.readUInt8(content); visualWidth = IsoTypeReader.readUInt16(content); visualHeight = IsoTypeReader.readUInt16(content); int a = IsoTypeReader.readUInt8(content); discardable = (a & 0xC0) >> 6; constantFrameRate = (a & 0x30) >> 4; reserved2 = a & 0xf; frameRate = IsoTypeReader.readUInt16(content); } public int getTierID() { return tierID; } public void setTierID(int tierID) { this.tierID = tierID; } public int getProfileIndication() { return profileIndication; } public void setProfileIndication(int profileIndication) { this.profileIndication = profileIndication; } public int getProfile_compatibility() { return profile_compatibility; } public void setProfile_compatibility(int profile_compatibility) { this.profile_compatibility = profile_compatibility; } public int getLevelIndication() { return levelIndication; } public void setLevelIndication(int levelIndication) { this.levelIndication = levelIndication; } public int getReserved1() { return reserved1; } public void setReserved1(int reserved1) { this.reserved1 = reserved1; } public int getVisualWidth() { return visualWidth; } public void setVisualWidth(int visualWidth) { this.visualWidth = visualWidth; } public int getVisualHeight() { return visualHeight; } public void setVisualHeight(int visualHeight) { this.visualHeight = visualHeight; } public int getDiscardable() { return discardable; } public void setDiscardable(int discardable) { this.discardable = discardable; } public int getConstantFrameRate() { return constantFrameRate; } public void setConstantFrameRate(int constantFrameRate) { this.constantFrameRate = constantFrameRate; } public int getReserved2() { return reserved2; } public void setReserved2(int reserved2) { this.reserved2 = reserved2; } public int getFrameRate() { return frameRate; } public void setFrameRate(int frameRate) { this.frameRate = frameRate; } }
IsoTypeWriter.writeUInt16(byteBuffer, tierID); IsoTypeWriter.writeUInt8(byteBuffer, profileIndication); IsoTypeWriter.writeUInt8(byteBuffer, profile_compatibility); IsoTypeWriter.writeUInt8(byteBuffer, levelIndication); IsoTypeWriter.writeUInt8(byteBuffer, reserved1); IsoTypeWriter.writeUInt16(byteBuffer, visualWidth); IsoTypeWriter.writeUInt16(byteBuffer, visualHeight); IsoTypeWriter.writeUInt8(byteBuffer, (discardable << 6) + (constantFrameRate << 4) + reserved2); IsoTypeWriter.writeUInt16(byteBuffer, frameRate);
982
196
1,178
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso14496/part30/XMLSubtitleSampleEntry.java
XMLSubtitleSampleEntry
getBox
class XMLSubtitleSampleEntry extends AbstractSampleEntry { public static final String TYPE = "stpp"; private String namespace = ""; private String schemaLocation = ""; private String auxiliaryMimeTypes = ""; public XMLSubtitleSampleEntry() { super(TYPE); } @Override public long getSize() { long s = getContainerSize(); long t = 8 + namespace.length() + schemaLocation.length() + auxiliaryMimeTypes.length() + 3; return s + t + ((largeBox || (s + t + 8) >= (1L << 32)) ? 16 : 8); } @Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer byteBuffer = ByteBuffer.allocate(8); dataSource.read((ByteBuffer) ((Buffer)byteBuffer).rewind()); ((Buffer)byteBuffer).position(6); dataReferenceIndex = IsoTypeReader.readUInt16(byteBuffer); byte[] namespaceBytes = new byte[0]; int read; while ((read = Channels.newInputStream(dataSource).read()) != 0) { namespaceBytes = Mp4Arrays.copyOfAndAppend(namespaceBytes, (byte) read); } namespace = Utf8.convert(namespaceBytes); byte[] schemaLocationBytes = new byte[0]; while ((read = Channels.newInputStream(dataSource).read()) != 0) { schemaLocationBytes = Mp4Arrays.copyOfAndAppend(schemaLocationBytes, (byte) read); } schemaLocation = Utf8.convert(schemaLocationBytes); byte[] auxiliaryMimeTypesBytes = new byte[0]; while ((read = Channels.newInputStream(dataSource).read()) != 0) { auxiliaryMimeTypesBytes = Mp4Arrays.copyOfAndAppend(auxiliaryMimeTypesBytes, (byte) read); } auxiliaryMimeTypes = Utf8.convert(auxiliaryMimeTypesBytes); initContainer(dataSource, contentSize - (header.remaining() + namespace.length() + schemaLocation.length() + auxiliaryMimeTypes.length() + 3), boxParser); } @Override public void getBox(WritableByteChannel writableByteChannel) throws IOException {<FILL_FUNCTION_BODY>} public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } public String getSchemaLocation() { return schemaLocation; } public void setSchemaLocation(String schemaLocation) { this.schemaLocation = schemaLocation; } public String getAuxiliaryMimeTypes() { return auxiliaryMimeTypes; } public void setAuxiliaryMimeTypes(String auxiliaryMimeTypes) { this.auxiliaryMimeTypes = auxiliaryMimeTypes; } }
writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(8 + namespace.length() + schemaLocation.length() + auxiliaryMimeTypes.length() + 3); ((Buffer)byteBuffer).position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); IsoTypeWriter.writeZeroTermUtf8String(byteBuffer, namespace); IsoTypeWriter.writeZeroTermUtf8String(byteBuffer, schemaLocation); IsoTypeWriter.writeZeroTermUtf8String(byteBuffer, auxiliaryMimeTypes); writableByteChannel.write((ByteBuffer) ((Buffer)byteBuffer).rewind()); writeContainer(writableByteChannel);
749
178
927
<methods>public abstract void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public int getDataReferenceIndex() ,public abstract void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setDataReferenceIndex(int) <variables>protected int dataReferenceIndex
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso23001/part7/AbstractTrackEncryptionBox.java
AbstractTrackEncryptionBox
getDefault_KID
class AbstractTrackEncryptionBox extends AbstractFullBox { int defaultAlgorithmId; int defaultIvSize; byte[] default_KID; protected AbstractTrackEncryptionBox(String type) { super(type); } public int getDefaultAlgorithmId() { return defaultAlgorithmId; } public void setDefaultAlgorithmId(int defaultAlgorithmId) { this.defaultAlgorithmId = defaultAlgorithmId; } public int getDefaultIvSize() { return defaultIvSize; } public void setDefaultIvSize(int defaultIvSize) { this.defaultIvSize = defaultIvSize; } public UUID getDefault_KID() {<FILL_FUNCTION_BODY>} public void setDefault_KID(UUID uuid) { ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); this.default_KID = bb.array(); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); defaultAlgorithmId = IsoTypeReader.readUInt24(content); defaultIvSize = IsoTypeReader.readUInt8(content); default_KID = new byte[16]; content.get(default_KID); } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt24(byteBuffer, defaultAlgorithmId); IsoTypeWriter.writeUInt8(byteBuffer, defaultIvSize); byteBuffer.put(default_KID); } @Override protected long getContentSize() { return 24; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AbstractTrackEncryptionBox that = (AbstractTrackEncryptionBox) o; if (defaultAlgorithmId != that.defaultAlgorithmId) return false; if (defaultIvSize != that.defaultIvSize) return false; if (!Arrays.equals(default_KID, that.default_KID)) return false; return true; } @Override public int hashCode() { int result = defaultAlgorithmId; result = 31 * result + defaultIvSize; result = 31 * result + (default_KID != null ? Arrays.hashCode(default_KID) : 0); return result; } }
ByteBuffer b = ByteBuffer.wrap(default_KID); b.order(ByteOrder.BIG_ENDIAN); return new UUID(b.getLong(), b.getLong());
707
50
757
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso23001/part7/ProtectionSystemSpecificHeaderBox.java
ProtectionSystemSpecificHeaderBox
getContent
class ProtectionSystemSpecificHeaderBox extends AbstractFullBox { public static final String TYPE = "pssh"; public static byte[] OMA2_SYSTEM_ID = UUIDConverter.convert(UUID.fromString("A2B55680-6F43-11E0-9A3F-0002A5D5C51B")); public static byte[] WIDEVINE = UUIDConverter.convert(UUID.fromString("edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")); public static byte[] PLAYREADY_SYSTEM_ID = UUIDConverter.convert(UUID.fromString("9A04F079-9840-4286-AB92-E65BE0885F95")); byte[] content; byte[] systemId; List<UUID> keyIds = new ArrayList<UUID>(); public ProtectionSystemSpecificHeaderBox(byte[] systemId, byte[] content) { super(TYPE); this.content = content; this.systemId = systemId; } public ProtectionSystemSpecificHeaderBox() { super(TYPE); } public List<UUID> getKeyIds() { return keyIds; } public void setKeyIds(List<UUID> keyIds) { this.keyIds = keyIds; } public byte[] getSystemId() { return systemId; } public void setSystemId(byte[] systemId) { assert systemId.length == 16; this.systemId = systemId; } public byte[] getContent() { return content; } public void setContent(byte[] content) { this.content = content; } @Override protected long getContentSize() { long l = 24 + content.length; if (getVersion() > 0) { l += 4; l += 16 * keyIds.size(); } return l; } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} @Override protected void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); systemId = new byte[16]; content.get(systemId); if (getVersion() > 0) { int count = CastUtils.l2i(IsoTypeReader.readUInt32(content)); while (count-- > 0) { byte[] k = new byte[16]; content.get(k); keyIds.add(UUIDConverter.convert(k)); } } long length = IsoTypeReader.readUInt32(content); this.content = new byte[content.remaining()]; content.get(this.content); assert length == this.content.length; } }
writeVersionAndFlags(byteBuffer); assert systemId.length == 16; byteBuffer.put(systemId, 0, 16); if (getVersion() > 0) { IsoTypeWriter.writeUInt32(byteBuffer, keyIds.size()); for (UUID keyId : keyIds) { byteBuffer.put(UUIDConverter.convert(keyId)); } } IsoTypeWriter.writeUInt32(byteBuffer, content.length); byteBuffer.put(content);
739
136
875
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/iso23009/part1/EventMessageBox.java
EventMessageBox
getContent
class EventMessageBox extends AbstractFullBox { public static final String TYPE = "emsg"; String schemeIdUri; String value; long timescale; long presentationTimeDelta; long eventDuration; long id; byte[] messageData; public EventMessageBox() { super(TYPE); } @Override protected void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); schemeIdUri = IsoTypeReader.readString(content); value = IsoTypeReader.readString(content); timescale = IsoTypeReader.readUInt32(content); presentationTimeDelta = IsoTypeReader.readUInt32(content); eventDuration = IsoTypeReader.readUInt32(content); id = IsoTypeReader.readUInt32(content); messageData = new byte[content.remaining()]; content.get(messageData); } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} @Override protected long getContentSize() { return 22 + Utf8.utf8StringLengthInBytes(schemeIdUri) + Utf8.utf8StringLengthInBytes(value) + messageData.length; } public String getSchemeIdUri() { return schemeIdUri; } public void setSchemeIdUri(String schemeIdUri) { this.schemeIdUri = schemeIdUri; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public long getTimescale() { return timescale; } public void setTimescale(long timescale) { this.timescale = timescale; } public long getPresentationTimeDelta() { return presentationTimeDelta; } public void setPresentationTimeDelta(long presentationTimeDelta) { this.presentationTimeDelta = presentationTimeDelta; } public long getEventDuration() { return eventDuration; } public void setEventDuration(long eventDuration) { this.eventDuration = eventDuration; } public long getId() { return id; } public void setId(long id) { this.id = id; } public byte[] getMessageData() { return messageData; } public void setMessageData(byte[] messageData) { this.messageData = messageData; } }
writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUtf8String(byteBuffer, schemeIdUri); IsoTypeWriter.writeUtf8String(byteBuffer, value); IsoTypeWriter.writeUInt32(byteBuffer, timescale); IsoTypeWriter.writeUInt32(byteBuffer, presentationTimeDelta); IsoTypeWriter.writeUInt32(byteBuffer, eventDuration); IsoTypeWriter.writeUInt32(byteBuffer, id); byteBuffer.put(messageData);
659
137
796
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/microsoft/ProtectionSpecificHeader.java
ProtectionSpecificHeader
toString
class ProtectionSpecificHeader { protected static Map<UUID, Class<? extends ProtectionSpecificHeader>> uuidRegistry = new HashMap<UUID, Class<? extends ProtectionSpecificHeader>>(); public static ProtectionSpecificHeader createFor(UUID systemId, ByteBuffer bufferWrapper) { final Class<? extends ProtectionSpecificHeader> aClass = uuidRegistry.get(systemId); ProtectionSpecificHeader protectionSpecificHeader = null; if (aClass != null) { try { protectionSpecificHeader = aClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } if (protectionSpecificHeader == null) { protectionSpecificHeader = new GenericHeader(); } protectionSpecificHeader.parse(bufferWrapper); return protectionSpecificHeader; } public abstract UUID getSystemId(); @Override public boolean equals(Object obj) { throw new RuntimeException("somebody called equals on me but that's not supposed to happen."); } public abstract void parse(ByteBuffer byteBuffer); public abstract ByteBuffer getData(); @Override public String toString() {<FILL_FUNCTION_BODY>} }
final StringBuilder sb = new StringBuilder(); sb.append("ProtectionSpecificHeader"); sb.append("{data="); ByteBuffer data = getData().duplicate(); ((Buffer)data).rewind(); byte[] bytes = new byte[data.limit()]; data.get(bytes); sb.append(Hex.encodeHex(bytes)); sb.append('}'); return sb.toString();
335
111
446
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/microsoft/TfxdBox.java
TfxdBox
getContent
class TfxdBox extends AbstractFullBox { public long fragmentAbsoluteTime; public long fragmentAbsoluteDuration; public TfxdBox() { super("uuid"); } @Override public byte[] getUserType() { return new byte[]{(byte) 0x6d, (byte) 0x1d, (byte) 0x9b, (byte) 0x05, (byte) 0x42, (byte) 0xd5, (byte) 0x44, (byte) 0xe6, (byte) 0x80, (byte) 0xe2, 0x14, (byte) 0x1d, (byte) 0xaf, (byte) 0xf7, (byte) 0x57, (byte) 0xb2}; } @Override protected long getContentSize() { return getVersion() == 0x01 ? 20 : 12; } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); if (getVersion() == 0x01) { fragmentAbsoluteTime = IsoTypeReader.readUInt64(content); fragmentAbsoluteDuration = IsoTypeReader.readUInt64(content); } else { fragmentAbsoluteTime = IsoTypeReader.readUInt32(content); fragmentAbsoluteDuration = IsoTypeReader.readUInt32(content); } } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} public long getFragmentAbsoluteTime() { return fragmentAbsoluteTime; } public long getFragmentAbsoluteDuration() { return fragmentAbsoluteDuration; } }
writeVersionAndFlags(byteBuffer); if (getVersion() == 0x01) { IsoTypeWriter.writeUInt64(byteBuffer, fragmentAbsoluteTime); IsoTypeWriter.writeUInt64(byteBuffer, fragmentAbsoluteDuration); } else { IsoTypeWriter.writeUInt32(byteBuffer, fragmentAbsoluteTime); IsoTypeWriter.writeUInt32(byteBuffer, fragmentAbsoluteDuration); }
458
119
577
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/microsoft/UuidBasedProtectionSystemSpecificHeaderBox.java
UuidBasedProtectionSystemSpecificHeaderBox
getContent
class UuidBasedProtectionSystemSpecificHeaderBox extends AbstractFullBox { public static byte[] USER_TYPE = new byte[]{(byte) 0xd0, (byte) 0x8a, 0x4f, 0x18, 0x10, (byte) 0xf3, 0x4a, (byte) 0x82, (byte) 0xb6, (byte) 0xc8, 0x32, (byte) 0xd8, (byte) 0xab, (byte) 0xa1, (byte) 0x83, (byte) 0xd3}; UUID systemId; ProtectionSpecificHeader protectionSpecificHeader; public UuidBasedProtectionSystemSpecificHeaderBox() { super("uuid", USER_TYPE); } @Override protected long getContentSize() { return 24 + protectionSpecificHeader.getData().limit(); } @Override public byte[] getUserType() { return USER_TYPE; } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} @Override protected void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); byte[] systemIdBytes = new byte[16]; content.get(systemIdBytes); systemId = UUIDConverter.convert(systemIdBytes); int dataSize = CastUtils.l2i(IsoTypeReader.readUInt32(content)); protectionSpecificHeader = ProtectionSpecificHeader.createFor(systemId, content); } public UUID getSystemId() { return systemId; } public void setSystemId(UUID systemId) { this.systemId = systemId; } public String getSystemIdString() { return systemId.toString(); } public ProtectionSpecificHeader getProtectionSpecificHeader() { return protectionSpecificHeader; } public void setProtectionSpecificHeader(ProtectionSpecificHeader protectionSpecificHeader) { this.protectionSpecificHeader = protectionSpecificHeader; } public String getProtectionSpecificHeaderString() { return protectionSpecificHeader.toString(); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("UuidBasedProtectionSystemSpecificHeaderBox"); sb.append("{systemId=").append(systemId.toString()); sb.append(", dataSize=").append(protectionSpecificHeader.getData().limit()); sb.append('}'); return sb.toString(); } }
writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt64(byteBuffer, systemId.getMostSignificantBits()); IsoTypeWriter.writeUInt64(byteBuffer, systemId.getLeastSignificantBits()); ByteBuffer data = protectionSpecificHeader.getData(); ((Buffer)data).rewind(); IsoTypeWriter.writeUInt32(byteBuffer, data.limit()); byteBuffer.put(data);
685
119
804
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/microsoft/contentprotection/PlayReadyHeader.java
RMHeader
toString
class RMHeader extends PlayReadyRecord { String header; public RMHeader() { super(0x01); } @Override public void parse(ByteBuffer bytes) { try { byte[] str = new byte[bytes.slice().limit()]; bytes.get(str); header = new String(str, "UTF-16LE"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } @Override public ByteBuffer getValue() { byte[] headerBytes; try { headerBytes = header.getBytes("UTF-16LE"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return ByteBuffer.wrap(headerBytes); } public String getHeader() { return header; } public void setHeader(String header) { this.header = header; } @Override public String toString() {<FILL_FUNCTION_BODY>} }
final StringBuilder sb = new StringBuilder(); sb.append("RMHeader"); sb.append("{length=").append(getValue().limit()); sb.append(", header='").append(header).append('\''); sb.append('}'); return sb.toString();
270
74
344
<methods>public non-sealed void <init>() ,public static org.mp4parser.boxes.microsoft.ProtectionSpecificHeader createFor(java.util.UUID, java.nio.ByteBuffer) ,public boolean equals(java.lang.Object) ,public abstract java.nio.ByteBuffer getData() ,public abstract java.util.UUID getSystemId() ,public abstract void parse(java.nio.ByteBuffer) ,public java.lang.String toString() <variables>protected static Map<java.util.UUID,Class<? extends org.mp4parser.boxes.microsoft.ProtectionSpecificHeader>> uuidRegistry
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/oma/OmaDrmAccessUnitFormatBox.java
OmaDrmAccessUnitFormatBox
_parseDetails
class OmaDrmAccessUnitFormatBox extends AbstractFullBox { public static final String TYPE = "odaf"; private boolean selectiveEncryption; private byte allBits; private int keyIndicatorLength; private int initVectorLength; public OmaDrmAccessUnitFormatBox() { super("odaf"); } protected long getContentSize() { return 7; } public boolean isSelectiveEncryption() { return selectiveEncryption; } public int getKeyIndicatorLength() { return keyIndicatorLength; } public void setKeyIndicatorLength(int keyIndicatorLength) { this.keyIndicatorLength = keyIndicatorLength; } public int getInitVectorLength() { return initVectorLength; } public void setInitVectorLength(int initVectorLength) { this.initVectorLength = initVectorLength; } public void setAllBits(byte allBits) { this.allBits = allBits; selectiveEncryption = (allBits & 0x80) == 0x80; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt8(byteBuffer, allBits); IsoTypeWriter.writeUInt8(byteBuffer, keyIndicatorLength); IsoTypeWriter.writeUInt8(byteBuffer, initVectorLength); } }
parseVersionAndFlags(content); allBits = (byte) IsoTypeReader.readUInt8(content); selectiveEncryption = (allBits & 0x80) == 0x80; keyIndicatorLength = IsoTypeReader.readUInt8(content); initVectorLength = IsoTypeReader.readUInt8(content);
424
95
519
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/sampleentry/AmrSpecificBox.java
AmrSpecificBox
toString
class AmrSpecificBox extends AbstractBox { public static final String TYPE = "damr"; private String vendor; private int decoderVersion; private int modeSet; private int modeChangePeriod; private int framesPerSample; public AmrSpecificBox() { super(TYPE); } public String getVendor() { return vendor; } public int getDecoderVersion() { return decoderVersion; } public int getModeSet() { return modeSet; } public int getModeChangePeriod() { return modeChangePeriod; } public int getFramesPerSample() { return framesPerSample; } protected long getContentSize() { return 9; } @Override public void _parseDetails(ByteBuffer content) { byte[] v = new byte[4]; content.get(v); vendor = IsoFile.bytesToFourCC(v); decoderVersion = IsoTypeReader.readUInt8(content); modeSet = IsoTypeReader.readUInt16(content); modeChangePeriod = IsoTypeReader.readUInt8(content); framesPerSample = IsoTypeReader.readUInt8(content); } public void getContent(ByteBuffer byteBuffer) { byteBuffer.put(IsoFile.fourCCtoBytes(vendor)); IsoTypeWriter.writeUInt8(byteBuffer, decoderVersion); IsoTypeWriter.writeUInt16(byteBuffer, modeSet); IsoTypeWriter.writeUInt8(byteBuffer, modeChangePeriod); IsoTypeWriter.writeUInt8(byteBuffer, framesPerSample); } public String toString() {<FILL_FUNCTION_BODY>} }
StringBuilder buffer = new StringBuilder(); buffer.append("AmrSpecificBox[vendor=").append(getVendor()); buffer.append(";decoderVersion=").append(getDecoderVersion()); buffer.append(";modeSet=").append(getModeSet()); buffer.append(";modeChangePeriod=").append(getModeChangePeriod()); buffer.append(";framesPerSample=").append(getFramesPerSample()); buffer.append("]"); return buffer.toString();
464
123
587
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/sampleentry/DfxpSampleEntry.java
DfxpSampleEntry
getSize
class DfxpSampleEntry extends AbstractSampleEntry { public DfxpSampleEntry() { super("dfxp"); } public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer content = ByteBuffer.allocate(8); dataSource.read(content); ((Buffer)content).position(6); dataReferenceIndex = IsoTypeReader.readUInt16(content); } public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(8); ((Buffer)byteBuffer).position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); writableByteChannel.write(byteBuffer); } @Override public long getSize() {<FILL_FUNCTION_BODY>} }
long s = getContainerSize(); long t = 8; return s + t + ((largeBox || (s + t + 8) >= (1L << 32)) ? 16 : 8);
241
53
294
<methods>public abstract void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public int getDataReferenceIndex() ,public abstract void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setDataReferenceIndex(int) <variables>protected int dataReferenceIndex
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/sampleentry/MpegSampleEntry.java
MpegSampleEntry
parse
class MpegSampleEntry extends AbstractSampleEntry { public MpegSampleEntry() { super("mp4s"); } public MpegSampleEntry(String type) { super(type); } @Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException {<FILL_FUNCTION_BODY>} @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); } public String toString() { return "MpegSampleEntry" + getBoxes(); } @Override public long getSize() { long s = getContainerSize(); long t = 8; // bytes to container start return s + t + ((largeBox || (s + t) >= (1L << 32)) ? 16 : 8); } }
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);
314
81
395
<methods>public abstract void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public int getDataReferenceIndex() ,public abstract void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setDataReferenceIndex(int) <variables>protected int dataReferenceIndex
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/sampleentry/Ovc1VisualSampleEntryImpl.java
Ovc1VisualSampleEntryImpl
parse
class Ovc1VisualSampleEntryImpl extends AbstractSampleEntry { public static final String TYPE = "ovc1"; private byte[] vc1Content = new byte[0]; public Ovc1VisualSampleEntryImpl() { super(TYPE); } public byte[] getVc1Content() { return vc1Content; } public void setVc1Content(byte[] vc1Content) { this.vc1Content = vc1Content; } @Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException {<FILL_FUNCTION_BODY>} @Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(8); ((Buffer)byteBuffer).position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); writableByteChannel.write((ByteBuffer) ((Buffer)byteBuffer).rewind()); writableByteChannel.write(ByteBuffer.wrap(vc1Content)); } @Override public long getSize() { long header = (largeBox || (vc1Content.length + 16) >= (1L << 32)) ? 16 : 8; return header + vc1Content.length + 8; } }
ByteBuffer byteBuffer = ByteBuffer.allocate(CastUtils.l2i(contentSize)); dataSource.read(byteBuffer); ((Buffer)byteBuffer).position(6); dataReferenceIndex = IsoTypeReader.readUInt16(byteBuffer); vc1Content = new byte[byteBuffer.remaining()]; byteBuffer.get(vc1Content);
364
96
460
<methods>public abstract void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public int getDataReferenceIndex() ,public abstract void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setDataReferenceIndex(int) <variables>protected int dataReferenceIndex
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/sampleentry/TextSampleEntry.java
StyleRecord
parse
class StyleRecord { int startChar; int endChar; int fontId; int faceStyleFlags; int fontSize; int[] textColor = new int[]{0xff, 0xff, 0xff, 0xff}; public StyleRecord() { } public StyleRecord(int startChar, int endChar, int fontId, int faceStyleFlags, int fontSize, int[] textColor) { this.startChar = startChar; this.endChar = endChar; this.fontId = fontId; this.faceStyleFlags = faceStyleFlags; this.fontSize = fontSize; this.textColor = textColor; } public void parse(ByteBuffer in) {<FILL_FUNCTION_BODY>} public void getContent(ByteBuffer bb) { IsoTypeWriter.writeUInt16(bb, startChar); IsoTypeWriter.writeUInt16(bb, endChar); IsoTypeWriter.writeUInt16(bb, fontId); IsoTypeWriter.writeUInt8(bb, faceStyleFlags); IsoTypeWriter.writeUInt8(bb, fontSize); IsoTypeWriter.writeUInt8(bb, textColor[0]); IsoTypeWriter.writeUInt8(bb, textColor[1]); IsoTypeWriter.writeUInt8(bb, textColor[2]); IsoTypeWriter.writeUInt8(bb, textColor[3]); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StyleRecord that = (StyleRecord) o; if (endChar != that.endChar) return false; if (faceStyleFlags != that.faceStyleFlags) return false; if (fontId != that.fontId) return false; if (fontSize != that.fontSize) return false; if (startChar != that.startChar) return false; if (!Arrays.equals(textColor, that.textColor)) return false; return true; } @Override public int hashCode() { int result = startChar; result = 31 * result + endChar; result = 31 * result + fontId; result = 31 * result + faceStyleFlags; result = 31 * result + fontSize; result = 31 * result + (textColor != null ? Arrays.hashCode(textColor) : 0); return result; } public int getSize() { return 12; } }
startChar = IsoTypeReader.readUInt16(in); endChar = IsoTypeReader.readUInt16(in); fontId = IsoTypeReader.readUInt16(in); faceStyleFlags = IsoTypeReader.readUInt8(in); fontSize = IsoTypeReader.readUInt8(in); textColor = new int[4]; textColor[0] = IsoTypeReader.readUInt8(in); textColor[1] = IsoTypeReader.readUInt8(in); textColor[2] = IsoTypeReader.readUInt8(in); textColor[3] = IsoTypeReader.readUInt8(in);
683
182
865
<methods>public abstract void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public int getDataReferenceIndex() ,public abstract void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setDataReferenceIndex(int) <variables>protected int dataReferenceIndex
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/RateShareEntry.java
RateShareEntry
equals
class RateShareEntry extends GroupEntry { public static final String TYPE = "rash"; private short operationPointCut; private short targetRateShare; private List<Entry> entries = new LinkedList<Entry>(); private int maximumBitrate; private int minimumBitrate; private short discardPriority; @Override public String getType() { return TYPE; } @Override public void parse(ByteBuffer byteBuffer) { operationPointCut = byteBuffer.getShort(); if (operationPointCut == 1) { targetRateShare = byteBuffer.getShort(); } else { int entriesLeft = operationPointCut; while (entriesLeft-- > 0) { entries.add(new Entry(CastUtils.l2i(IsoTypeReader.readUInt32(byteBuffer)), byteBuffer.getShort())); } } maximumBitrate = CastUtils.l2i(IsoTypeReader.readUInt32(byteBuffer)); minimumBitrate = CastUtils.l2i(IsoTypeReader.readUInt32(byteBuffer)); discardPriority = (short) IsoTypeReader.readUInt8(byteBuffer); } @Override public ByteBuffer get() { ByteBuffer buf = ByteBuffer.allocate(operationPointCut == 1 ? 13 : (operationPointCut * 6 + 11)); buf.putShort(operationPointCut); if (operationPointCut == 1) { buf.putShort(targetRateShare); } else { for (Entry entry : entries) { buf.putInt(entry.getAvailableBitrate()); buf.putShort(entry.getTargetRateShare()); } } buf.putInt(maximumBitrate); buf.putInt(minimumBitrate); IsoTypeWriter.writeUInt8(buf, discardPriority); ((Buffer)buf).rewind(); return buf; } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { int result = (int) operationPointCut; result = 31 * result + (int) targetRateShare; result = 31 * result + (entries != null ? entries.hashCode() : 0); result = 31 * result + maximumBitrate; result = 31 * result + minimumBitrate; result = 31 * result + (int) discardPriority; return result; } public short getOperationPointCut() { return operationPointCut; } public void setOperationPointCut(short operationPointCut) { this.operationPointCut = operationPointCut; } public short getTargetRateShare() { return targetRateShare; } public void setTargetRateShare(short targetRateShare) { this.targetRateShare = targetRateShare; } public List<Entry> getEntries() { return entries; } public void setEntries(List<Entry> entries) { this.entries = entries; } public int getMaximumBitrate() { return maximumBitrate; } public void setMaximumBitrate(int maximumBitrate) { this.maximumBitrate = maximumBitrate; } public int getMinimumBitrate() { return minimumBitrate; } public void setMinimumBitrate(int minimumBitrate) { this.minimumBitrate = minimumBitrate; } public short getDiscardPriority() { return discardPriority; } public void setDiscardPriority(short discardPriority) { this.discardPriority = discardPriority; } public static class Entry { int availableBitrate; short targetRateShare; public Entry(int availableBitrate, short targetRateShare) { this.availableBitrate = availableBitrate; this.targetRateShare = targetRateShare; } @Override public String toString() { return "{" + "availableBitrate=" + availableBitrate + ", targetRateShare=" + targetRateShare + '}'; } public int getAvailableBitrate() { return availableBitrate; } public void setAvailableBitrate(int availableBitrate) { this.availableBitrate = availableBitrate; } public short getTargetRateShare() { return targetRateShare; } public void setTargetRateShare(short targetRateShare) { this.targetRateShare = targetRateShare; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Entry entry = (Entry) o; if (availableBitrate != entry.availableBitrate) { return false; } if (targetRateShare != entry.targetRateShare) { return false; } return true; } @Override public int hashCode() { int result = availableBitrate; result = 31 * result + (int) targetRateShare; return result; } } }
if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RateShareEntry that = (RateShareEntry) o; if (discardPriority != that.discardPriority) { return false; } if (maximumBitrate != that.maximumBitrate) { return false; } if (minimumBitrate != that.minimumBitrate) { return false; } if (operationPointCut != that.operationPointCut) { return false; } if (targetRateShare != that.targetRateShare) { return false; } if (entries != null ? !entries.equals(that.entries) : that.entries != null) { return false; } return true;
1,345
230
1,575
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/RollRecoveryEntry.java
RollRecoveryEntry
equals
class RollRecoveryEntry extends GroupEntry { public static final String TYPE = "roll"; private short rollDistance; @Override public String getType() { return TYPE; } public short getRollDistance() { return rollDistance; } public void setRollDistance(short rollDistance) { this.rollDistance = rollDistance; } @Override public void parse(ByteBuffer byteBuffer) { rollDistance = byteBuffer.getShort(); } @Override public ByteBuffer get() { ByteBuffer content = ByteBuffer.allocate(2); content.putShort(rollDistance); ((Buffer)content).rewind(); return content; } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public int hashCode() { return (int) rollDistance; } }
if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RollRecoveryEntry entry = (RollRecoveryEntry) o; if (rollDistance != entry.rollDistance) { return false; } return true;
237
94
331
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/SampleGroupDescriptionBox.java
SampleGroupDescriptionBox
parseGroupEntry
class SampleGroupDescriptionBox extends AbstractFullBox { public static final String TYPE = "sgpd"; private String groupingType; private int defaultLength; private List<GroupEntry> groupEntries = new LinkedList<GroupEntry>(); public SampleGroupDescriptionBox() { super(TYPE); setVersion(1); } public String getGroupingType() { return groupingType; } public void setGroupingType(String groupingType) { this.groupingType = groupingType; } @Override protected long getContentSize() { long size = 8; if (getVersion() == 1) { size += 4; } size += 4; // entryCount for (GroupEntry groupEntry : groupEntries) { if (getVersion() == 1 && defaultLength == 0) { size += 4; } size += defaultLength == 0 ? groupEntry.size() : defaultLength; } return size; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); byteBuffer.put(IsoFile.fourCCtoBytes(groupingType)); if (this.getVersion() == 1) { IsoTypeWriter.writeUInt32(byteBuffer, defaultLength); } IsoTypeWriter.writeUInt32(byteBuffer, this.groupEntries.size()); for (GroupEntry entry : groupEntries) { ByteBuffer data = entry.get(); if (this.getVersion() == 1) { if (defaultLength == 0) { IsoTypeWriter.writeUInt32(byteBuffer, data.limit()); } else { if (data.limit() > defaultLength) { throw new RuntimeException( String.format("SampleGroupDescriptionBox entry size %d more than %d", data.limit(), defaultLength)); } } } byteBuffer.put(data); int deadBytes = defaultLength == 0 ? 0 : defaultLength - data.limit(); while (deadBytes-- > 0) { byteBuffer.put((byte) 0); } } } @Override protected void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); groupingType = IsoTypeReader.read4cc(content); if (this.getVersion() == 1) { defaultLength = CastUtils.l2i(IsoTypeReader.readUInt32(content)); } long entryCount = IsoTypeReader.readUInt32(content); while (entryCount-- > 0) { int length = defaultLength; if (this.getVersion() == 1) { if (defaultLength == 0) { length = CastUtils.l2i(IsoTypeReader.readUInt32(content)); } } else { length = content.limit() - content.position(); } ByteBuffer parseMe = content.slice(); ((Buffer)parseMe).limit(length); groupEntries.add(parseGroupEntry(parseMe, groupingType)); int parsedBytes = this.getVersion() == 1 ? length : parseMe.position(); ((Buffer)content).position(content.position() + parsedBytes); } } private GroupEntry parseGroupEntry(ByteBuffer content, String groupingType) {<FILL_FUNCTION_BODY>} public int getDefaultLength() { return defaultLength; } public void setDefaultLength(int defaultLength) { this.defaultLength = defaultLength; } public List<GroupEntry> getGroupEntries() { return groupEntries; } public void setGroupEntries(List<GroupEntry> groupEntries) { this.groupEntries = groupEntries; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SampleGroupDescriptionBox that = (SampleGroupDescriptionBox) o; if (defaultLength != that.defaultLength) { return false; } if (groupEntries != null ? !groupEntries.equals(that.groupEntries) : that.groupEntries != null) { return false; } return true; } @Override public int hashCode() { int result = 0; result = 31 * result + defaultLength; result = 31 * result + (groupEntries != null ? groupEntries.hashCode() : 0); return result; } @Override public String toString() { return "SampleGroupDescriptionBox{" + "groupingType='" + (groupEntries.size() > 0 ? groupEntries.get(0).getType() : "????") + '\'' + ", defaultLength=" + defaultLength + ", groupEntries=" + groupEntries + '}'; } }
GroupEntry groupEntry; if (RollRecoveryEntry.TYPE.equals(groupingType)) { groupEntry = new RollRecoveryEntry(); } else if (RateShareEntry.TYPE.equals(groupingType)) { groupEntry = new RateShareEntry(); } else if (VisualRandomAccessEntry.TYPE.equals(groupingType)) { groupEntry = new VisualRandomAccessEntry(); } else if (TemporalLevelEntry.TYPE.equals(groupingType)) { groupEntry = new TemporalLevelEntry(); } else if (SyncSampleEntry.TYPE.equals(groupingType)) { groupEntry = new SyncSampleEntry(); } else if (TemporalLayerSampleGroup.TYPE.equals(groupingType)) { groupEntry = new TemporalLayerSampleGroup(); } else if (TemporalSubLayerSampleGroup.TYPE.equals(groupingType)) { groupEntry = new TemporalSubLayerSampleGroup(); } else if (StepwiseTemporalLayerEntry.TYPE.equals(groupingType)) { groupEntry = new StepwiseTemporalLayerEntry(); } else { if (this.getVersion() == 0) { throw new RuntimeException("SampleGroupDescriptionBox with UnknownEntry are only supported in version 1"); } groupEntry = new UnknownEntry(groupingType); } groupEntry.parse(content); return groupEntry;
1,285
347
1,632
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/SampleToGroupBox.java
Entry
hashCode
class Entry { private long sampleCount; private int groupDescriptionIndex; public Entry(long sampleCount, int groupDescriptionIndex) { this.sampleCount = sampleCount; this.groupDescriptionIndex = groupDescriptionIndex; } public long getSampleCount() { return sampleCount; } public void setSampleCount(long sampleCount) { this.sampleCount = sampleCount; } public int getGroupDescriptionIndex() { return groupDescriptionIndex; } public void setGroupDescriptionIndex(int groupDescriptionIndex) { this.groupDescriptionIndex = groupDescriptionIndex; } @Override public String toString() { return "Entry{" + "sampleCount=" + sampleCount + ", groupDescriptionIndex=" + groupDescriptionIndex + '}'; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Entry entry = (Entry) o; if (groupDescriptionIndex != entry.groupDescriptionIndex) { return false; } if (sampleCount != entry.sampleCount) { return false; } return true; } @Override public int hashCode() {<FILL_FUNCTION_BODY>} }
int result = (int) (sampleCount ^ (sampleCount >>> 32)); result = 31 * result + groupDescriptionIndex; return result;
364
42
406
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/TemporalLevelEntry.java
TemporalLevelEntry
toString
class TemporalLevelEntry extends GroupEntry { public static final String TYPE = "tele"; private boolean levelIndependentlyDecodable; private short reserved; @Override public String getType() { return TYPE; } public boolean isLevelIndependentlyDecodable() { return levelIndependentlyDecodable; } public void setLevelIndependentlyDecodable(boolean levelIndependentlyDecodable) { this.levelIndependentlyDecodable = levelIndependentlyDecodable; } @Override public void parse(ByteBuffer byteBuffer) { final byte b = byteBuffer.get(); levelIndependentlyDecodable = ((b & 0x80) == 0x80); } @Override public ByteBuffer get() { ByteBuffer content = ByteBuffer.allocate(1); content.put((byte) (levelIndependentlyDecodable ? 0x80 : 0x00)); ((Buffer)content).rewind(); return content; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TemporalLevelEntry that = (TemporalLevelEntry) o; if (levelIndependentlyDecodable != that.levelIndependentlyDecodable) return false; if (reserved != that.reserved) return false; return true; } @Override public int hashCode() { int result = (levelIndependentlyDecodable ? 1 : 0); result = 31 * result + (int) reserved; return result; } @Override public String toString() {<FILL_FUNCTION_BODY>} }
final StringBuilder sb = new StringBuilder(); sb.append("TemporalLevelEntry"); sb.append("{levelIndependentlyDecodable=").append(levelIndependentlyDecodable); sb.append('}'); return sb.toString();
468
67
535
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/UnknownEntry.java
UnknownEntry
toString
class UnknownEntry extends GroupEntry { private ByteBuffer content; private String type; public UnknownEntry(String type) { this.type = type; } @Override public String getType() { return type; } public ByteBuffer getContent() { return content; } public void setContent(ByteBuffer content) { this.content = (ByteBuffer) ((Buffer)content.duplicate()).rewind(); } @Override public void parse(ByteBuffer byteBuffer) { this.content = (ByteBuffer) ((Buffer)byteBuffer.duplicate()).rewind(); } @Override public ByteBuffer get() { return content.duplicate(); } @Override public String toString() {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UnknownEntry that = (UnknownEntry) o; if (content != null ? !content.equals(that.content) : that.content != null) { return false; } return true; } @Override public int hashCode() { return content != null ? content.hashCode() : 0; } }
ByteBuffer bb = content.duplicate(); ((Buffer)bb).rewind(); byte[] b = new byte[bb.limit()]; bb.get(b); return "UnknownEntry{" + "content=" + Hex.encodeHex(b) + '}';
362
78
440
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/samplegrouping/VisualRandomAccessEntry.java
VisualRandomAccessEntry
toString
class VisualRandomAccessEntry extends GroupEntry { public static final String TYPE = "rap "; private boolean numLeadingSamplesKnown; private short numLeadingSamples; @Override public String getType() { return TYPE; } public boolean isNumLeadingSamplesKnown() { return numLeadingSamplesKnown; } public void setNumLeadingSamplesKnown(boolean numLeadingSamplesKnown) { this.numLeadingSamplesKnown = numLeadingSamplesKnown; } public short getNumLeadingSamples() { return numLeadingSamples; } public void setNumLeadingSamples(short numLeadingSamples) { this.numLeadingSamples = numLeadingSamples; } @Override public void parse(ByteBuffer byteBuffer) { final byte b = byteBuffer.get(); numLeadingSamplesKnown = ((b & 0x80) == 0x80); numLeadingSamples = (short) (b & 0x7f); } @Override public ByteBuffer get() { ByteBuffer content = ByteBuffer.allocate(1); content.put((byte) ((numLeadingSamplesKnown ? 0x80 : 0x00) | (numLeadingSamples & 0x7f))); ((Buffer)content).rewind(); return content; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; VisualRandomAccessEntry that = (VisualRandomAccessEntry) o; if (numLeadingSamples != that.numLeadingSamples) return false; if (numLeadingSamplesKnown != that.numLeadingSamplesKnown) return false; return true; } @Override public int hashCode() { int result = (numLeadingSamplesKnown ? 1 : 0); result = 31 * result + (int) numLeadingSamples; return result; } @Override public String toString() {<FILL_FUNCTION_BODY>} }
final StringBuilder sb = new StringBuilder(); sb.append("VisualRandomAccessEntry"); sb.append("{numLeadingSamplesKnown=").append(numLeadingSamplesKnown); sb.append(", numLeadingSamples=").append(numLeadingSamples); sb.append('}'); return sb.toString();
577
88
665
<methods>public non-sealed void <init>() ,public abstract java.nio.ByteBuffer get() ,public abstract java.lang.String getType() ,public abstract void parse(java.nio.ByteBuffer) ,public int size() <variables>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/AlbumBox.java
AlbumBox
getContent
class AlbumBox extends AbstractFullBox { public static final String TYPE = "albm"; private String language; private String albumTitle; private int trackNumber; public AlbumBox() { super(TYPE); } /** * Declares the language code for the {@link #getAlbumTitle()} return value. See ISO 639-2/T for the set of three * character codes.Each character is packed as the difference between its ASCII value and 0x60. The code is * confined to being three lower-case letters, so these values are strictly positive. * * @return the language code */ public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getAlbumTitle() { return albumTitle; } public void setAlbumTitle(String albumTitle) { this.albumTitle = albumTitle; } public int getTrackNumber() { return trackNumber; } public void setTrackNumber(int trackNumber) { this.trackNumber = trackNumber; } protected long getContentSize() { return 6 + Utf8.utf8StringLengthInBytes(albumTitle) + 1 + (trackNumber == -1 ? 0 : 1); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); albumTitle = IsoTypeReader.readString(content); if (content.remaining() > 0) { trackNumber = IsoTypeReader.readUInt8(content); } else { trackNumber = -1; } } @Override protected void getContent(ByteBuffer byteBuffer) {<FILL_FUNCTION_BODY>} public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("AlbumBox[language=").append(getLanguage()).append(";"); buffer.append("albumTitle=").append(getAlbumTitle()); if (trackNumber >= 0) { buffer.append(";trackNumber=").append(getTrackNumber()); } buffer.append("]"); return buffer.toString(); } }
writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(albumTitle)); byteBuffer.put((byte) 0); if (trackNumber != -1) { IsoTypeWriter.writeUInt8(byteBuffer, trackNumber); }
596
94
690
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/AuthorBox.java
AuthorBox
toString
class AuthorBox extends AbstractFullBox { public static final String TYPE = "auth"; private String language; private String author; public AuthorBox() { super(TYPE); } /** * Declares the language code for the {@link #getAuthor()} return value. See ISO 639-2/T for the set of three * character codes.Each character is packed as the difference between its ASCII value and 0x60. The code is * confined to being three lower-case letters, so these values are strictly positive. * * @return the language code */ public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } /** * Author information. * * @return the author */ public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } protected long getContentSize() { return 7 + Utf8.utf8StringLengthInBytes(author); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); author = IsoTypeReader.readString(content); } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(author)); byteBuffer.put((byte) 0); } public String toString() {<FILL_FUNCTION_BODY>} }
return "AuthorBox[language=" + getLanguage() + ";author=" + getAuthor() + "]";
446
30
476
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/ClassificationBox.java
ClassificationBox
_parseDetails
class ClassificationBox extends AbstractFullBox { public static final String TYPE = "clsf"; private String classificationEntity; private int classificationTableIndex; private String language; private String classificationInfo; public ClassificationBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getClassificationEntity() { return classificationEntity; } public void setClassificationEntity(String classificationEntity) { this.classificationEntity = classificationEntity; } public int getClassificationTableIndex() { return classificationTableIndex; } public void setClassificationTableIndex(int classificationTableIndex) { this.classificationTableIndex = classificationTableIndex; } public String getClassificationInfo() { return classificationInfo; } public void setClassificationInfo(String classificationInfo) { this.classificationInfo = classificationInfo; } protected long getContentSize() { return 4 + 2 + 2 + Utf8.utf8StringLengthInBytes(classificationInfo) + 1; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { byteBuffer.put(IsoFile.fourCCtoBytes(classificationEntity)); IsoTypeWriter.writeUInt16(byteBuffer, classificationTableIndex); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(classificationInfo)); byteBuffer.put((byte) 0); } public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("ClassificationBox[language=").append(getLanguage()); buffer.append("classificationEntity=").append(getClassificationEntity()); buffer.append(";classificationTableIndex=").append(getClassificationTableIndex()); buffer.append(";language=").append(getLanguage()); buffer.append(";classificationInfo=").append(getClassificationInfo()); buffer.append("]"); return buffer.toString(); } }
parseVersionAndFlags(content); byte[] cE = new byte[4]; content.get(cE); classificationEntity = IsoFile.bytesToFourCC(cE); classificationTableIndex = IsoTypeReader.readUInt16(content); language = IsoTypeReader.readIso639(content); classificationInfo = IsoTypeReader.readString(content);
574
102
676
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/CopyrightBox.java
CopyrightBox
toString
class CopyrightBox extends AbstractFullBox { public static final String TYPE = "cprt"; private String language; private String copyright; public CopyrightBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getCopyright() { return copyright; } public void setCopyright(String copyright) { this.copyright = copyright; } protected long getContentSize() { return 7 + Utf8.utf8StringLengthInBytes(copyright); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); copyright = IsoTypeReader.readString(content); } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(copyright)); byteBuffer.put((byte) 0); } public String toString() {<FILL_FUNCTION_BODY>} }
return "CopyrightBox[language=" + getLanguage() + ";copyright=" + getCopyright() + "]";
331
31
362
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/DescriptionBox.java
DescriptionBox
toString
class DescriptionBox extends AbstractFullBox { public static final String TYPE = "dscp"; private String language; private String description; public DescriptionBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } protected long getContentSize() { return 7 + Utf8.utf8StringLengthInBytes(description); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); description = IsoTypeReader.readString(content); } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(description)); byteBuffer.put((byte) 0); } public String toString() {<FILL_FUNCTION_BODY>} }
return "DescriptionBox[language=" + getLanguage() + ";description=" + getDescription() + "]";
326
30
356
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/GenreBox.java
GenreBox
toString
class GenreBox extends AbstractFullBox { public static final String TYPE = "gnre"; private String language; private String genre; public GenreBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } protected long getContentSize() { return 7 + Utf8.utf8StringLengthInBytes(genre); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); genre = IsoTypeReader.readString(content); } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(genre)); byteBuffer.put((byte) 0); } public String toString() {<FILL_FUNCTION_BODY>} }
return "GenreBox[language=" + getLanguage() + ";genre=" + getGenre() + "]";
333
33
366
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/KeywordsBox.java
KeywordsBox
_parseDetails
class KeywordsBox extends AbstractFullBox { public static final String TYPE = "kywd"; private String language; private String[] keywords; public KeywordsBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String[] getKeywords() { return keywords; } public void setKeywords(String[] keywords) { this.keywords = keywords; } protected long getContentSize() { long contentSize = 7; for (String keyword : keywords) { contentSize += 1 + Utf8.utf8StringLengthInBytes(keyword) + 1; } return contentSize; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); IsoTypeWriter.writeUInt8(byteBuffer, keywords.length); for (String keyword : keywords) { IsoTypeWriter.writeUInt8(byteBuffer, Utf8.utf8StringLengthInBytes(keyword) + 1); byteBuffer.put(Utf8.convert(keyword)); } } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("KeywordsBox[language=").append(getLanguage()); for (int i = 0; i < keywords.length; i++) { buffer.append(";keyword").append(i).append("=").append(keywords[i]); } buffer.append("]"); return buffer.toString(); } }
parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); int keywordCount = IsoTypeReader.readUInt8(content); keywords = new String[keywordCount]; for (int i = 0; i < keywordCount; i++) { IsoTypeReader.readUInt8(content); keywords[i] = IsoTypeReader.readString(content); }
463
110
573
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/LocationInformationBox.java
LocationInformationBox
_parseDetails
class LocationInformationBox extends AbstractFullBox { public static final String TYPE = "loci"; private String language; private String name = ""; private int role; private double longitude; private double latitude; private double altitude; private String astronomicalBody = ""; private String additionalNotes = ""; public LocationInformationBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getRole() { return role; } public void setRole(int role) { this.role = role; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getAltitude() { return altitude; } public void setAltitude(double altitude) { this.altitude = altitude; } public String getAstronomicalBody() { return astronomicalBody; } public void setAstronomicalBody(String astronomicalBody) { this.astronomicalBody = astronomicalBody; } public String getAdditionalNotes() { return additionalNotes; } public void setAdditionalNotes(String additionalNotes) { this.additionalNotes = additionalNotes; } protected long getContentSize() { return 22 + Utf8.convert(name).length + Utf8.convert(astronomicalBody).length + Utf8.convert(additionalNotes).length; } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(name)); byteBuffer.put((byte) 0); IsoTypeWriter.writeUInt8(byteBuffer, role); IsoTypeWriter.writeFixedPoint1616(byteBuffer, longitude); IsoTypeWriter.writeFixedPoint1616(byteBuffer, latitude); IsoTypeWriter.writeFixedPoint1616(byteBuffer, altitude); byteBuffer.put(Utf8.convert(astronomicalBody)); byteBuffer.put((byte) 0); byteBuffer.put(Utf8.convert(additionalNotes)); byteBuffer.put((byte) 0); } }
parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); name = IsoTypeReader.readString(content); role = IsoTypeReader.readUInt8(content); longitude = IsoTypeReader.readFixedPoint1616(content); latitude = IsoTypeReader.readFixedPoint1616(content); altitude = IsoTypeReader.readFixedPoint1616(content); astronomicalBody = IsoTypeReader.readString(content); additionalNotes = IsoTypeReader.readString(content);
771
152
923
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/PerformerBox.java
PerformerBox
toString
class PerformerBox extends AbstractFullBox { public static final String TYPE = "perf"; private String language; private String performer; public PerformerBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getPerformer() { return performer; } public void setPerformer(String performer) { this.performer = performer; } protected long getContentSize() { return 6 + Utf8.utf8StringLengthInBytes(performer) + 1; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(performer)); byteBuffer.put((byte) 0); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); performer = IsoTypeReader.readString(content); } public String toString() {<FILL_FUNCTION_BODY>} }
return "PerformerBox[language=" + getLanguage() + ";performer=" + getPerformer() + "]";
340
33
373
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/RatingBox.java
RatingBox
_parseDetails
class RatingBox extends AbstractFullBox { public static final String TYPE = "rtng"; private String ratingEntity; private String ratingCriteria; private String language; private String ratingInfo; public RatingBox() { super(TYPE); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } /** * Gets a four-character code that indicates the rating entity grading the asset, e.g., 'BBFC'. The values of this * field should follow common names of worldwide movie rating systems, such as those mentioned in * [http://www.movie-ratings.net/, October 2002]. * * @return the rating organization */ public String getRatingEntity() { return ratingEntity; } public void setRatingEntity(String ratingEntity) { this.ratingEntity = ratingEntity; } /** * Gets the four-character code that indicates which rating criteria are being used for the corresponding rating * entity, e.g., 'PG13'. * * @return the actual rating */ public String getRatingCriteria() { return ratingCriteria; } public void setRatingCriteria(String ratingCriteria) { this.ratingCriteria = ratingCriteria; } public String getRatingInfo() { return ratingInfo; } public void setRatingInfo(String ratingInfo) { this.ratingInfo = ratingInfo; } protected long getContentSize() { return 15 + Utf8.utf8StringLengthInBytes(ratingInfo); } @Override public void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); byteBuffer.put(IsoFile.fourCCtoBytes(ratingEntity)); byteBuffer.put(IsoFile.fourCCtoBytes(ratingCriteria)); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(ratingInfo)); byteBuffer.put((byte) 0); } public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("RatingBox[language=").append(getLanguage()); buffer.append("ratingEntity=").append(getRatingEntity()); buffer.append(";ratingCriteria=").append(getRatingCriteria()); buffer.append(";language=").append(getLanguage()); buffer.append(";ratingInfo=").append(getRatingInfo()); buffer.append("]"); return buffer.toString(); } }
parseVersionAndFlags(content); ratingEntity = IsoTypeReader.read4cc(content); ratingCriteria = IsoTypeReader.read4cc(content); language = IsoTypeReader.readIso639(content); ratingInfo = IsoTypeReader.readString(content);
709
79
788
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26244/TitleBox.java
TitleBox
toString
class TitleBox extends AbstractFullBox { public static final String TYPE = "titl"; private String language; private String title; public TitleBox() { super(TYPE); } public String getLanguage() { return language; } /** * Sets the 3-letter ISO-639 language for this title. * * @param language 3-letter ISO-639 code */ public void setLanguage(String language) { this.language = language; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } protected long getContentSize() { return 7 + Utf8.utf8StringLengthInBytes(title); } protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeIso639(byteBuffer, language); byteBuffer.put(Utf8.convert(title)); byteBuffer.put((byte) 0); } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); language = IsoTypeReader.readIso639(content); title = IsoTypeReader.readString(content); } public String toString() {<FILL_FUNCTION_BODY>} }
return "TitleBox[language=" + getLanguage() + ";title=" + getTitle() + "]";
366
30
396
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/threegpp/ts26245/FontTableBox.java
FontRecord
toString
class FontRecord { int fontId; String fontname; public FontRecord() { } public FontRecord(int fontId, String fontname) { this.fontId = fontId; this.fontname = fontname; } public void parse(ByteBuffer bb) { fontId = IsoTypeReader.readUInt16(bb); int length = IsoTypeReader.readUInt8(bb); fontname = IsoTypeReader.readString(bb, length); } public void getContent(ByteBuffer bb) { IsoTypeWriter.writeUInt16(bb, fontId); IsoTypeWriter.writeUInt8(bb, fontname.length()); bb.put(Utf8.convert(fontname)); } public int getSize() { return Utf8.utf8StringLengthInBytes(fontname) + 3; } @Override public String toString() {<FILL_FUNCTION_BODY>} }
return "FontRecord{" + "fontId=" + fontId + ", fontname='" + fontname + '\'' + '}';
265
41
306
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/webm/SMPTE2086MasteringDisplayMetadataBox.java
SMPTE2086MasteringDisplayMetadataBox
_parseDetails
class SMPTE2086MasteringDisplayMetadataBox extends AbstractFullBox { private static final String TYPE = "SmDm"; int primaryRChromaticity_x; int primaryRChromaticity_y; int primaryGChromaticity_x; int primaryGChromaticity_y; int primaryBChromaticity_x; int primaryBChromaticity_y; int whitePointChromaticity_x; int whitePointChromaticity_y; long luminanceMax; long luminanceMin; public SMPTE2086MasteringDisplayMetadataBox() { super(TYPE); } public int getPrimaryRChromaticity_x() { return primaryRChromaticity_x; } public void setPrimaryRChromaticity_x(int primaryRChromaticity_x) { this.primaryRChromaticity_x = primaryRChromaticity_x; } public int getPrimaryRChromaticity_y() { return primaryRChromaticity_y; } public void setPrimaryRChromaticity_y(int primaryRChromaticity_y) { this.primaryRChromaticity_y = primaryRChromaticity_y; } public int getPrimaryGChromaticity_x() { return primaryGChromaticity_x; } public void setPrimaryGChromaticity_x(int primaryGChromaticity_x) { this.primaryGChromaticity_x = primaryGChromaticity_x; } public int getPrimaryGChromaticity_y() { return primaryGChromaticity_y; } public void setPrimaryGChromaticity_y(int primaryGChromaticity_y) { this.primaryGChromaticity_y = primaryGChromaticity_y; } public int getPrimaryBChromaticity_x() { return primaryBChromaticity_x; } public void setPrimaryBChromaticity_x(int primaryBChromaticity_x) { this.primaryBChromaticity_x = primaryBChromaticity_x; } public int getPrimaryBChromaticity_y() { return primaryBChromaticity_y; } public void setPrimaryBChromaticity_y(int primaryBChromaticity_y) { this.primaryBChromaticity_y = primaryBChromaticity_y; } public int getWhitePointChromaticity_x() { return whitePointChromaticity_x; } public void setWhitePointChromaticity_x(int whitePointChromaticity_x) { this.whitePointChromaticity_x = whitePointChromaticity_x; } public int getWhitePointChromaticity_y() { return whitePointChromaticity_y; } public void setWhitePointChromaticity_y(int whitePointChromaticity_y) { this.whitePointChromaticity_y = whitePointChromaticity_y; } public long getLuminanceMax() { return luminanceMax; } public void setLuminanceMax(long luminanceMax) { this.luminanceMax = luminanceMax; } public long getLuminanceMin() { return luminanceMin; } public void setLuminanceMin(long luminanceMin) { this.luminanceMin = luminanceMin; } @Override protected long getContentSize() { return 28; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt16(byteBuffer, primaryRChromaticity_x); IsoTypeWriter.writeUInt16(byteBuffer, primaryRChromaticity_y); IsoTypeWriter.writeUInt16(byteBuffer, primaryGChromaticity_x); IsoTypeWriter.writeUInt16(byteBuffer, primaryGChromaticity_y); IsoTypeWriter.writeUInt16(byteBuffer, primaryBChromaticity_x); IsoTypeWriter.writeUInt16(byteBuffer, primaryBChromaticity_y); IsoTypeWriter.writeUInt16(byteBuffer, whitePointChromaticity_x); IsoTypeWriter.writeUInt16(byteBuffer, whitePointChromaticity_y); IsoTypeWriter.writeUInt32(byteBuffer, luminanceMax); IsoTypeWriter.writeUInt32(byteBuffer, luminanceMin); } @Override protected void _parseDetails(ByteBuffer content) {<FILL_FUNCTION_BODY>} }
parseVersionAndFlags(content); primaryRChromaticity_x = IsoTypeReader.readUInt16(content); primaryRChromaticity_y = IsoTypeReader.readUInt16(content); primaryGChromaticity_x = IsoTypeReader.readUInt16(content); primaryGChromaticity_y = IsoTypeReader.readUInt16(content); primaryBChromaticity_x = IsoTypeReader.readUInt16(content); primaryBChromaticity_y = IsoTypeReader.readUInt16(content); whitePointChromaticity_x = IsoTypeReader.readUInt16(content); whitePointChromaticity_y = IsoTypeReader.readUInt16(content); luminanceMax = IsoTypeReader.readUInt32(content); luminanceMin = IsoTypeReader.readUInt32(content);
1,263
242
1,505
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/boxes/webm/VPCodecConfigurationBox.java
VPCodecConfigurationBox
toString
class VPCodecConfigurationBox extends AbstractFullBox { public static final String TYPE = "vpcC"; private int profile; private int level; private int bitDepth; private int chromaSubsampling; private int videoFullRangeFlag; private int colourPrimaries; private int transferCharacteristics; private int matrixCoefficients; private byte[] codecIntializationData; public VPCodecConfigurationBox() { super(TYPE); } @Override protected long getContentSize() { return codecIntializationData.length + 12; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); BitWriterBuffer bwb = new BitWriterBuffer(byteBuffer); bwb.writeBits(profile, 8); bwb.writeBits(level, 8); bwb.writeBits(bitDepth, 4); bwb.writeBits(chromaSubsampling, 3); bwb.writeBits(videoFullRangeFlag, 1); bwb.writeBits(colourPrimaries, 8); bwb.writeBits(transferCharacteristics, 8); bwb.writeBits(matrixCoefficients, 8); bwb.writeBits(codecIntializationData.length, 16); byteBuffer.put(codecIntializationData); } // aligned (8) class VPCodecConfigurationRecord { // unsigned int (8) profile; // unsigned int (8) level; // unsigned int (4) bitDepth; // unsigned int (3) chromaSubsampling; // unsigned int (1) videoFullRangeFlag; // unsigned int (8) colourPrimaries; // unsigned int (8) transferCharacteristics; // unsigned int (8) matrixCoefficients; // unsigned int (16) codecIntializationDataSize; // unsigned int (8)[] codecIntializationData; //} @Override protected void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); BitReaderBuffer brb = new BitReaderBuffer(content); profile = brb.readBits(8); level = brb.readBits(8); bitDepth = brb.readBits(4); chromaSubsampling = brb.readBits(3); videoFullRangeFlag = brb.readBits(1); colourPrimaries = brb.readBits(8); transferCharacteristics = brb.readBits(8); matrixCoefficients = brb.readBits(8); int len = brb.readBits(16); codecIntializationData = new byte[len]; content.get(codecIntializationData); } public int getProfile() { return profile; } public void setProfile(int profile) { this.profile = profile; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public int getBitDepth() { return bitDepth; } public void setBitDepth(int bitDepth) { this.bitDepth = bitDepth; } public int getChromaSubsampling() { return chromaSubsampling; } public void setChromaSubsampling(int chromaSubsampling) { this.chromaSubsampling = chromaSubsampling; } public int getVideoFullRangeFlag() { return videoFullRangeFlag; } public void setVideoFullRangeFlag(int videoFullRangeFlag) { this.videoFullRangeFlag = videoFullRangeFlag; } public int getColourPrimaries() { return colourPrimaries; } public void setColourPrimaries(int colourPrimaries) { this.colourPrimaries = colourPrimaries; } public int getTransferCharacteristics() { return transferCharacteristics; } public void setTransferCharacteristics(int transferCharacteristics) { this.transferCharacteristics = transferCharacteristics; } public int getMatrixCoefficients() { return matrixCoefficients; } public void setMatrixCoefficients(int matrixCoefficients) { this.matrixCoefficients = matrixCoefficients; } public byte[] getCodecIntializationData() { return codecIntializationData; } public void setCodecIntializationData(byte[] codecIntializationData) { this.codecIntializationData = codecIntializationData; } @Override public String toString() {<FILL_FUNCTION_BODY>} }
return "VPCodecConfigurationBox{" + "profile=" + profile + ", level=" + level + ", bitDepth=" + bitDepth + ", chromaSubsampling=" + chromaSubsampling + ", videoFullRangeFlag=" + videoFullRangeFlag + ", colourPrimaries=" + colourPrimaries + ", transferCharacteristics=" + transferCharacteristics + ", matrixCoefficients=" + matrixCoefficients + ", codecIntializationData=" + Arrays.toString(codecIntializationData) + '}';
1,268
145
1,413
<methods>public int getFlags() ,public int getVersion() ,public void setFlags(int) ,public void setVersion(int) <variables>protected int flags,protected int version
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/AbstractBox.java
AbstractBox
verify
class AbstractBox implements ParsableBox { private static Logger LOG = LoggerFactory.getLogger(AbstractBox.class); protected String type; protected ByteBuffer content; boolean isParsed; private byte[] userType; private ByteBuffer deadBytes = null; protected AbstractBox(String type) { this.type = type; isParsed = true; } protected AbstractBox(String type, byte[] userType) { this.type = type; this.userType = userType; isParsed = true; } /** * Get the box's content size without its header. This must be the exact number of bytes * that <code>getContent(ByteBuffer)</code> writes. * * @return Gets the box's content size in bytes * @see #getContent(java.nio.ByteBuffer) */ protected abstract long getContentSize(); /** * Write the box's content into the given <code>ByteBuffer</code>. This must include flags * and version in case of a full box. <code>byteBuffer</code> has been initialized with * <code>getSize()</code> bytes. * * @param byteBuffer the sink for the box's content */ protected abstract void getContent(ByteBuffer byteBuffer); /** * Parse the box's fields and child boxes if any. * * @param content the box's raw content beginning after the 4-cc field. */ protected abstract void _parseDetails(ByteBuffer content); /** * {@inheritDoc} */ @DoNotParseDetail public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { content = ByteBuffer.allocate(l2i(contentSize)); while ((content.position() < contentSize)) { if (dataSource.read(content) == -1) { LOG.error("{} might have been truncated by file end. bytesRead={} contentSize={}", this, content.position(), contentSize); break; } } ((Buffer)content).position(0); isParsed = false; } public void getBox(WritableByteChannel os) throws IOException { if (isParsed) { ByteBuffer bb = ByteBuffer.allocate(l2i(getSize())); getHeader(bb); getContent(bb); if (deadBytes != null) { ((Buffer)deadBytes).rewind(); while (deadBytes.remaining() > 0) { bb.put(deadBytes); } } os.write((ByteBuffer) ((Buffer)bb).rewind()); } else { ByteBuffer header = ByteBuffer.allocate((isSmallBox() ? 8 : 16) + (UserBox.TYPE.equals(getType()) ? 16 : 0)); getHeader(header); os.write((ByteBuffer) ((Buffer)header).rewind()); os.write((ByteBuffer) ((Buffer)content).position(0)); } } /** * Parses the raw content of the box. It surrounds the actual parsing * which is done */ public synchronized final void parseDetails() { LOG.debug("parsing details of {}", this.getType()); if (content != null) { ByteBuffer content = this.content; isParsed = true; ((Buffer)content).rewind(); _parseDetails(content); if (content.remaining() > 0) { deadBytes = content.slice(); } this.content = null; assert verify(content); } } /** * Gets the full size of the box including header and content. * * @return the box's size */ public long getSize() { long size = isParsed ? getContentSize() : content.limit(); size += (8 + // size|type (size >= ((1L << 32) - 8) ? 8 : 0) + // 32bit - 8 byte size and type (UserBox.TYPE.equals(getType()) ? 16 : 0)); size += (deadBytes == null ? 0 : deadBytes.limit()); return size; } @DoNotParseDetail public String getType() { return type; } @DoNotParseDetail public byte[] getUserType() { return userType; } /** * Check if details are parsed. * * @return <code>true</code> whenever the content <code>ByteBuffer</code> is not <code>null</code> */ public boolean isParsed() { return isParsed; } /** * Verifies that a box can be reconstructed byte-exact after parsing. * * @param content the raw content of the box * @return <code>true</code> if raw content exactly matches the reconstructed content */ private boolean verify(ByteBuffer content) {<FILL_FUNCTION_BODY>} private boolean isSmallBox() { int baseSize = 8; if (UserBox.TYPE.equals(getType())) { baseSize += 16; } if (isParsed) { return (getContentSize() + (deadBytes != null ? deadBytes.limit() : 0) + baseSize) < (1L << 32); } else { return content.limit() + baseSize < (1L << 32); } } private void getHeader(ByteBuffer byteBuffer) { if (isSmallBox()) { IsoTypeWriter.writeUInt32(byteBuffer, this.getSize()); byteBuffer.put(IsoFile.fourCCtoBytes(getType())); } else { IsoTypeWriter.writeUInt32(byteBuffer, 1); byteBuffer.put(IsoFile.fourCCtoBytes(getType())); IsoTypeWriter.writeUInt64(byteBuffer, getSize()); } if (UserBox.TYPE.equals(getType())) { byteBuffer.put(getUserType()); } } }
ByteBuffer bb = ByteBuffer.allocate(l2i(getContentSize() + (deadBytes != null ? deadBytes.limit() : 0))); getContent(bb); if (deadBytes != null) { ((Buffer)deadBytes).rewind(); while (deadBytes.remaining() > 0) { bb.put(deadBytes); } } ((Buffer)content).rewind(); ((Buffer)bb).rewind(); if (content.remaining() != bb.remaining()) { LOG.error("{}: remaining differs {} vs. {}", this.getType(), content.remaining(), bb.remaining()); return false; } int p = content.position(); for (int i = content.limit() - 1, j = bb.limit() - 1; i >= p; i--, j--) { byte v1 = content.get(i); byte v2 = bb.get(j); if (v1 != v2) { LOG.error("{}: buffers differ at {}: {}/{}", this.getType(), i, v1, v2); byte[] b1 = new byte[content.remaining()]; byte[] b2 = new byte[bb.remaining()]; content.get(b1); bb.get(b2); LOG.error("original : {}", Hex.encodeHex(b1, 4)); LOG.error("reconstructed : {}", Hex.encodeHex(b2, 4)); return false; } } return true;
1,603
411
2,014
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/AbstractContainerBox.java
AbstractContainerBox
getHeader
class AbstractContainerBox extends BasicContainer implements ParsableBox { protected String type; protected boolean largeBox; Container parent; public AbstractContainerBox(String type) { this.type = type; } public void setParent(Container parent) { this.parent = parent; } public long getSize() { long s = getContainerSize(); return s + ((largeBox || (s + 8) >= (1L << 32)) ? 16 : 8); } public String getType() { return type; } protected ByteBuffer getHeader() {<FILL_FUNCTION_BODY>} public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { this.largeBox = header.remaining() == 16; // sometime people use large boxes without requiring them initContainer(dataSource, contentSize, boxParser); } public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); writeContainer(writableByteChannel); } }
ByteBuffer header; if (largeBox || getSize() >= (1L << 32)) { header = ByteBuffer.wrap(new byte[]{0, 0, 0, 1, type.getBytes()[0], type.getBytes()[1], type.getBytes()[2], type.getBytes()[3], 0, 0, 0, 0, 0, 0, 0, 0}); ((Buffer)header).position(8); IsoTypeWriter.writeUInt64(header, getSize()); } else { header = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, type.getBytes()[0], type.getBytes()[1], type.getBytes()[2], type.getBytes()[3]}); IsoTypeWriter.writeUInt32(header, getSize()); } ((Buffer)header).rewind(); return header;
295
233
528
<methods>public void <init>() ,public void <init>(List<org.mp4parser.Box>) ,public void addBox(org.mp4parser.Box) ,public List<org.mp4parser.Box> getBoxes() ,public List<T> getBoxes(Class<T>) ,public List<T> getBoxes(Class<T>, boolean) ,public void initContainer(java.nio.channels.ReadableByteChannel, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setBoxes(List<? extends org.mp4parser.Box>) ,public java.lang.String toString() ,public final void writeContainer(java.nio.channels.WritableByteChannel) throws java.io.IOException<variables>private List<org.mp4parser.Box> boxes
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/AbstractFullBox.java
AbstractFullBox
getFlags
class AbstractFullBox extends AbstractBox implements FullBox { protected int version; protected int flags; protected AbstractFullBox(String type) { super(type); } protected AbstractFullBox(String type, byte[] userType) { super(type, userType); } @DoNotParseDetail public int getVersion() { // it's faster than the join point if (!isParsed) { parseDetails(); } return version; } public void setVersion(int version) { this.version = version; } @DoNotParseDetail public int getFlags() {<FILL_FUNCTION_BODY>} public void setFlags(int flags) { this.flags = flags; } /** * Parses the version/flags header and returns the remaining box size. * * @param content the <code>ByteBuffer</code> that contains the version &amp; flag * @return number of bytes read */ protected final long parseVersionAndFlags(ByteBuffer content) { version = IsoTypeReader.readUInt8(content); flags = IsoTypeReader.readUInt24(content); return 4; } protected final void writeVersionAndFlags(ByteBuffer bb) { IsoTypeWriter.writeUInt8(bb, version); IsoTypeWriter.writeUInt24(bb, flags); } }
// it's faster than the join point if (!isParsed) { parseDetails(); } return flags;
375
37
412
<methods>public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public byte[] getUserType() ,public boolean isParsed() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public final synchronized void parseDetails() <variables>private static org.slf4j.Logger LOG,protected java.nio.ByteBuffer content,private java.nio.ByteBuffer deadBytes,boolean isParsed,protected java.lang.String type,private byte[] userType
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/BoxComparator.java
BoxComparator
check
class BoxComparator { public static boolean isIgnore(Container ref, Box b, String[] ignores) { for (String ignore : ignores) { if (Path.isContained(ref, b, ignore)) { return true; } } return false; } public static void check(Container root1, Box b1, Container root2, Box b2, String... ignores) throws IOException { //System.err.println(b1.getType() + " - " + b2.getType()); assert b1.getType().equals(b2.getType()); if (!isIgnore(root1, b1, ignores)) { // System.err.println(b1.getType()); assert b1.getType().equals(b2.getType()) : "Type differs. \ntypetrace ref : " + b1 + "\ntypetrace new : " + b2; if (b1 instanceof Container ^ !(b2 instanceof Container)) { if (b1 instanceof Container) { check(root1, (Container) b1, root2, (Container) b2, ignores); } else { checkBox(root1, b1, root2, b2, ignores); } } else { assert false : "Either both boxes are container boxes or none"; } } } private static void checkBox(Container root1, Box b1, Container root2, Box b2, String[] ignores) throws IOException { if (!isIgnore(root1, b1, ignores)) { ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); b1.getBox(Channels.newChannel(baos1)); b2.getBox(Channels.newChannel(baos2)); baos1.close(); baos2.close(); assert Base64.getEncoder().encodeToString(baos1.toByteArray()).equals(Base64.getEncoder().encodeToString(baos2.toByteArray())) : "Box at " + b1 + " differs from reference\n\n" + b1.toString() + "\n" + b2.toString(); } } public static void check(Container cb1, Container cb2, String... ignores) throws IOException { check(cb1, cb1, cb2, cb2, ignores); } public static void check(Container root1, Container cb1, Container root2, Container cb2, String... ignores) throws IOException {<FILL_FUNCTION_BODY>} }
Iterator<Box> it1 = cb1.getBoxes().iterator(); Iterator<Box> it2 = cb2.getBoxes().iterator(); while (it1.hasNext() && it2.hasNext()) { Box b1 = it1.next(); Box b2 = it2.next(); check(root1, b1, root2, b2, ignores); } assert !it1.hasNext() : "There is a box missing in the current output of the tool: " + it1.next(); assert !it2.hasNext() : "There is a box too much in the current output of the tool: " + it2.next();
663
171
834
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/FullContainerBox.java
FullContainerBox
parse
class FullContainerBox extends AbstractContainerBox implements FullBox { private static Logger LOG = LoggerFactory.getLogger(FullContainerBox.class); private int version; private int flags; public FullContainerBox(String type) { super(type); } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public int getFlags() { return flags; } public void setFlags(int flags) { this.flags = flags; } public <T extends Box> List<T> getBoxes(Class<T> clazz) { return getBoxes(clazz, false); } @Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException {<FILL_FUNCTION_BODY>} @Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { super.getBox(writableByteChannel); } public String toString() { return this.getClass().getSimpleName() + "[childBoxes]"; } /** * Parses the version/flags header and returns the remaining box size. * * @param content the <code>ByteBuffer</code> that contains the version &amp; flag * @return number of bytes read */ protected final long parseVersionAndFlags(ByteBuffer content) { version = IsoTypeReader.readUInt8(content); flags = IsoTypeReader.readUInt24(content); return 4; } protected final void writeVersionAndFlags(ByteBuffer bb) { IsoTypeWriter.writeUInt8(bb, version); IsoTypeWriter.writeUInt24(bb, flags); } @Override protected ByteBuffer getHeader() { ByteBuffer header; if (largeBox || getSize() >= (1L << 32)) { header = ByteBuffer.wrap(new byte[]{0, 0, 0, 1, type.getBytes()[0], type.getBytes()[1], type.getBytes()[2], type.getBytes()[3], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}); ((Buffer)header).position(8); IsoTypeWriter.writeUInt64(header, getSize()); writeVersionAndFlags(header); } else { header = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, type.getBytes()[0], type.getBytes()[1], type.getBytes()[2], type.getBytes()[3], 0, 0, 0, 0}); IsoTypeWriter.writeUInt32(header, getSize()); ((Buffer)header).position(8); writeVersionAndFlags(header); } ((Buffer)header).rewind(); return header; } }
ByteBuffer versionAndFlags = ByteBuffer.allocate(4); dataSource.read(versionAndFlags); parseVersionAndFlags((ByteBuffer) ((Buffer)versionAndFlags).rewind()); super.parse(dataSource, header, contentSize, boxParser);
778
67
845
<methods>public void <init>(java.lang.String) ,public void getBox(java.nio.channels.WritableByteChannel) throws java.io.IOException,public long getSize() ,public java.lang.String getType() ,public void parse(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, long, org.mp4parser.BoxParser) throws java.io.IOException,public void setParent(org.mp4parser.Container) <variables>protected boolean largeBox,org.mp4parser.Container parent,protected java.lang.String type
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/Matrix.java
Matrix
hashCode
class Matrix { public static final Matrix ROTATE_0 = new Matrix(1, 0, 0, 1, 0, 0, 1, 0, 0); public static final Matrix ROTATE_90 = new Matrix(0, 1, -1, 0, 0, 0, 1, 0, 0); public static final Matrix ROTATE_180 = new Matrix(-1, 0, 0, -1, 0, 0, 1, 0, 0); public static final Matrix ROTATE_270 = new Matrix(0, -1, 1, 0, 0, 0, 1, 0, 0); double u, v, w; double a, b, c, d, tx, ty; public Matrix(double a, double b, double c, double d, double u, double v, double w, double tx, double ty) { this.u = u; this.v = v; this.w = w; this.a = a; this.b = b; this.c = c; this.d = d; this.tx = tx; this.ty = ty; } public static Matrix fromFileOrder(double a, double b, double u, double c, double d, double v, double tx, double ty, double w) { return new Matrix(a, b, c, d, u, v, w, tx, ty); } public static Matrix fromByteBuffer(ByteBuffer byteBuffer) { return fromFileOrder( IsoTypeReader.readFixedPoint1616(byteBuffer), IsoTypeReader.readFixedPoint1616(byteBuffer), IsoTypeReader.readFixedPoint0230(byteBuffer), IsoTypeReader.readFixedPoint1616(byteBuffer), IsoTypeReader.readFixedPoint1616(byteBuffer), IsoTypeReader.readFixedPoint0230(byteBuffer), IsoTypeReader.readFixedPoint1616(byteBuffer), IsoTypeReader.readFixedPoint1616(byteBuffer), IsoTypeReader.readFixedPoint0230(byteBuffer) ); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Matrix matrix = (Matrix) o; if (Double.compare(matrix.a, a) != 0) return false; if (Double.compare(matrix.b, b) != 0) return false; if (Double.compare(matrix.c, c) != 0) return false; if (Double.compare(matrix.d, d) != 0) return false; if (Double.compare(matrix.tx, tx) != 0) return false; if (Double.compare(matrix.ty, ty) != 0) return false; if (Double.compare(matrix.u, u) != 0) return false; if (Double.compare(matrix.v, v) != 0) return false; if (Double.compare(matrix.w, w) != 0) return false; return true; } @Override public int hashCode() {<FILL_FUNCTION_BODY>} @Override public String toString() { if (this.equals(ROTATE_0)) { return "Rotate 0°"; } if (this.equals(ROTATE_90)) { return "Rotate 90°"; } if (this.equals(ROTATE_180)) { return "Rotate 180°"; } if (this.equals(ROTATE_270)) { return "Rotate 270°"; } return "Matrix{" + "u=" + u + ", v=" + v + ", w=" + w + ", a=" + a + ", b=" + b + ", c=" + c + ", d=" + d + ", tx=" + tx + ", ty=" + ty + '}'; } public void getContent(ByteBuffer byteBuffer) { IsoTypeWriter.writeFixedPoint1616(byteBuffer, a); IsoTypeWriter.writeFixedPoint1616(byteBuffer, b); IsoTypeWriter.writeFixedPoint0230(byteBuffer, u); IsoTypeWriter.writeFixedPoint1616(byteBuffer, c); IsoTypeWriter.writeFixedPoint1616(byteBuffer, d); IsoTypeWriter.writeFixedPoint0230(byteBuffer, v); IsoTypeWriter.writeFixedPoint1616(byteBuffer, tx); IsoTypeWriter.writeFixedPoint1616(byteBuffer, ty); IsoTypeWriter.writeFixedPoint0230(byteBuffer, w); } }
int result; long temp; temp = Double.doubleToLongBits(u); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(v); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(w); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(a); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(b); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(c); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(d); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(tx); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(ty); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result;
1,279
346
1,625
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/support/RequiresParseDetailAspect.java
RequiresParseDetailAspect
before
class RequiresParseDetailAspect { @Before("this(org.mp4parser.support.AbstractBox) && ((execution(public * * (..)) && !( " + "execution(* parseDetails()) || " + "execution(* getNumOfBytesToFirstChild()) || " + "execution(* getType()) || " + "execution(* isParsed()) || " + "execution(* getHeader(*)) || " + "execution(* parse()) || " + "execution(* getBox(*)) || " + "execution(* getSize()) || " + "execution(* getOffset()) || " + "execution(* setOffset(*)) || " + "execution(* parseDetails()) || " + "execution(* _parseDetails(*)) || " + "execution(* parse(*,*,*,*)) || " + "execution(* getIsoFile()) || " + "execution(* getParent()) || " + "execution(* setParent(*)) || " + "execution(* getUserType()) || " + "execution(* setUserType(*))) && " + "!@annotation(org.mp4parser.support.DoNotParseDetail)) || @annotation(org.mp4parser.support.ParseDetail))") public void before(JoinPoint joinPoint) {<FILL_FUNCTION_BODY>} }
// System.err.println("JoinPoint"); if (joinPoint.getTarget() instanceof AbstractBox) { if (!((AbstractBox) joinPoint.getTarget()).isParsed()) { // System.err.printf("parsed detail %s%n", joinPoint.getTarget().getClass().getSimpleName()); ((AbstractBox) joinPoint.getTarget()).parseDetails(); } } else { throw new RuntimeException("Only methods in subclasses of " + AbstractBox.class.getName() + " can be annotated with ParseDetail"); }
327
142
469
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Ascii.java
Ascii
convert
class Ascii { public static byte[] convert(String s) { try { if (s != null) { return s.getBytes("us-ascii"); } else { return null; } } catch (UnsupportedEncodingException e) { throw new Error(e); } } public static String convert(byte[] b) {<FILL_FUNCTION_BODY>} }
try { if (b != null) { return new String(b, "us-ascii"); } else { return null; } } catch (UnsupportedEncodingException e) { throw new Error(e); }
112
68
180
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/ByteBufferByteChannel.java
ByteBufferByteChannel
read
class ByteBufferByteChannel implements ByteChannel { ByteBuffer byteBuffer; public ByteBufferByteChannel(byte[] byteArray) { this(ByteBuffer.wrap(byteArray)); } public ByteBufferByteChannel(ByteBuffer byteBuffer) { this.byteBuffer = byteBuffer; } public int read(ByteBuffer dst) throws IOException {<FILL_FUNCTION_BODY>} public boolean isOpen() { return true; } public void close() throws IOException { } public int write(ByteBuffer src) throws IOException { int r = src.remaining(); byteBuffer.put(src); return r; } }
int rem = dst.remaining(); if (byteBuffer.remaining() <= 0) { return -1; } dst.put((ByteBuffer) ((Buffer)byteBuffer.duplicate()).limit(byteBuffer.position() + dst.remaining())); ((Buffer)byteBuffer).position(byteBuffer.position() + rem); return rem;
175
93
268
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/CastUtils.java
CastUtils
l2i
class CastUtils { /** * Casts a long to an int. In many cases I use a long for a UInt32 but this cannot be used to allocate * ByteBuffers or arrays since they restricted to <code>Integer.MAX_VALUE</code> this cast-method will throw * a RuntimeException if the cast would cause a loss of information. * * @param l the long value * @return the long value as int */ public static int l2i(long l) {<FILL_FUNCTION_BODY>} }
if (l > Integer.MAX_VALUE || l < Integer.MIN_VALUE) { throw new RuntimeException("A cast to int has gone wrong. Please contact the mp4parser discussion group (" + l + ")"); } return (int) l;
138
64
202
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Hex.java
Hex
decodeHex
class Hex { private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; public static String encodeHex(byte[] data) { return encodeHex(data, 0); } public static String encodeHex(ByteBuffer data) { ByteBuffer byteBuffer = data.duplicate(); StringBuilder sb = new StringBuilder(); while (byteBuffer.remaining() > 0) { byte b = byteBuffer.get(); sb.append(DIGITS[(0xF0 & b) >>> 4]); sb.append(DIGITS[0x0F & b]); } return sb.toString(); } public static String encodeHex(byte[] data, int group) { int l = data.length; char[] out = new char[(l << 1) + (group > 0 ? (l / group) : 0)]; // two characters form the hex value. for (int i = 0, j = 0; i < l; i++) { if ((group > 0) && ((i % group) == 0) && j > 0) { out[j++] = '-'; } out[j++] = DIGITS[(0xF0 & data[i]) >>> 4]; out[j++] = DIGITS[0x0F & data[i]]; } return new String(out); } public static byte[] decodeHex(String hexString) {<FILL_FUNCTION_BODY>} }
ByteArrayOutputStream bas = new ByteArrayOutputStream(); for (int i = 0; i < hexString.length(); i += 2) { int b = Integer.parseInt(hexString.substring(i, i + 2), 16); bas.write(b); } return bas.toByteArray();
431
82
513
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/IsoTypeReader.java
IsoTypeReader
readFixedPoint0230
class IsoTypeReader { public static long readUInt32BE(ByteBuffer bb) { long ch1 = readUInt8(bb); long ch2 = readUInt8(bb); long ch3 = readUInt8(bb); long ch4 = readUInt8(bb); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); } public static long readUInt32(ByteBuffer bb) { long i = bb.getInt(); if (i < 0) { i += 1L << 32; } return i; } public static int readUInt24(ByteBuffer bb) { int result = 0; result += readUInt16(bb) << 8; result += byte2int(bb.get()); return result; } public static int readUInt16(ByteBuffer bb) { int result = 0; result += byte2int(bb.get()) << 8; result += byte2int(bb.get()); return result; } public static int readUInt16BE(ByteBuffer bb) { int result = 0; result += byte2int(bb.get()); result += byte2int(bb.get()) << 8; return result; } public static int readUInt8(ByteBuffer bb) { return byte2int(bb.get()); } public static int byte2int(byte b) { return b < 0 ? b + 256 : b; } /** * Reads a zero terminated UTF-8 string. * * @param byteBuffer the data source * @return the string readByte * @throws Error in case of an error in the underlying stream */ public static String readString(ByteBuffer byteBuffer) { ByteArrayOutputStream out = new ByteArrayOutputStream(); int read; while ((read = byteBuffer.get()) != 0) { out.write(read); } return Utf8.convert(out.toByteArray()); } public static String readString(ByteBuffer byteBuffer, int length) { byte[] buffer = new byte[length]; byteBuffer.get(buffer); return Utf8.convert(buffer); } public static long readUInt64(ByteBuffer byteBuffer) { long result = 0; // thanks to Erik Nicolas for finding a bug! Cast to long is definitivly needed result += readUInt32(byteBuffer) << 32; if (result < 0) { throw new RuntimeException("I don't know how to deal with UInt64! long is not sufficient and I don't want to use BigInt"); } result += readUInt32(byteBuffer); return result; } public static double readFixedPoint1616(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / 65536; } public static double readFixedPoint0230(ByteBuffer bb) {<FILL_FUNCTION_BODY>} public static float readFixedPoint88(ByteBuffer bb) { byte[] bytes = new byte[2]; bb.get(bytes); short result = 0; result |= ((bytes[0] << 8) & 0xFF00); result |= ((bytes[1]) & 0xFF); return ((float) result) / 256; } public static String readIso639(ByteBuffer bb) { int bits = readUInt16(bb); StringBuilder result = new StringBuilder(); for (int i = 0; i < 3; i++) { int c = (bits >> (2 - i) * 5) & 0x1f; result.append((char) (c + 0x60)); } return result.toString(); } public static String read4cc(ByteBuffer bb) { byte[] codeBytes = new byte[4]; bb.get(codeBytes); try { return new String(codeBytes, "ISO-8859-1"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } public static long readUInt48(ByteBuffer byteBuffer) { long result = (long) readUInt16(byteBuffer) << 32; if (result < 0) { throw new RuntimeException("I don't know how to deal with UInt64! long is not sufficient and I don't want to use BigInt"); } result += readUInt32(byteBuffer); return result; } }
byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / (1 << 30);
1,340
130
1,470
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/IsoTypeReaderVariable.java
IsoTypeReaderVariable
read
class IsoTypeReaderVariable { public static long read(ByteBuffer bb, int bytes) {<FILL_FUNCTION_BODY>} }
switch (bytes) { case 1: return IsoTypeReader.readUInt8(bb); case 2: return IsoTypeReader.readUInt16(bb); case 3: return IsoTypeReader.readUInt24(bb); case 4: return IsoTypeReader.readUInt32(bb); case 8: return IsoTypeReader.readUInt64(bb); default: throw new RuntimeException("I don't know how to read " + bytes + " bytes"); }
39
149
188
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/IsoTypeWriter.java
IsoTypeWriter
writeUInt24
class IsoTypeWriter { public static void writeUInt64(ByteBuffer bb, long u) { assert u >= 0 : "The given long is negative"; bb.putLong(u); } public static void writeUInt32(ByteBuffer bb, long u) { assert u >= 0 && u <= 1L << 32 : "The given long is not in the range of uint32 (" + u + ")"; bb.putInt((int) u); } public static void writeUInt32BE(ByteBuffer bb, long u) { assert u >= 0 && u <= 1L << 32 : "The given long is not in the range of uint32 (" + u + ")"; writeUInt16BE(bb, (int) u & 0xFFFF); writeUInt16BE(bb, (int) ((u >> 16) & 0xFFFF)); } public static void writeUInt24(ByteBuffer bb, int i) {<FILL_FUNCTION_BODY>} public static void writeUInt48(ByteBuffer bb, long l) { l = l & 0xFFFFFFFFFFFFL; writeUInt16(bb, (int) (l >> 32)); writeUInt32(bb, l & 0xFFFFFFFFL); } public static void writeUInt16(ByteBuffer bb, int i) { i = i & 0xFFFF; writeUInt8(bb, i >> 8); writeUInt8(bb, i & 0xFF); } public static void writeUInt16BE(ByteBuffer bb, int i) { i = i & 0xFFFF; writeUInt8(bb, i & 0xFF); writeUInt8(bb, i >> 8); } public static void writeUInt8(ByteBuffer bb, int i) { i = i & 0xFF; bb.put((byte) i); } public static void writeFixedPoint1616(ByteBuffer bb, double v) { int result = (int) (v * 65536); bb.put((byte) ((result & 0xFF000000) >> 24)); bb.put((byte) ((result & 0x00FF0000) >> 16)); bb.put((byte) ((result & 0x0000FF00) >> 8)); bb.put((byte) ((result & 0x000000FF))); } public static void writeFixedPoint0230(ByteBuffer bb, double v) { int result = (int) (v * (1 << 30)); bb.put((byte) ((result & 0xFF000000) >> 24)); bb.put((byte) ((result & 0x00FF0000) >> 16)); bb.put((byte) ((result & 0x0000FF00) >> 8)); bb.put((byte) ((result & 0x000000FF))); } public static void writeFixedPoint88(ByteBuffer bb, double v) { short result = (short) (v * 256); bb.put((byte) ((result & 0xFF00) >> 8)); bb.put((byte) ((result & 0x00FF))); } public static void writeIso639(ByteBuffer bb, String language) { if (language.getBytes().length != 3) { throw new IllegalArgumentException("\"" + language + "\" language string isn't exactly 3 characters long!"); } int bits = 0; for (int i = 0; i < 3; i++) { bits += (language.getBytes()[i] - 0x60) << (2 - i) * 5; } writeUInt16(bb, bits); } public static void writePascalUtfString(ByteBuffer bb, String string) { byte[] b = Utf8.convert(string); assert b.length < 255; writeUInt8(bb, b.length); bb.put(b); } public static void writeZeroTermUtf8String(ByteBuffer bb, String string) { byte[] b = Utf8.convert(string); bb.put(b); writeUInt8(bb, 0); } public static void writeUtf8String(ByteBuffer bb, String string) { bb.put(Utf8.convert(string)); writeUInt8(bb, 0); } }
i = i & 0xFFFFFF; writeUInt16(bb, i >> 8); writeUInt8(bb, i);
1,230
42
1,272
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/IsoTypeWriterVariable.java
IsoTypeWriterVariable
write
class IsoTypeWriterVariable { public static void write(long v, ByteBuffer bb, int bytes) {<FILL_FUNCTION_BODY>} }
switch (bytes) { case 1: IsoTypeWriter.writeUInt8(bb, (int) (v & 0xff)); break; case 2: IsoTypeWriter.writeUInt16(bb, (int) (v & 0xffff)); break; case 3: IsoTypeWriter.writeUInt24(bb, (int) (v & 0xffffff)); break; case 4: IsoTypeWriter.writeUInt32(bb, v); break; case 8: IsoTypeWriter.writeUInt64(bb, v); break; default: throw new RuntimeException("I don't know how to read " + bytes + " bytes"); }
42
200
242
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Mp4Arrays.java
Mp4Arrays
copyOfAndAppend
class Mp4Arrays { private Mp4Arrays() { } public static long[] copyOfAndAppend(long[] original, long... toAppend) { if (original == null) { original = new long[]{}; } if (toAppend == null) { toAppend = new long[]{}; } long[] copy = new long[original.length + toAppend.length]; System.arraycopy(original, 0, copy, 0, original.length); System.arraycopy(toAppend, 0, copy, original.length, toAppend.length); return copy; } public static int[] copyOfAndAppend(int[] original, int... toAppend) { if (original == null) { original = new int[]{}; } if (toAppend == null) { toAppend = new int[]{}; } int[] copy = new int[original.length + toAppend.length]; System.arraycopy(original, 0, copy, 0, original.length); System.arraycopy(toAppend, 0, copy, original.length, toAppend.length); return copy; } public static byte[] copyOfAndAppend(byte[] original, byte... toAppend) { if (original == null) { original = new byte[]{}; } if (toAppend == null) { toAppend = new byte[]{}; } byte[] copy = new byte[original.length + toAppend.length]; System.arraycopy(original, 0, copy, 0, original.length); System.arraycopy(toAppend, 0, copy, original.length, toAppend.length); return copy; } public static double[] copyOfAndAppend(double[] original, double... toAppend) {<FILL_FUNCTION_BODY>} }
if (original == null) { original = new double[]{}; } if (toAppend == null) { toAppend = new double[]{}; } double[] copy = new double[original.length + toAppend.length]; System.arraycopy(original, 0, copy, 0, original.length); System.arraycopy(toAppend, 0, copy, original.length, toAppend.length); return copy;
463
113
576
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Mp4Math.java
Mp4Math
gcd
class Mp4Math { public static long gcd(long a, long b) {<FILL_FUNCTION_BODY>} public static int gcd(int a, int b) { while (b > 0) { int temp = b; b = a % b; // % is remainder a = temp; } return a; } public static long lcm(long a, long b) { return a * (b / gcd(a, b)); } public static long lcm(long[] input) { long result = input[0]; for (int i = 1; i < input.length; i++) result = lcm(result, input[i]); return result; } public static int lcm(int a, int b) { return a * (b / gcd(a, b)); } }
while (b > 0) { long temp = b; b = a % b; // % is remainder a = temp; } return a;
226
45
271
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Offsets.java
Offsets
find
class Offsets { public static long find(Container container, ParsableBox target, long offset) {<FILL_FUNCTION_BODY>} }
long nuOffset = offset; for (Box lightBox : container.getBoxes()) { if (lightBox == target) { return nuOffset; } if (lightBox instanceof Container) { long r = find((Container) lightBox, target, 0); if (r > 0) { return r + nuOffset; } else { nuOffset += lightBox.getSize(); } } else { nuOffset += lightBox.getSize(); } } return -1;
39
137
176
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Path.java
Path
getPaths
class Path { public static Pattern component = Pattern.compile("(....|\\.\\.)(\\[(.*)\\])?"); private Path() { } public static <T extends Box> T getPath(Box parsableBox, String path) { List<T> all = getPaths(parsableBox, path, true); return all.isEmpty() ? null : all.get(0); } public static <T extends Box> T getPath(Container container, String path) { List<T> all = getPaths(container, path, true); return all.isEmpty() ? null : all.get(0); } public static <T extends Box> T getPath(AbstractContainerBox containerBox, String path) { List<T> all = getPaths(containerBox, path, true); return all.isEmpty() ? null : all.get(0); } public static <T extends Box> List<T> getPaths(Box box, String path) { return getPaths(box, path, false); } public static <T extends Box> List<T> getPaths(Container container, String path) { return getPaths(container, path, false); } private static <T extends Box> List<T> getPaths(AbstractContainerBox container, String path, boolean singleResult) { return getPaths((Object) container, path, singleResult); } private static <T extends Box> List<T> getPaths(Container container, String path, boolean singleResult) { return getPaths((Object) container, path, singleResult); } private static <T extends Box> List<T> getPaths(ParsableBox parsableBox, String path, boolean singleResult) { return getPaths((Object) parsableBox, path, singleResult); } @SuppressWarnings("unchecked") private static <T extends Box> List<T> getPaths(Object thing, String path, boolean singleResult) {<FILL_FUNCTION_BODY>} public static boolean isContained(Container ref, Box box, String path) { return getPaths(ref, path).contains(box); } }
if (path.startsWith("/")) { throw new RuntimeException("Cannot start at / - only relative path expression into the structure are allowed"); } if (path.length() == 0) { if (thing instanceof ParsableBox) { return Collections.singletonList((T) thing); } else { throw new RuntimeException("Result of path expression seems to be the root container. This is not allowed!"); } } else { String later; String now; if (path.contains("/")) { later = path.substring(path.indexOf('/') + 1); now = path.substring(0, path.indexOf('/')); } else { now = path; later = ""; } Matcher m = component.matcher(now); if (m.matches()) { String type = m.group(1); if ("..".equals(type)) { throw new RuntimeException(".. notation no longer allowed"); } else { if (thing instanceof Container) { int index = -1; if (m.group(2) != null) { // we have a specific index String indexString = m.group(3); index = Integer.parseInt(indexString); } List<T> children = new LinkedList<T>(); int currentIndex = 0; // I'm suspecting some Dalvik VM to create indexed loops from for-each loops // using the iterator instead makes sure that this doesn't happen // (and yes - it could be completely useless) Iterator<Box> iterator = ((Container) thing).getBoxes().iterator(); while (iterator.hasNext()) { Box box1 = iterator.next(); if (box1.getType().matches(type)) { if (index == -1 || index == currentIndex) { children.addAll(Path.<T>getPaths(box1, later, singleResult)); } currentIndex++; } if ((singleResult || index >= 0) && !children.isEmpty()) { return children; } } return children; } else { return Collections.emptyList(); } } } else { throw new RuntimeException(now + " is invalid path."); } }
558
585
1,143
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/RangeStartMap.java
RangeStartMap
get
class RangeStartMap<K extends Comparable, V> implements Map<K, V> { TreeMap<K, V> base = new TreeMap<K, V>(new Comparator<K>() { public int compare(K o1, K o2) { return -o1.compareTo(o2); } }); public RangeStartMap() { } public RangeStartMap(K k, V v) { this.put(k, v); } public int size() { return base.size(); } public boolean isEmpty() { return base.isEmpty(); } public boolean containsKey(Object key) { return base.get(key) != null; } public boolean containsValue(Object value) { return false; } public V get(Object k) {<FILL_FUNCTION_BODY>} public V put(K key, V value) { return base.put(key, value); } public V remove(Object k) { if (!(k instanceof Comparable)) { return null; } Comparable<K> key = (Comparable<K>) k; if (isEmpty()) { return null; } Iterator<K> keys = base.keySet().iterator(); K a = keys.next(); do { if (keys.hasNext()) { if (key.compareTo(a) < 0) { a = keys.next(); } else { return base.remove(a); } } else { return base.remove(a); } } while (true); } public void putAll(Map<? extends K, ? extends V> m) { base.putAll(m); } public void clear() { base.clear(); } public Set<K> keySet() { return base.keySet(); } public Collection<V> values() { return base.values(); } public Set<Entry<K, V>> entrySet() { return base.entrySet(); } }
if (!(k instanceof Comparable)) { return null; } Comparable<K> key = (Comparable<K>) k; if (isEmpty()) { return null; } Iterator<K> keys = base.keySet().iterator(); K a = keys.next(); do { if (keys.hasNext()) { if (key.compareTo(a) < 0) { a = keys.next(); } else { return base.get(a); } } else { return base.get(a); } } while (true);
561
161
722
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/UUIDConverter.java
UUIDConverter
convert
class UUIDConverter { public static byte[] convert(UUID uuid) {<FILL_FUNCTION_BODY>} public static UUID convert(byte[] uuidBytes) { ByteBuffer b = ByteBuffer.wrap(uuidBytes); b.order(ByteOrder.BIG_ENDIAN); return new UUID(b.getLong(), b.getLong()); } }
long msb = uuid.getMostSignificantBits(); long lsb = uuid.getLeastSignificantBits(); byte[] buffer = new byte[16]; for (int i = 0; i < 8; i++) { buffer[i] = (byte) (msb >>> 8 * (7 - i)); } for (int i = 8; i < 16; i++) { buffer[i] = (byte) (lsb >>> 8 * (7 - i)); } return buffer;
95
144
239
<no_super_class>
sannies_mp4parser
mp4parser/isoparser/src/main/java/org/mp4parser/tools/Utf8.java
Utf8
convert
class Utf8 { public static byte[] convert(String s) {<FILL_FUNCTION_BODY>} public static String convert(byte[] b) { try { if (b != null) { return new String(b, "UTF-8"); } else { return null; } } catch (UnsupportedEncodingException e) { throw new Error(e); } } public static int utf8StringLengthInBytes(String utf8) { try { if (utf8 != null) { return utf8.getBytes("UTF-8").length; } else { return 0; } } catch (UnsupportedEncodingException e) { throw new RuntimeException(); } } }
try { if (s != null) { return s.getBytes("UTF-8"); } else { return null; } } catch (UnsupportedEncodingException e) { throw new Error(e); }
198
65
263
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/AbstractTrack.java
AbstractTrack
getDuration
class AbstractTrack implements Track { String name; List<Edit> edits = new ArrayList<Edit>(); Map<GroupEntry, long[]> sampleGroups = new HashMap<GroupEntry, long[]>(); public AbstractTrack(String name) { this.name = name; } public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return null; } public long[] getSyncSamples() { return null; } public List<SampleDependencyTypeBox.Entry> getSampleDependencies() { return null; } public SubSampleInformationBox getSubsampleInformationBox() { return null; } public long getDuration() {<FILL_FUNCTION_BODY>} public String getName() { return this.name; } public List<Edit> getEdits() { return edits; } public Map<GroupEntry, long[]> getSampleGroups() { return sampleGroups; } }
long duration = 0; for (long delta : getSampleDurations()) { duration += delta; } return duration;
263
38
301
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/CencMp4TrackImplImpl.java
FindSaioSaizPair
invoke
class FindSaioSaizPair { private Container container; private SampleAuxiliaryInformationSizesBox saiz; private SampleAuxiliaryInformationOffsetsBox saio; public FindSaioSaizPair(Container container) { this.container = container; } public SampleAuxiliaryInformationSizesBox getSaiz() { return saiz; } public SampleAuxiliaryInformationOffsetsBox getSaio() { return saio; } public FindSaioSaizPair invoke() {<FILL_FUNCTION_BODY>} }
List<SampleAuxiliaryInformationSizesBox> saizs = container.getBoxes(SampleAuxiliaryInformationSizesBox.class); List<SampleAuxiliaryInformationOffsetsBox> saios = container.getBoxes(SampleAuxiliaryInformationOffsetsBox.class); assert saizs.size() == saios.size(); saiz = null; saio = null; for (int i = 0; i < saizs.size(); i++) { if (saiz == null && (saizs.get(i).getAuxInfoType() == null) || "cenc".equals(saizs.get(i).getAuxInfoType())) { saiz = saizs.get(i); } else if (saiz != null && saiz.getAuxInfoType() == null && "cenc".equals(saizs.get(i).getAuxInfoType())) { saiz = saizs.get(i); } else { throw new RuntimeException("Are there two cenc labeled saiz?"); } if (saio == null && (saios.get(i).getAuxInfoType() == null) || "cenc".equals(saios.get(i).getAuxInfoType())) { saio = saios.get(i); } else if (saio != null && saio.getAuxInfoType() == null && "cenc".equals(saios.get(i).getAuxInfoType())) { saio = saios.get(i); } else { throw new RuntimeException("Are there two cenc labeled saio?"); } } return this;
158
417
575
<methods>public void <init>(long, org.mp4parser.Container, org.mp4parser.muxer.RandomAccessSource, java.lang.String) ,public void close() throws java.io.IOException,public List<org.mp4parser.boxes.iso14496.part12.CompositionTimeToSample.Entry> getCompositionTimeEntries() ,public java.lang.String getHandler() ,public List<org.mp4parser.boxes.iso14496.part12.SampleDependencyTypeBox.Entry> getSampleDependencies() ,public synchronized long[] getSampleDurations() ,public List<org.mp4parser.boxes.sampleentry.SampleEntry> getSampleEntries() ,public List<org.mp4parser.muxer.Sample> getSamples() ,public org.mp4parser.boxes.iso14496.part12.SubSampleInformationBox getSubsampleInformationBox() ,public long[] getSyncSamples() ,public org.mp4parser.muxer.TrackMetaData getTrackMetaData() <variables>private List<org.mp4parser.boxes.iso14496.part12.CompositionTimeToSample.Entry> compositionTimeEntries,private long[] decodingTimes,private java.lang.String handler,private List<org.mp4parser.boxes.iso14496.part12.SampleDependencyTypeBox.Entry> sampleDependencies,private org.mp4parser.boxes.iso14496.part12.SampleDescriptionBox sampleDescriptionBox,private List<org.mp4parser.muxer.Sample> samples,private org.mp4parser.boxes.iso14496.part12.SubSampleInformationBox subSampleInformationBox,private long[] syncSamples,private org.mp4parser.muxer.TrackMetaData trackMetaData
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/FileDataSourceImpl.java
FileDataSourceImpl
map
class FileDataSourceImpl implements DataSource { private static Logger LOG = LoggerFactory.getLogger(FileDataSourceImpl.class); FileChannel fc; String filename; public FileDataSourceImpl(File f) throws FileNotFoundException { this.fc = new FileInputStream(f).getChannel(); this.filename = f.getName(); } public FileDataSourceImpl(String f) throws FileNotFoundException { File file = new File(f); this.fc = new FileInputStream(file).getChannel(); this.filename = file.getName(); } public FileDataSourceImpl(FileChannel fc) { this.fc = fc; this.filename = "unknown"; } public FileDataSourceImpl(FileChannel fc, String filename) { this.fc = fc; this.filename = filename; } public synchronized int read(ByteBuffer byteBuffer) throws IOException { return fc.read(byteBuffer); } public synchronized long size() throws IOException { return fc.size(); } public synchronized long position() throws IOException { return fc.position(); } public synchronized void position(long nuPos) throws IOException { fc.position(nuPos); } public synchronized long transferTo(long startPosition, long count, WritableByteChannel sink) throws IOException { return fc.transferTo(startPosition, count, sink); } public synchronized ByteBuffer map(long startPosition, long size) throws IOException {<FILL_FUNCTION_BODY>} public void close() throws IOException { fc.close(); } @Override public String toString() { return filename; } }
LOG.debug(startPosition + " " + size); return fc.map(FileChannel.MapMode.READ_ONLY, startPosition, size);
448
41
489
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/FileDataSourceViaHeapImpl.java
FileDataSourceViaHeapImpl
map
class FileDataSourceViaHeapImpl implements DataSource { private static Logger LOG = LoggerFactory.getLogger(FileDataSourceViaHeapImpl.class); FileChannel fc; String filename; public FileDataSourceViaHeapImpl(File f) throws FileNotFoundException { this.fc = new FileInputStream(f).getChannel(); this.filename = f.getName(); } public FileDataSourceViaHeapImpl(String f) throws FileNotFoundException { File file = new File(f); this.fc = new FileInputStream(file).getChannel(); this.filename = file.getName(); } public FileDataSourceViaHeapImpl(FileChannel fc) { this.fc = fc; this.filename = "unknown"; } public FileDataSourceViaHeapImpl(FileChannel fc, String filename) { this.fc = fc; this.filename = filename; } public synchronized int read(ByteBuffer byteBuffer) throws IOException { return fc.read(byteBuffer); } public synchronized long size() throws IOException { return fc.size(); } public synchronized long position() throws IOException { return fc.position(); } public synchronized void position(long nuPos) throws IOException { fc.position(nuPos); } public synchronized long transferTo(long startPosition, long count, WritableByteChannel sink) throws IOException { return fc.transferTo(startPosition, count, sink); } public synchronized ByteBuffer map(long startPosition, long size) throws IOException {<FILL_FUNCTION_BODY>} public void close() throws IOException { fc.close(); } @Override public String toString() { return filename; } }
ByteBuffer bb = ByteBuffer.allocate(l2i(size)); fc.read(bb, startPosition); return (ByteBuffer) ((Buffer)bb).rewind();
473
49
522
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/FileRandomAccessSourceImpl.java
FileRandomAccessSourceImpl
get
class FileRandomAccessSourceImpl implements RandomAccessSource { private RandomAccessFile raf; public FileRandomAccessSourceImpl(RandomAccessFile raf) { this.raf = raf; } public ByteBuffer get(long offset, long size) throws IOException {<FILL_FUNCTION_BODY>} public void close() throws IOException { raf.close(); } }
byte[] b = new byte[l2i(size)]; raf.seek(offset); raf.read(b); return ByteBuffer.wrap(b);
102
47
149
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/MemoryDataSourceImpl.java
MemoryDataSourceImpl
map
class MemoryDataSourceImpl implements DataSource { ByteBuffer data; public MemoryDataSourceImpl(byte[] data) { this.data = ByteBuffer.wrap(data); } public MemoryDataSourceImpl(ByteBuffer buffer) { this.data = buffer; } public int read(ByteBuffer byteBuffer) throws IOException { if (0 == data.remaining() && 0 != byteBuffer.remaining()) { return -1; } int size = Math.min(byteBuffer.remaining(), data.remaining()); if (byteBuffer.hasArray()) { byteBuffer.put(data.array(), data.position(), size); ((Buffer)data).position(data.position() + size); } else { byte[] buf = new byte[size]; data.get(buf); byteBuffer.put(buf); } return size; } public long size() throws IOException { return data.capacity(); } public long position() throws IOException { return data.position(); } public void position(long nuPos) throws IOException { ((Buffer)data).position(l2i(nuPos)); } public long transferTo(long position, long count, WritableByteChannel target) throws IOException { return target.write((ByteBuffer) ((Buffer)((ByteBuffer)((Buffer)data).position(l2i(position))).slice()).limit(l2i(count))); } public ByteBuffer map(long startPosition, long size) throws IOException {<FILL_FUNCTION_BODY>} public void close() throws IOException { //nop } }
int oldPosition = data.position(); ((Buffer)data).position(l2i(startPosition)); ByteBuffer result = data.slice(); ((Buffer)result).limit(l2i(size)); ((Buffer)data).position(oldPosition); return result;
419
71
490
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/Movie.java
Movie
addTrack
class Movie { Matrix matrix = Matrix.ROTATE_0; List<Track> tracks = new LinkedList<Track>(); public Movie() { } public Movie(List<Track> tracks) { this.tracks = tracks; } public List<Track> getTracks() { return tracks; } public void setTracks(List<Track> tracks) { this.tracks = tracks; } public void addTrack(Track nuTrack) {<FILL_FUNCTION_BODY>} @Override public String toString() { String s = "Movie{ "; for (Track track : tracks) { s += "track_" + track.getTrackMetaData().getTrackId() + " (" + track.getHandler() + ") "; } s += '}'; return s; } public long getNextTrackId() { long nextTrackId = 0; for (Track track : tracks) { nextTrackId = nextTrackId < track.getTrackMetaData().getTrackId() ? track.getTrackMetaData().getTrackId() : nextTrackId; } return ++nextTrackId; } public Track getTrackByTrackId(long trackId) { for (Track track : tracks) { if (track.getTrackMetaData().getTrackId() == trackId) { return track; } } return null; } public long getTimescale() { long timescale = this.getTracks().iterator().next().getTrackMetaData().getTimescale(); for (Track track : this.getTracks()) { timescale = gcd(track.getTrackMetaData().getTimescale(), timescale); } return timescale; } public Matrix getMatrix() { return matrix; } public void setMatrix(Matrix matrix) { this.matrix = matrix; } }
// do some checking // perhaps the movie needs to get longer! if (getTrackByTrackId(nuTrack.getTrackMetaData().getTrackId()) != null) { // We already have a track with that trackId. Create a new one nuTrack.getTrackMetaData().setTrackId(getNextTrackId()); } tracks.add(nuTrack);
501
95
596
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/MultiFileDataSourceImpl.java
MultiFileDataSourceImpl
transferTo
class MultiFileDataSourceImpl implements DataSource { FileChannel[] fcs; int index = 0; public MultiFileDataSourceImpl(File... f) throws FileNotFoundException { this.fcs = new FileChannel[f.length]; for (int i = 0; i < f.length; i++) { fcs[i] = new FileInputStream(f[i]).getChannel(); } } public int read(ByteBuffer byteBuffer) throws IOException { int numOfBytesToRead = byteBuffer.remaining(); int numOfBytesRead = 0; if ((numOfBytesRead = fcs[index].read(byteBuffer)) != numOfBytesToRead) { index++; return numOfBytesRead + read(byteBuffer); } else { return numOfBytesRead; } } public long size() throws IOException { long size = 0; for (FileChannel fileChannel : fcs) { size += fileChannel.size(); } return size; } public long position() throws IOException { long position = 0; for (int i = 0; i < index; i++) { position += fcs[i].size(); } return position + fcs[index].position(); } public void position(long nuPos) throws IOException { for (int i = 0; i < fcs.length; i++) { if ((nuPos - fcs[i].size()) < 0) { fcs[i].position(nuPos); index = i; break; } else { nuPos -= fcs[i].size(); } } } public long transferTo(long startPosition, long count, WritableByteChannel sink) throws IOException {<FILL_FUNCTION_BODY>} public ByteBuffer map(long startPosition, long size) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(l2i(size)); transferTo(startPosition, size, Channels.newChannel(baos)); return ByteBuffer.wrap(baos.toByteArray()); } public void close() throws IOException { for (FileChannel fileChannel : fcs) { fileChannel.close(); } } }
if (count == 0) { return 0; } long currentPos = 0; for (FileChannel fc : fcs) { long size = fc.size(); if (startPosition >= currentPos && startPosition < currentPos + size && startPosition + count > currentPos) { // current fcs reaches into fcs long bytesToTransfer = Math.min(count, size - (startPosition - currentPos)); fc.transferTo(startPosition - currentPos, bytesToTransfer, sink); return bytesToTransfer + transferTo(startPosition + bytesToTransfer, count - bytesToTransfer, sink); } currentPos += size; } return 0;
580
180
760
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/PiffMp4TrackImpl.java
PiffMp4TrackImpl
toString
class PiffMp4TrackImpl extends Mp4TrackImpl implements CencEncryptedTrack { private List<CencSampleAuxiliaryDataFormat> sampleEncryptionEntries; private UUID defaultKeyId; /** * Creates a track from a TrackBox and potentially fragments. Use <b>fragements parameter * only</b> to supply additional fragments that are not located in the main file. * * @param trackId ID of the track to extract * @param isofile the parsed MP4 file * @param randomAccess the RandomAccessSource to read the samples from * @param name an arbitrary naem to identify track later - e.g. filename * @throws IOException if reading from underlying <code>DataSource</code> fails */ public PiffMp4TrackImpl(final long trackId, Container isofile, RandomAccessSource randomAccess, String name) throws IOException { super(trackId, isofile, randomAccess, name); TrackBox trackBox = null; for (TrackBox box : Path.<TrackBox>getPaths(isofile, "moov/trak")) { if (box.getTrackHeaderBox().getTrackId() == trackId) { trackBox = box; break; } } SchemeTypeBox schm = Path.getPath(trackBox, "mdia[0]/minf[0]/stbl[0]/stsd[0]/enc.[0]/sinf[0]/schm[0]"); assert schm != null && (schm.getSchemeType().equals("piff")) : "Track must be PIFF encrypted"; sampleEncryptionEntries = new ArrayList<CencSampleAuxiliaryDataFormat>(); final List<MovieExtendsBox> movieExtendsBoxes = Path.getPaths(isofile, "moov/mvex"); if (!movieExtendsBoxes.isEmpty()) { for (MovieFragmentBox movieFragmentBox : isofile.getBoxes(MovieFragmentBox.class)) { List<TrackFragmentBox> trafs = movieFragmentBox.getBoxes(TrackFragmentBox.class); for (TrackFragmentBox traf : trafs) { if (traf.getTrackFragmentHeaderBox().getTrackId() == trackId) { AbstractTrackEncryptionBox tenc = Path.getPath(trackBox, "mdia[0]/minf[0]/stbl[0]/stsd[0]/enc.[0]/sinf[0]/schi[0]/uuid[0]"); assert tenc != null; defaultKeyId = tenc.getDefault_KID(); long baseOffset; if (traf.getTrackFragmentHeaderBox().hasBaseDataOffset()) { baseOffset = traf.getTrackFragmentHeaderBox().getBaseDataOffset(); } else { Iterator<Box> it = isofile.getBoxes().iterator(); baseOffset = 0; for (Box b = it.next(); b != movieFragmentBox; b = it.next()) { baseOffset += b.getSize(); } } List<TrackRunBox> truns = traf.getBoxes(TrackRunBox.class); int sampleNo = 0; AbstractSampleEncryptionBox senc = traf.getBoxes(AbstractSampleEncryptionBox.class).get(0); for (CencSampleAuxiliaryDataFormat cencSampleAuxiliaryDataFormat : senc.getEntries()) { sampleEncryptionEntries.add(cencSampleAuxiliaryDataFormat); } } } } } } public UUID getDefaultKeyId() { return defaultKeyId; } public boolean hasSubSampleEncryption() { return false; } public List<CencSampleAuxiliaryDataFormat> getSampleEncryptionEntries() { return sampleEncryptionEntries; } @Override public String toString() {<FILL_FUNCTION_BODY>} @Override public String getName() { return "enc(" + super.getName() + ")"; } }
return "PiffMp4TrackImpl{" + "handler='" + getHandler() + '\'' + '}';
1,043
35
1,078
<methods>public void <init>(long, org.mp4parser.Container, org.mp4parser.muxer.RandomAccessSource, java.lang.String) ,public void close() throws java.io.IOException,public List<org.mp4parser.boxes.iso14496.part12.CompositionTimeToSample.Entry> getCompositionTimeEntries() ,public java.lang.String getHandler() ,public List<org.mp4parser.boxes.iso14496.part12.SampleDependencyTypeBox.Entry> getSampleDependencies() ,public synchronized long[] getSampleDurations() ,public List<org.mp4parser.boxes.sampleentry.SampleEntry> getSampleEntries() ,public List<org.mp4parser.muxer.Sample> getSamples() ,public org.mp4parser.boxes.iso14496.part12.SubSampleInformationBox getSubsampleInformationBox() ,public long[] getSyncSamples() ,public org.mp4parser.muxer.TrackMetaData getTrackMetaData() <variables>private List<org.mp4parser.boxes.iso14496.part12.CompositionTimeToSample.Entry> compositionTimeEntries,private long[] decodingTimes,private java.lang.String handler,private List<org.mp4parser.boxes.iso14496.part12.SampleDependencyTypeBox.Entry> sampleDependencies,private org.mp4parser.boxes.iso14496.part12.SampleDescriptionBox sampleDescriptionBox,private List<org.mp4parser.muxer.Sample> samples,private org.mp4parser.boxes.iso14496.part12.SubSampleInformationBox subSampleInformationBox,private long[] syncSamples,private org.mp4parser.muxer.TrackMetaData trackMetaData
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/SampleImpl.java
SampleImpl
toString
class SampleImpl implements Sample { private final long offset; private final long size; private ByteBuffer[] data; private SampleEntry sampleEntry; public SampleImpl(ByteBuffer buf, SampleEntry sampleEntry) { this.offset = -1; this.size = buf.limit(); this.data = new ByteBuffer[]{buf}; this.sampleEntry = sampleEntry; } public SampleImpl(ByteBuffer[] data, SampleEntry sampleEntry) { this.offset = -1; int _size = 0; for (ByteBuffer byteBuffer : data) { _size += byteBuffer.remaining(); } this.size = _size; this.data = data; this.sampleEntry = sampleEntry; } public SampleImpl(long offset, long sampleSize, ByteBuffer data, SampleEntry sampleEntry) { this.offset = offset; this.size = sampleSize; this.data = new ByteBuffer[]{data}; this.sampleEntry = sampleEntry; } public void writeTo(WritableByteChannel channel) throws IOException { for (ByteBuffer b : data) { channel.write(b.duplicate()); } } @Override public SampleEntry getSampleEntry() { return sampleEntry; } public long getSize() { return size; } public ByteBuffer asByteBuffer() { byte[] bCopy = new byte[l2i(size)]; ByteBuffer copy = ByteBuffer.wrap(bCopy); for (ByteBuffer b : data) { copy.put(b.duplicate()); } ((Buffer)copy).rewind(); return copy; } @Override public String toString() {<FILL_FUNCTION_BODY>} }
final StringBuilder sb = new StringBuilder(); sb.append("SampleImpl"); sb.append("{offset=").append(offset); sb.append("{size=").append(size); sb.append('}'); return sb.toString();
454
66
520
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/TrackMetaData.java
TrackMetaData
clone
class TrackMetaData implements Cloneable { /** * specifies the front-to-back ordering of video tracks; tracks with lower * numbers are closer to the viewer. 0 is the normal value, and -1 would be * in front of track 0, and so on. */ int layer; private String language = "eng"; private long timescale; private Date modificationTime = new Date(); private Date creationTime = new Date(); private Matrix matrix = Matrix.ROTATE_0; private double width; private double height; private float volume; private long trackId = 1; // zero is not allowed private int group = 0; public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public long getTimescale() { return timescale; } public void setTimescale(long timescale) { this.timescale = timescale; } public Date getModificationTime() { return modificationTime; } public void setModificationTime(Date modificationTime) { this.modificationTime = modificationTime; } public Date getCreationTime() { return creationTime; } public void setCreationTime(Date creationTime) { this.creationTime = creationTime; } public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public long getTrackId() { return trackId; } public void setTrackId(long trackId) { this.trackId = trackId; } public int getLayer() { return layer; } public void setLayer(int layer) { this.layer = layer; } public float getVolume() { return volume; } public void setVolume(float volume) { this.volume = volume; } public int getGroup() { return group; } public void setGroup(int group) { this.group = group; } public Matrix getMatrix() { return matrix; } public void setMatrix(Matrix matrix) { this.matrix = matrix; } public Object clone() {<FILL_FUNCTION_BODY>} }
try { return super.clone(); } catch (CloneNotSupportedException e) { return null; }
659
36
695
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/builder/ByteBufferHelper.java
ByteBufferHelper
mergeAdjacentBuffers
class ByteBufferHelper { public static List<ByteBuffer> mergeAdjacentBuffers(List<ByteBuffer> samples) {<FILL_FUNCTION_BODY>} }
ArrayList<ByteBuffer> nuSamples = new ArrayList<ByteBuffer>(samples.size()); for (ByteBuffer buffer : samples) { int lastIndex = nuSamples.size() - 1; if (lastIndex >= 0 && buffer.hasArray() && nuSamples.get(lastIndex).hasArray() && buffer.array() == nuSamples.get(lastIndex).array() && nuSamples.get(lastIndex).arrayOffset() + nuSamples.get(lastIndex).limit() == buffer.arrayOffset()) { ByteBuffer oldBuffer = nuSamples.remove(lastIndex); ByteBuffer nu = ByteBuffer.wrap(buffer.array(), oldBuffer.arrayOffset(), ((Buffer)oldBuffer).limit() + ((Buffer)buffer).limit()).slice(); // We need to slice here since wrap([], offset, length) just sets position and not the arrayOffset. nuSamples.add(nu); } else if (lastIndex >= 0 && buffer instanceof MappedByteBuffer && nuSamples.get(lastIndex) instanceof MappedByteBuffer && nuSamples.get(lastIndex).limit() == nuSamples.get(lastIndex).capacity() - buffer.capacity()) { // This can go wrong - but will it? ByteBuffer oldBuffer = nuSamples.get(lastIndex); ((Buffer)oldBuffer).limit(buffer.limit() + oldBuffer.limit()); } else { buffer.reset(); nuSamples.add(buffer); } } return nuSamples;
44
371
415
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/builder/DefaultFragmenterImpl.java
DefaultFragmenterImpl
sampleNumbers
class DefaultFragmenterImpl implements Fragmenter { private double fragmentLength = 2; public DefaultFragmenterImpl(double fragmentLength) { this.fragmentLength = fragmentLength; } public static void main(String[] args) { DefaultMp4Builder b = new DefaultMp4Builder(); b.setFragmenter(new DefaultFragmenterImpl(0.5)); } /** * {@inheritDoc} */ public long[] sampleNumbers(Track track) {<FILL_FUNCTION_BODY>} }
long[] segmentStartSamples = new long[]{1}; long[] sampleDurations = track.getSampleDurations(); long[] syncSamples = track.getSyncSamples(); long timescale = track.getTrackMetaData().getTimescale(); double time = 0; for (int i = 0; i < sampleDurations.length; i++) { time += (double) sampleDurations[i] / timescale; if (time >= fragmentLength && (syncSamples == null || Arrays.binarySearch(syncSamples, i + 1) >= 0)) { if (i > 0) { segmentStartSamples = Mp4Arrays.copyOfAndAppend(segmentStartSamples, i + 1); } time = 0; } } return segmentStartSamples;
138
209
347
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/container/mp4/MovieCreator.java
MovieCreator
build
class MovieCreator { public static Movie build(String file) throws IOException { File f = new File(file); FileInputStream fis = new FileInputStream(f); Movie m = build(fis.getChannel(), new FileRandomAccessSourceImpl(new RandomAccessFile(f, "r")), file); fis.close(); return m; } /** * Creates <code>Movie</code> object from a <code>ReadableByteChannel</code>. * * @param name track name to identify later * @param readableByteChannel the box structure is read from this channel * @param randomAccessSource the samples or read from this randomAccessSource * @return a representation of the movie * @throws IOException in case of I/O error during IsoFile creation */ public static Movie build(ReadableByteChannel readableByteChannel, RandomAccessSource randomAccessSource, String name) throws IOException {<FILL_FUNCTION_BODY>} }
IsoFile isoFile = new IsoFile(readableByteChannel); Movie m = new Movie(); List<TrackBox> trackBoxes = isoFile.getMovieBox().getBoxes(TrackBox.class); for (TrackBox trackBox : trackBoxes) { SchemeTypeBox schm = Path.getPath(trackBox, "mdia[0]/minf[0]/stbl[0]/stsd[0]/enc.[0]/sinf[0]/schm[0]"); if (schm != null && (schm.getSchemeType().equals("cenc") || schm.getSchemeType().equals("cbc1"))) { m.addTrack(new CencMp4TrackImplImpl( trackBox.getTrackHeaderBox().getTrackId(), isoFile, randomAccessSource, name + "[" + trackBox.getTrackHeaderBox().getTrackId() + "]")); } else if (schm != null && (schm.getSchemeType().equals("piff"))) { m.addTrack(new PiffMp4TrackImpl( trackBox.getTrackHeaderBox().getTrackId(), isoFile, randomAccessSource, name + "[" + trackBox.getTrackHeaderBox().getTrackId() + "]")); } else { m.addTrack(new Mp4TrackImpl( trackBox.getTrackHeaderBox().getTrackId(), isoFile, randomAccessSource, name + "[" + trackBox.getTrackHeaderBox().getTrackId() + "]")); } } m.setMatrix(isoFile.getMovieBox().getMovieHeaderBox().getMatrix()); return m;
246
423
669
<no_super_class>
sannies_mp4parser
mp4parser/muxer/src/main/java/org/mp4parser/muxer/tracks/AbstractH26XTrack.java
AbstractH26XTrack
getSyncSamples
class AbstractH26XTrack extends AbstractTrack { public static int BUFFER = 65535 << 10; protected long[] decodingTimes; protected List<CompositionTimeToSample.Entry> ctts = new ArrayList<CompositionTimeToSample.Entry>(); protected List<SampleDependencyTypeBox.Entry> sdtp = new ArrayList<SampleDependencyTypeBox.Entry>(); protected List<Integer> stss = new ArrayList<Integer>(); protected TrackMetaData trackMetaData = new TrackMetaData(); boolean tripleZeroIsEndOfSequence = true; private DataSource dataSource; public AbstractH26XTrack(DataSource dataSource, boolean tripleZeroIsEndOfSequence) { super(dataSource.toString()); this.dataSource = dataSource; this.tripleZeroIsEndOfSequence = tripleZeroIsEndOfSequence; } public AbstractH26XTrack(DataSource dataSource) { this(dataSource, true); } protected static InputStream cleanBuffer(InputStream is) { return new CleanInputStream(is); } protected static byte[] toArray(ByteBuffer buf) { buf = buf.duplicate(); byte[] b = new byte[buf.remaining()]; buf.get(b, 0, b.length); return b; } public TrackMetaData getTrackMetaData() { return trackMetaData; } protected ByteBuffer findNextNal(LookAhead la) throws IOException { try { while (!la.nextThreeEquals001()) { la.discardByte(); } la.discardNext3AndMarkStart(); while (!la.nextThreeEquals000or001orEof(tripleZeroIsEndOfSequence)) { la.discardByte(); } return la.getNal(); } catch (EOFException e) { return null; } } abstract protected SampleEntry getCurrentSampleEntry(); /** * Builds an MP4 sample from a list of NALs. Each NAL will be preceded by its * 4 byte (unit32) length. * * @param nals a list of NALs that form the sample * @return sample as it appears in the MP4 file */ protected Sample createSampleObject(List<? extends ByteBuffer> nals) { byte[] sizeInfo = new byte[nals.size() * 4]; ByteBuffer sizeBuf = ByteBuffer.wrap(sizeInfo); for (ByteBuffer b : nals) { sizeBuf.putInt(b.remaining()); } ByteBuffer[] data = new ByteBuffer[nals.size() * 2]; for (int i = 0; i < nals.size(); i++) { data[2 * i] = ByteBuffer.wrap(sizeInfo, i * 4, 4); data[2 * i + 1] = nals.get(i); } return new SampleImpl(data, getCurrentSampleEntry()); } public long[] getSampleDurations() { return decodingTimes; } public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return ctts; } public long[] getSyncSamples() {<FILL_FUNCTION_BODY>} public List<SampleDependencyTypeBox.Entry> getSampleDependencies() { return sdtp; } public void close() throws IOException { dataSource.close(); } public static class LookAhead { long bufferStartPos = 0; int inBufferPos = 0; DataSource dataSource; ByteBuffer buffer; long start; public LookAhead(DataSource dataSource) throws IOException { this.dataSource = dataSource; fillBuffer(); } public void fillBuffer() throws IOException { buffer = dataSource.map(bufferStartPos, Math.min(dataSource.size() - bufferStartPos, BUFFER)); } public boolean nextThreeEquals001() throws IOException { if (buffer.limit() - inBufferPos >= 3) { return (buffer.get(inBufferPos) == 0 && buffer.get(inBufferPos + 1) == 0 && buffer.get(inBufferPos + 2) == 1); } if (bufferStartPos + inBufferPos + 3 >= dataSource.size()) { throw new EOFException(); } return false; } public boolean nextThreeEquals000or001orEof(boolean tripleZeroIsEndOfSequence) throws IOException { if (buffer.limit() - inBufferPos >= 3) { return ((buffer.get(inBufferPos) == 0 && buffer.get(inBufferPos + 1) == 0 && ((buffer.get(inBufferPos + 2) == 0 && tripleZeroIsEndOfSequence) || buffer.get(inBufferPos + 2) == 1))); } else { if (bufferStartPos + inBufferPos + 3 > dataSource.size()) { return bufferStartPos + inBufferPos == dataSource.size(); } else { bufferStartPos = start; inBufferPos = 0; fillBuffer(); return nextThreeEquals000or001orEof(tripleZeroIsEndOfSequence); } } } public void discardByte() { inBufferPos++; } public void discardNext3AndMarkStart() { inBufferPos += 3; start = bufferStartPos + inBufferPos; } public ByteBuffer getNal() { if (start >= bufferStartPos) { ((Buffer)buffer).position((int) (start - bufferStartPos)); Buffer sample = buffer.slice(); ((Buffer)sample).limit((int) (inBufferPos - (start - bufferStartPos))); return (ByteBuffer) sample; } else { throw new RuntimeException("damn! NAL exceeds buffer"); // this can only happen if NAL is bigger than the buffer // and that most likely cannot happen with correct inputs } } } }
long[] returns = new long[stss.size()]; for (int i = 0; i < stss.size(); i++) { returns[i] = stss.get(i); } return returns;
1,548
60
1,608
<methods>public void <init>(java.lang.String) ,public List<org.mp4parser.boxes.iso14496.part12.CompositionTimeToSample.Entry> getCompositionTimeEntries() ,public long getDuration() ,public List<org.mp4parser.muxer.Edit> getEdits() ,public java.lang.String getName() ,public List<org.mp4parser.boxes.iso14496.part12.SampleDependencyTypeBox.Entry> getSampleDependencies() ,public Map<org.mp4parser.boxes.samplegrouping.GroupEntry,long[]> getSampleGroups() ,public org.mp4parser.boxes.iso14496.part12.SubSampleInformationBox getSubsampleInformationBox() ,public long[] getSyncSamples() <variables>List<org.mp4parser.muxer.Edit> edits,java.lang.String name,Map<org.mp4parser.boxes.samplegrouping.GroupEntry,long[]> sampleGroups