com.mp4parser.streaming.extensions.SampleFlagsSampleExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isoparser Show documentation
Show all versions of isoparser Show documentation
A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)
package com.mp4parser.streaming.extensions;
import com.mp4parser.streaming.SampleExtension;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class SampleFlagsSampleExtension implements SampleExtension {
public static Map pool =
Collections.synchronizedMap(new HashMap());
private byte isLeading, sampleDependsOn, sampleIsDependedOn, sampleHasRedundancy, samplePaddingValue;
private boolean sampleIsNonSyncSample;
private int sampleDegradationPriority;
public static SampleFlagsSampleExtension create(
byte isLeading, byte sampleDependsOn, byte sampleIsDependedOn,
byte sampleHasRedundancy, byte samplePaddingValue, boolean sampleIsNonSyncSample, int sampleDegradationPriority) {
long key = isLeading + (sampleDependsOn << 2) + (sampleIsDependedOn << 4) + (sampleHasRedundancy << 6);
key += (samplePaddingValue<<8);
key += (sampleDegradationPriority<<11);
key += (sampleIsNonSyncSample?1:0)<<27;
SampleFlagsSampleExtension c = pool.get(key);
if (c == null) {
c = new SampleFlagsSampleExtension();
c.isLeading = isLeading;
c.sampleDependsOn = sampleDependsOn;
c.sampleIsDependedOn = sampleIsDependedOn;
c.sampleHasRedundancy = sampleHasRedundancy;
c.samplePaddingValue = samplePaddingValue;
c.sampleIsNonSyncSample = sampleIsNonSyncSample;
c.sampleDegradationPriority = sampleDegradationPriority;
pool.put(key, c);
}
return c;
}
public byte getIsLeading() {
return isLeading;
}
public void setIsLeading(byte isLeading) {
this.isLeading = isLeading;
}
public byte getSampleDependsOn() {
return sampleDependsOn;
}
public void setSampleDependsOn(byte sampleDependsOn) {
this.sampleDependsOn = sampleDependsOn;
}
public byte getSampleIsDependedOn() {
return sampleIsDependedOn;
}
public void setSampleIsDependedOn(byte sampleIsDependedOn) {
this.sampleIsDependedOn = sampleIsDependedOn;
}
public byte getSampleHasRedundancy() {
return sampleHasRedundancy;
}
public void setSampleHasRedundancy(byte sampleHasRedundancy) {
this.sampleHasRedundancy = sampleHasRedundancy;
}
public byte getSamplePaddingValue() {
return samplePaddingValue;
}
public void setSamplePaddingValue(byte samplePaddingValue) {
this.samplePaddingValue = samplePaddingValue;
}
public boolean isSampleIsNonSyncSample() {
return sampleIsNonSyncSample;
}
public boolean isSyncSample() {
return !sampleIsNonSyncSample;
}
public void setSampleIsNonSyncSample(boolean sampleIsNonSyncSample) {
this.sampleIsNonSyncSample = sampleIsNonSyncSample;
}
public int getSampleDegradationPriority() {
return sampleDegradationPriority;
}
public void setSampleDegradationPriority(int sampleDegradationPriority) {
this.sampleDegradationPriority = sampleDegradationPriority;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy