= n) {
ret = (cache >> (bitsCached - n)) & maskBits(n);
} else {
- //old cache
+ // old cache
int c = cache & maskBits(bitsCached);
n -= bitsCached;
- //read next & combine
+ // read next & combine
ret = ((readCache(true) >> WORD_BITS - n) & maskBits(n)) | (c << n);
}
return ret;
@@ -223,6 +230,7 @@ public int peekBit() {
return ret;
}
+ @Override
public void skipBits(int n) {
LOGGER.log(Level.FINER, "@%d skipBits: %d", n);
@@ -248,6 +256,7 @@ public void skipBits(int n) {
}
}
+ @Override
public void skipBit() {
LOGGER.log(Level.FINER, "@%d skipBit: %d", 1);
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/CCE.java b/src/main/java/net/sourceforge/jaad/aac/syntax/CCE.java
index a605c8d..b5b8d71 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/CCE.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/CCE.java
@@ -20,11 +20,11 @@ protected Tag(int id) {
@Override
public int getId() {
- return super.getId()%16;
+ return super.getId() % 16;
}
public boolean isIsIndSW() {
- return id>=16;
+ return id >= 16;
}
@Override
@@ -98,6 +98,7 @@ int getCHSelect(int index) {
return chSelect[index];
}
+ @Override
public void decode(BitStream in) throws AACException {
couplingPoint = 2 * in.readBit();
coupledCount = in.readBits(3);
@@ -168,7 +169,7 @@ void applyIndependentCoupling(int index, float[] data) {
double g = gain[index][0];
float[] iqData = ics.getInvQuantData();
for (int i = 0; i < data.length; i++) {
- data[i] += g * iqData[i];
+ data[i] = (float) (data[i] + g * iqData[i]);
}
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/CPE.java b/src/main/java/net/sourceforge/jaad/aac/syntax/CPE.java
index 168e939..7450757 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/CPE.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/CPE.java
@@ -18,11 +18,11 @@
/**
* channel_pair_element: abbreviation CPE.
- *
+ *
* Syntactic element of the bitstream payload containing data for a pair of channels.
* A channel_pair_element consists of two individual_channel_streams and additional
* joint channel coding information. The two channels may share common side information.
- *
+ *
* The channel_pair_element has the same restrictions as the single channel element
* as far as element_instance_tag, and number of occurrences.
*/
@@ -70,18 +70,22 @@ public CPE(DecoderConfig config, ChannelTag tag) {
icsR = new ICStream(config);
}
+ @Override
public boolean isChannelPair() {
return true;
}
+ @Override
public boolean isStereo() {
return true;
}
+ @Override
protected SBR openSBR() {
return new SBR2(config);
}
+ @Override
public void decode(BitStream in) {
super.decode(in);
@@ -89,31 +93,29 @@ public void decode(BitStream in) {
ICSInfo infoL = icsL.getInfo();
ICSInfo infoR = icsR.getInfo();
- LOGGER.log(Level.FINE, ()->String.format("CPE %s", commonWindow? "common":""));
+ LOGGER.log(Level.FINER, () -> String.format("CPE %s", commonWindow ? "common" : ""));
if (commonWindow) {
infoL.decode(in, commonWindow);
infoR.setCommonData(in, infoL);
msMask = MSMask.forInt(in.readBits(2));
- if(msMask.equals(MSMask.TYPE_USED)) {
+ if (msMask.equals(MSMask.TYPE_USED)) {
int maxSFB = infoL.getMaxSFB();
int windowGroupCount = infoL.getWindowGroupCount();
- for(int idx = 0; idx cces, Consumer target) {
float[] dataL = getDataL();
@@ -175,7 +178,7 @@ public void process(FilterBank filterBank, List cces, Consumer tar
icsL.processTNS();
icsR.processTNS();
- //dependent coupling
+ // dependent coupling
processDependentCoupling(cces, CCE.AFTER_TNS, iqDataL, iqDataR);
// filterbank
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/ChannelElement.java b/src/main/java/net/sourceforge/jaad/aac/syntax/ChannelElement.java
index 86f2e72..acf1bcf 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/ChannelElement.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/ChannelElement.java
@@ -1,11 +1,12 @@
package net.sourceforge.jaad.aac.syntax;
+import java.util.List;
+import java.util.function.Consumer;
+
import net.sourceforge.jaad.aac.DecoderConfig;
import net.sourceforge.jaad.aac.filterbank.FilterBank;
import net.sourceforge.jaad.aac.sbr.SBR;
-import java.util.List;
-import java.util.function.Consumer;
/**
* Created by IntelliJ IDEA.
@@ -15,143 +16,145 @@
*/
public abstract class ChannelElement implements Element {
- abstract static class ChannelTag extends InstanceTag {
+ abstract static class ChannelTag extends InstanceTag {
- protected ChannelTag(int id) {
- super(id);
- }
+ protected ChannelTag(int id) {
+ super(id);
+ }
- abstract public boolean isChannelPair();
+ abstract public boolean isChannelPair();
- @Override
- abstract public ChannelElement newElement(DecoderConfig config);
- }
+ @Override
+ abstract public ChannelElement newElement(DecoderConfig config);
+ }
- protected final DecoderConfig config;
+ protected final DecoderConfig config;
- protected final ChannelTag tag;
+ protected final ChannelTag tag;
- protected ChannelElement(DecoderConfig config, ChannelTag tag) {
- this.config = config;
- this.tag = tag;
- }
+ protected ChannelElement(DecoderConfig config, ChannelTag tag) {
+ this.config = config;
+ this.tag = tag;
+ }
- public ChannelTag getElementInstanceTag() {
- return tag;
- }
+ @Override
+ public ChannelTag getElementInstanceTag() {
+ return tag;
+ }
- /**
- * @return if this element represents a channel pair.
- */
- abstract public boolean isChannelPair();
+ /**
+ * @return if this element represents a channel pair.
+ */
+ abstract public boolean isChannelPair();
- /**
- * A single channel may produce stereo using parametric stereo.
- * @return if this stereo.
- */
- abstract public boolean isStereo();
+ /**
+ * A single channel may produce stereo using parametric stereo.
+ *
+ * @return if this stereo.
+ */
+ abstract public boolean isStereo();
- protected SBR sbr;
+ protected SBR sbr;
- public void decode(BitStream in) {
- if(sbr!=null)
- sbr.invalidate();
- }
+ @Override
+ public void decode(BitStream in) {
+ if (sbr != null)
+ sbr.invalidate();
+ }
- abstract protected SBR openSBR();
+ abstract protected SBR openSBR();
- void decodeSBR(BitStream in, boolean crc) {
+ void decodeSBR(BitStream in, boolean crc) {
- if(!config.isSBREnabled()) {
- return;
- }
+ if (!config.isSBREnabled()) {
+ return;
+ }
- if(sbr==null)
- sbr = openSBR();
+ if (sbr == null)
+ sbr = openSBR();
- if(sbr!=null)
- sbr.decode(in, crc);
- }
+ if (sbr != null)
+ sbr.decode(in, crc);
+ }
- boolean isSBRPresent() {
- return sbr!=null && sbr.isValid();
- }
+ boolean isSBRPresent() {
+ return sbr != null && sbr.isValid();
+ }
- SBR getSBR() {
- return sbr;
- }
+ SBR getSBR() {
+ return sbr;
+ }
private float[] dataL, dataR;
private float[] newData() {
- int len = config.getSampleLength();
- return new float[len];
- }
+ int len = config.getSampleLength();
+ return new float[len];
+ }
public float[] getDataL() {
- if(dataL==null)
- dataL = newData();
- return dataL;
- }
-
- public float[] getDataR() {
- if(dataR==null)
- dataR = newData();
- return dataR;
+ if (dataL == null)
+ dataL = newData();
+ return dataL;
}
- abstract public void process(FilterBank filterBank, List cces, Consumer target);
-
- void processDependentCoupling(List cces, int couplingPoint, float[] dataL, float[] dataR) {
-
- int elementID = getElementInstanceTag().getId();
-
- for (CCE cce : cces) {
- int index = 0;
- if(cce!=null&&cce.getCouplingPoint()==couplingPoint) {
- for(int c = 0; c<=cce.getCoupledCount(); c++) {
- int chSelect = cce.getCHSelect(c);
- if(cce.isChannelPair(c)==isChannelPair()&&cce.getIDSelect(c)==elementID) {
- if(chSelect!=1) {
- cce.applyDependentCoupling(index, dataL);
- if(chSelect!=0)
- index++;
- }
- if(chSelect!=2) {
- cce.applyDependentCoupling(index, dataR);
- index++;
- }
- }
- else
- index += 1+((chSelect==3) ? 1 : 0);
- }
- }
- }
- }
-
- void processIndependentCoupling(List cces, float[] dataL, float[] dataR) {
-
- int elementID = getElementInstanceTag().getId();
-
- for (CCE cce : cces) {
- int index = 0;
- if (cce != null && cce.getCouplingPoint() == CCE.AFTER_IMDCT) {
- for (int c = 0; c <= cce.getCoupledCount(); c++) {
- int chSelect = cce.getCHSelect(c);
- if (cce.isChannelPair(c) == isChannelPair() && cce.getIDSelect(c) == elementID) {
- if (chSelect != 1) {
- cce.applyIndependentCoupling(index, dataL);
- if (chSelect != 0)
- index++;
- }
- if (chSelect != 2) {
- cce.applyIndependentCoupling(index, dataR);
- index++;
- }
- } else
- index += 1 + ((chSelect == 3) ? 1 : 0);
- }
- }
- }
- }
+ public float[] getDataR() {
+ if (dataR == null)
+ dataR = newData();
+ return dataR;
+ }
+
+ abstract public void process(FilterBank filterBank, List cces, Consumer target);
+
+ void processDependentCoupling(List cces, int couplingPoint, float[] dataL, float[] dataR) {
+
+ int elementID = getElementInstanceTag().getId();
+
+ for (CCE cce : cces) {
+ int index = 0;
+ if (cce != null && cce.getCouplingPoint() == couplingPoint) {
+ for (int c = 0; c <= cce.getCoupledCount(); c++) {
+ int chSelect = cce.getCHSelect(c);
+ if (cce.isChannelPair(c) == isChannelPair() && cce.getIDSelect(c) == elementID) {
+ if (chSelect != 1) {
+ cce.applyDependentCoupling(index, dataL);
+ if (chSelect != 0)
+ index++;
+ }
+ if (chSelect != 2) {
+ cce.applyDependentCoupling(index, dataR);
+ index++;
+ }
+ } else
+ index += 1 + ((chSelect == 3) ? 1 : 0);
+ }
+ }
+ }
+ }
+
+ void processIndependentCoupling(List cces, float[] dataL, float[] dataR) {
+
+ int elementID = getElementInstanceTag().getId();
+
+ for (CCE cce : cces) {
+ int index = 0;
+ if (cce != null && cce.getCouplingPoint() == CCE.AFTER_IMDCT) {
+ for (int c = 0; c <= cce.getCoupledCount(); c++) {
+ int chSelect = cce.getCHSelect(c);
+ if (cce.isChannelPair(c) == isChannelPair() && cce.getIDSelect(c) == elementID) {
+ if (chSelect != 1) {
+ cce.applyIndependentCoupling(index, dataL);
+ if (chSelect != 0)
+ index++;
+ }
+ if (chSelect != 2) {
+ cce.applyIndependentCoupling(index, dataR);
+ index++;
+ }
+ } else
+ index += 1 + ((chSelect == 3) ? 1 : 0);
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/DSE.java b/src/main/java/net/sourceforge/jaad/aac/syntax/DSE.java
index 0989116..f5b3cea 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/DSE.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/DSE.java
@@ -7,7 +7,7 @@
/**
* data_stream_element Abbreviation DSE.
- *
+ *
* Syntactic element that contains data.
* Again, there are 16 element_instance_tags.
* There is, however, no restriction on the number
@@ -52,6 +52,7 @@ public DSE(DecoderConfig config, Tag tag) {
this.tag = tag;
}
+ @Override
public void decode(BitStream in) {
boolean byteAlign = in.readBool();
int count = in.readBits(8);
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java b/src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java
index 6957dd0..dc7289c 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java
@@ -15,7 +15,7 @@ public class ICSInfo implements ScaleFactorBands {
static final Logger LOGGER = Logger.getLogger(ICSInfo.class.getName());
- //maximum numbers
+ // maximum numbers
public static final int MAX_WINDOW_COUNT = 8;
public static final int MAX_WINDOW_GROUP_COUNT = MAX_WINDOW_COUNT;
@@ -60,11 +60,11 @@ public static WindowSequence forInt(int i) throws AACException {
private WindowSequence windowSequence;
private int[] windowShape;
private int maxSFB;
- //prediction
+ // prediction
private boolean predictionDataPresent;
private ICPrediction icPredict;
LTPrediction ltPredict;
- //windows/sfbs
+ // windows/sfbs
private int windowCount;
private int windowGroupCount;
private int[] windowGroupLength;
@@ -83,9 +83,9 @@ public ICSInfo(DecoderConfig config) {
this.ltPredict = new LTPrediction(frameLength);
}
- /* ========== decoding ========== */
+ /** decoding */
public void decode(BitStream in, boolean commonWindow) throws AACException {
- in.skipBit(); //reserved
+ in.skipBit(); // reserved
windowSequence = WindowSequence.forInt(in.readBits(2));
windowShape[PREVIOUS] = windowShape[CURRENT];
windowShape[CURRENT] = in.readBit();
@@ -137,7 +137,7 @@ private void readPredictionData(BitStream in, boolean commonWindow) throws AACEx
}
}
- /* =========== gets ============ */
+ // =========== gets ============
public int getMaxSFB() {
return maxSFB;
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/ICStream.java b/src/main/java/net/sourceforge/jaad/aac/syntax/ICStream.java
index b93d91a..91c9d7c 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/ICStream.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/ICStream.java
@@ -15,7 +15,7 @@
import net.sourceforge.jaad.aac.tools.TNS;
-//TODO: apply pulse data
+// TODO: apply pulse data
public class ICStream implements HCB, ScaleFactorTable, IQTable {
static final Logger LOGGER = Logger.getLogger(ICStream.class.getName());
@@ -57,7 +57,7 @@ public ICStream(DecoderConfig config) {
this.overlap = new float[frameLength];
}
- /* ========= decoding ========== */
+ /** decoding */
public void decode(BitStream in, boolean commonWindow, DecoderConfig conf) throws AACException {
if (conf.isScalefactorResilienceUsed() && rvlc == null) rvlc = new RVLC();
boolean er = conf.getProfile().isErrorResilientProfile();
@@ -68,7 +68,7 @@ public void decode(BitStream in, boolean commonWindow, DecoderConfig conf) throw
decodeSectionData(in, conf.isSectionDataResilienceUsed());
- //if(conf.isScalefactorResilienceUsed()) rvlc.decode(in, this, scaleFactors);
+ // if(conf.isScalefactorResilienceUsed()) rvlc.decode(in, this, scaleFactors);
/*else*/
decodeScaleFactors(in);
@@ -92,14 +92,14 @@ public void decode(BitStream in, boolean commonWindow, DecoderConfig conf) throw
gainControl.decode(in, info.getWindowSequence());
}
- //RVLC spectral data
- //if(conf.isScalefactorResilienceUsed()) rvlc.decodeScalefactors(this, in, scaleFactors);
+ // RVLC spectral data
+ // if(conf.isScalefactorResilienceUsed()) rvlc.decodeScalefactors(this, in, scaleFactors);
if (conf.isSpectralDataResilienceUsed()) {
int max = (conf.getChannelConfiguration() == ChannelConfiguration.STEREO) ? 6144 : 12288;
reorderedSpectralDataLen = Math.max(in.readBits(14), max);
longestCodewordLen = Math.max(in.readBits(6), 49);
- //HCR.decodeReorderedSpectralData(this, in, data, conf.isSectionDataResilienceUsed());
+ // HCR.decodeReorderedSpectralData(this, in, data, conf.isSectionDataResilienceUsed());
} else decodeSpectralData(in);
}
@@ -141,7 +141,7 @@ private void decodePulseData(BitStream in) throws AACException {
throw new AACException("pulse SWB out of range: " + pulseStartSWB + " > " + info.getSWBCount());
if (pulseOffset == null || pulseCount != pulseOffset.length) {
- //only reallocate if needed
+ // only reallocate if needed
pulseOffset = new int[pulseCount];
pulseAmp = new int[pulseCount];
}
@@ -159,7 +159,7 @@ private void decodePulseData(BitStream in) throws AACException {
public void decodeScaleFactors(BitStream in) throws AACException {
int windowGroups = info.getWindowGroupCount();
int maxSFB = info.getMaxSFB();
- //0: spectrum, 1: noise, 2: intensity
+ // 0: spectrum, 1: noise, 2: intensity
int[] offset = {globalGain, globalGain - 90, 0};
int tmp;
@@ -224,7 +224,7 @@ private void decodeSpectralData(BitStream in) throws AACException {
Arrays.fill(iqData, off, off + width, 0);
}
} else if (hcb == NOISE_HCB) {
- //apply PNS: fill with random values
+ // apply PNS: fill with random values
for (int w = 0; w < groupLen; w++, off += 128) {
float energy = 0;
@@ -245,7 +245,7 @@ private void decodeSpectralData(BitStream in) throws AACException {
for (int k = 0; k < width; k += num) {
Huffman.decodeSpectralData(in, hcb, buf, 0);
- //inverse quantization & scaling
+ // inverse quantization & scaling
for (int j = 0; j < num; j++) {
iqData[off + k + j] = (buf[j] > 0) ? IQ_TABLE[buf[j]] : -IQ_TABLE[-buf[j]];
iqData[off + k + j] *= scaleFactors[idx];
@@ -258,7 +258,7 @@ private void decodeSpectralData(BitStream in) throws AACException {
}
}
- /* =========== gets ============ */
+ // =========== gets ============
/**
* Does inverse quantization and applies the scale factors on the decoded
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/IQTable.java b/src/main/java/net/sourceforge/jaad/aac/syntax/IQTable.java
index cd956d6..46a6a98 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/IQTable.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/IQTable.java
@@ -6,7 +6,7 @@
*
* @author in-somnia
*/
-//TODO: list is too big, create at startup
+// TODO: list is too big, create at startup
interface IQTable {
float[] IQ_TABLE = {
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/LFE.java b/src/main/java/net/sourceforge/jaad/aac/syntax/LFE.java
index 4dfca28..c6a1b62 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/LFE.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/LFE.java
@@ -1,14 +1,14 @@
package net.sourceforge.jaad.aac.syntax;
+import java.util.List;
+
import net.sourceforge.jaad.aac.DecoderConfig;
import net.sourceforge.jaad.aac.sbr.SBR;
-import java.util.List;
-
/**
* lfe_channel_element: Abbreviation LFE.
- *
+ *
* Syntactic element that contains a low sampling frequency enhancement channel.
* The rules for the number of lfe_channel_element()’s and instance tags are
* as for single_channel_element’s.
@@ -16,46 +16,47 @@
class LFE extends SCE {
- public static final Type TYPE = Type.LFE;
+ public static final Type TYPE = Type.LFE;
- static class Tag extends SCE.Tag {
+ static class Tag extends SCE.Tag {
- protected Tag(int id) {
- super(id);
- }
+ protected Tag(int id) {
+ super(id);
+ }
- @Override
- public boolean isChannelPair() {
- return false;
- }
+ @Override
+ public boolean isChannelPair() {
+ return false;
+ }
- @Override
- public Type getType() {
- return TYPE;
- }
+ @Override
+ public Type getType() {
+ return TYPE;
+ }
- @Override
- public ChannelElement newElement(DecoderConfig config) {
- return new LFE(config, this);
- }
- }
+ @Override
+ public ChannelElement newElement(DecoderConfig config) {
+ return new LFE(config, this);
+ }
+ }
- public static final List TAGS = Element.createTagList(16, Tag::new);
+ public static final List TAGS = Element.createTagList(16, Tag::new);
- LFE(DecoderConfig config, Tag tag) {
- super(config, tag);
- }
+ LFE(DecoderConfig config, Tag tag) {
+ super(config, tag);
+ }
- protected SBR openSBR() {
- return null;
- }
+ @Override
+ protected SBR openSBR() {
+ return null;
+ }
- @Override
- public boolean isChannelPair() {
- return false;
- }
+ @Override
+ public boolean isChannelPair() {
+ return false;
+ }
- public boolean isLFE() {
- return true;
- }
+ public boolean isLFE() {
+ return true;
+ }
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/PCE.java b/src/main/java/net/sourceforge/jaad/aac/syntax/PCE.java
index 00f3468..49e2288 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/PCE.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/PCE.java
@@ -127,6 +127,7 @@ public PCE(Tag tag) {
sampleFrequency = SampleFrequency.SF_NONE;
}
+ @Override
public void decode(BitStream in) throws AACException {
profile = Profile.forInt(in.readBits(2));
@@ -187,10 +188,12 @@ private void readTaggedElementArray(TaggedElement[] te, BitStream in, int len) t
}
}
+ @Override
public Profile getProfile() {
return profile;
}
+ @Override
public SampleFrequency getSampleFrequency() {
return sampleFrequency;
}
@@ -216,6 +219,7 @@ public int getChannelCount() {
*
* @return a matching ChannelConfiguration according its channel count.
*/
+ @Override
public ChannelConfiguration getChannelConfiguration() {
return ChannelConfiguration.forChannelCount(getChannelCount());
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/SCE.java b/src/main/java/net/sourceforge/jaad/aac/syntax/SCE.java
index b381062..c87a334 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/SCE.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/SCE.java
@@ -12,7 +12,7 @@
/**
- * single_channel_element: abbreviaton SCE.
+ * single_channel_element: abbreviation SCE.
*
* Syntactic element of the bitstream containing coded
* data for a single audio channel. A single_channel_element basically
@@ -58,10 +58,12 @@ public ChannelElement newElement(DecoderConfig config) {
ics = new ICStream(config);
}
+ @Override
protected SBR openSBR() {
return new SBR1(config);
}
+ @Override
public void decode(BitStream in) {
super.decode(in);
ics.decode(in, false, config);
@@ -79,13 +81,14 @@ public boolean isChannelPair() {
@Override
public boolean isStereo() {
if (sbr != null && config.isSBREnabled()) {
- //if(sbr.isPSUsed())
+ // if(sbr.isPSUsed())
return true;
}
return false;
}
+ @Override
public void process(FilterBank filterBank, List cces, Consumer target) {
// inverse quantization
diff --git a/src/main/java/net/sourceforge/jaad/aac/syntax/SyntacticElements.java b/src/main/java/net/sourceforge/jaad/aac/syntax/SyntacticElements.java
index 6c17f6f..2a1e6ef 100644
--- a/src/main/java/net/sourceforge/jaad/aac/syntax/SyntacticElements.java
+++ b/src/main/java/net/sourceforge/jaad/aac/syntax/SyntacticElements.java
@@ -15,19 +15,19 @@ public class SyntacticElements {
static final Logger LOGGER = Logger.getLogger(SyntacticElements.class.getName());
- //global properties
+ // global properties
private DecoderConfig config;
private final FilterBank filterBank;
- //elements
+ // elements
private List cces = new ArrayList<>();
private final Map elements = new HashMap<>();
- private final List audioElements = new ArrayList<>(); //SCE, LFE and CPE
+ private final List audioElements = new ArrayList<>(); // SCE, LFE and CPE
private List channels = new ArrayList<>();
@@ -55,7 +55,7 @@ public final void startNewFrame() {
public void decode(BitStream in) {
if (!config.getProfile().isErrorResilientProfile()) {
-loop:
+ loop:
do {
switch (Element.readType(in)) {
case SCE:
@@ -84,7 +84,7 @@ public void decode(BitStream in) {
}
} while (true);
} else {
- //error resilient raw data block
+ // error resilient raw data block
switch (config.getChannelConfiguration()) {
case MONO:
decode(SCE.TAGS, in);
diff --git a/src/main/java/net/sourceforge/jaad/aac/tools/ICPrediction.java b/src/main/java/net/sourceforge/jaad/aac/tools/ICPrediction.java
index 1da6d17..b2c63ae 100644
--- a/src/main/java/net/sourceforge/jaad/aac/tools/ICPrediction.java
+++ b/src/main/java/net/sourceforge/jaad/aac/tools/ICPrediction.java
@@ -21,8 +21,8 @@ public class ICPrediction {
private static final float SF_SCALE = 1.0f / -1024.0f;
private static final float INV_SF_SCALE = 1.0f / SF_SCALE;
private static final int MAX_PREDICTORS = 672;
- private static final float A = 0.953125f; //61.0 / 64
- private static final float ALPHA = 0.90625f; //29.0 / 32
+ private static final float A = 0.953125f; // 61.0 / 64
+ private static final float ALPHA = 0.90625f; // 29.0 / 32
private boolean predictorReset;
private int predictorResetGroup;
private boolean[] predictionUsed;
diff --git a/src/main/java/net/sourceforge/jaad/aac/tools/TNS.java b/src/main/java/net/sourceforge/jaad/aac/tools/TNS.java
index eb224b9..d83f7b2 100644
--- a/src/main/java/net/sourceforge/jaad/aac/tools/TNS.java
+++ b/src/main/java/net/sourceforge/jaad/aac/tools/TNS.java
@@ -16,7 +16,7 @@ public class TNS implements TNSTables {
private static final int TNS_MAX_ORDER = 20;
private static final int[] SHORT_BITS = {1, 4, 3}, LONG_BITS = {2, 6, 5};
- //bitstream
+ // bitstream
private int[] nFilt;
private int[][] length, order;
private boolean[][] direction;
@@ -60,6 +60,6 @@ else if (order[w][filt] != 0) {
}
public void process(ICStream ics, float[] spec, SampleFrequency sf, boolean decode) {
- //TODO...
+ // TODO...
}
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/tools/Utils.java b/src/main/java/net/sourceforge/jaad/aac/tools/Utils.java
index f861fb5..6371c5a 100644
--- a/src/main/java/net/sourceforge/jaad/aac/tools/Utils.java
+++ b/src/main/java/net/sourceforge/jaad/aac/tools/Utils.java
@@ -1,6 +1,11 @@
package net.sourceforge.jaad.aac.tools;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
/**
* Created by IntelliJ IDEA.
@@ -13,15 +18,15 @@ public interface Utils {
boolean isDebug = Boolean.parseBoolean(System.getProperty("net.sourceforge.jaad.debug", "false").toLowerCase(Locale.ROOT));
static boolean[] copyOf(boolean[] array) {
- return array==null ? null : java.util.Arrays.copyOf(array, array.length);
+ return array == null ? null : java.util.Arrays.copyOf(array, array.length);
}
static int[] copyOf(int[] array) {
- return array==null ? null : java.util.Arrays.copyOf(array, array.length);
+ return array == null ? null : java.util.Arrays.copyOf(array, array.length);
}
static float[] copyOf(float[] array) {
- return array==null ? null : java.util.Arrays.copyOf(array, array.length);
+ return array == null ? null : java.util.Arrays.copyOf(array, array.length);
}
static void copyRange(int[] array, int srcPos, int destPos, int length) {
@@ -35,13 +40,13 @@ static int clip(int idx, int min, int max) {
}
@SafeVarargs
- static List listOf(E... elements) {
+ static List listOf(E... elements) {
if (elements.length == 0) return Collections.emptyList();
else return Collections.unmodifiableList(Arrays.asList(elements));
}
@SuppressWarnings("unchecked")
- static List listCopyOf(Collection extends E> coll) {
+ static List listCopyOf(Collection extends E> coll) {
if (coll == Collections.emptyList()) return (List) coll;
else return (List) listOf(coll.toArray());
}
diff --git a/src/main/java/net/sourceforge/jaad/aac/transport/ADIFHeader.java b/src/main/java/net/sourceforge/jaad/aac/transport/ADIFHeader.java
index f894d8f..3c518d9 100644
--- a/src/main/java/net/sourceforge/jaad/aac/transport/ADIFHeader.java
+++ b/src/main/java/net/sourceforge/jaad/aac/transport/ADIFHeader.java
@@ -6,7 +6,7 @@
public final class ADIFHeader {
- private static final long ADIF_ID = 0x41444946; //'ADIF'
+ private static final long ADIF_ID = 0x41444946; // 'ADIF'
private long id;
private boolean copyrightIDPresent;
private byte[] copyrightID;
@@ -31,7 +31,7 @@ public static ADIFHeader readHeader(BitStream in) {
}
private void decode(BitStream in) {
- id = in.readBits(32); //'ADIF'
+ id = in.readBits(32); // 'ADIF'
copyrightIDPresent = in.readBool();
if (copyrightIDPresent) {
for (int i = 0; i < 9; i++) {
diff --git a/src/main/java/net/sourceforge/jaad/adts/ADTSFrame.java b/src/main/java/net/sourceforge/jaad/adts/ADTSFrame.java
index c1364aa..d6bd2c8 100644
--- a/src/main/java/net/sourceforge/jaad/adts/ADTSFrame.java
+++ b/src/main/java/net/sourceforge/jaad/adts/ADTSFrame.java
@@ -28,10 +28,10 @@ class ADTSFrame implements AudioDecoderInfo {
if (!protectionAbsent) crcCheck = in.readUnsignedShort();
if (rawDataBlockCount == 0) {
- //raw_data_block();
+ // raw_data_block();
} else {
int i;
- //header error check
+ // header error check
if (!protectionAbsent) {
rawDataBlockPosition = new int[rawDataBlockCount];
for (i = 0; i < rawDataBlockCount; i++) {
@@ -39,38 +39,38 @@ class ADTSFrame implements AudioDecoderInfo {
}
crcCheck = in.readUnsignedShort();
}
- //raw data blocks
+ // raw data blocks
for (i = 0; i < rawDataBlockCount; i++) {
- //raw_data_block();
+ // raw_data_block();
if (!protectionAbsent) crcCheck = in.readUnsignedShort();
}
}
}
private void readHeader(DataInputStream in) throws IOException {
- //fixed header:
- //1 bit ID, 2 bits layer, 1 bit protection absent
+ // fixed header:
+ // 1 bit ID, 2 bits layer, 1 bit protection absent
int i = in.read();
id = ((i >> 3) & 0x1) == 1;
layer = (i >> 1) & 0x3;
protectionAbsent = (i & 0x1) == 1;
- //2 bits profile, 4 bits sample frequency, 1 bit private bit
+ // 2 bits profile, 4 bits sample frequency, 1 bit private bit
i = in.read();
profile = ((i >> 6) & 0x3) + 1;
sampleFrequency = (i >> 2) & 0xF;
privateBit = ((i >> 1) & 0x1) == 1;
- //3 bits channel configuration, 1 bit copy, 1 bit home
+ // 3 bits channel configuration, 1 bit copy, 1 bit home
i = (i << 8) | in.read();
channelConfiguration = ((i >> 6) & 0x7);
copy = ((i >> 5) & 0x1) == 1;
home = ((i >> 4) & 0x1) == 1;
- //int emphasis = in.readBits(2);
+ // int emphasis = in.readBits(2);
- //variable header:
- //1 bit copyrightIDBit, 1 bit copyrightIDStart, 13 bits frame length,
- //11 bits adtsBufferFullness, 2 bits rawDataBlockCount
+ // variable header:
+ // 1 bit copyrightIDBit, 1 bit copyrightIDStart, 13 bits frame length,
+ // 11 bits adtsBufferFullness, 2 bits rawDataBlockCount
copyrightIDBit = ((i >> 3) & 0x1) == 1;
copyrightIDStart = ((i >> 2) & 0x1) == 1;
i = (i << 16) | in.readUnsignedShort();
@@ -84,14 +84,17 @@ int getFrameLength() {
return frameLength - (protectionAbsent ? 7 : 9);
}
+ @Override
public Profile getProfile() {
return Profile.forInt(profile);
}
+ @Override
public SampleFrequency getSampleFrequency() {
return SampleFrequency.forInt(sampleFrequency);
}
+ @Override
public ChannelConfiguration getChannelConfiguration() {
return ChannelConfiguration.forInt(channelConfiguration);
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/MP4Container.java b/src/main/java/net/sourceforge/jaad/mp4/MP4Container.java
index 3b0e15b..b5290cf 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/MP4Container.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/MP4Container.java
@@ -60,7 +60,7 @@ public MP4Container(MP4Input in) throws IOException {
}
private void readContent() throws IOException {
- //read all boxes
+ // read all boxes
Box box = null;
long type;
boolean moovFound = false;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/MP4Input.java b/src/main/java/net/sourceforge/jaad/mp4/MP4Input.java
index b2c892b..f27bce4 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/MP4Input.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/MP4Input.java
@@ -4,6 +4,7 @@
import java.io.InputStream;
import java.io.RandomAccessFile;
+
/**
* Created by IntelliJ IDEA.
* User: stueken
@@ -12,214 +13,215 @@
*/
public interface MP4Input extends AutoCloseable {
- static MP4Input open(InputStream in) {
- return new MP4InputStream(in);
- }
-
- static MP4Input open(RandomAccessFile in) {
- return new MP4RandomAccessStream(in);
- }
-
- String UTF8 = "UTF-8";
- String UTF16 = "UTF-16";
-
- /**
- * Reads the next byte of data from the input. The value byte is returned as
- * an int in the range 0 to 255. If no byte is available because the end of
- * the stream has been reached, an EOFException is thrown. This method
- * blocks until input data is available, the end of the stream is detected,
- * or an I/O error occurs.
- *
- * @return the next byte of data
- * @throws IOException If the end of the stream is detected or any I/O error occurs.
- */
- int readByte() throws IOException;
-
- /**
- * Reads len
bytes of data from the input into the array
- * b
. If len is zero, then no bytes are read.
- *
- * This method blocks until all bytes could be read, the end of the stream
- * is detected, or an I/O error occurs.
- *
- * If the stream ends before len
bytes could be read an
- * EOFException is thrown.
- *
- * @param b the buffer into which the data is read.
- * @param off the start offset in array b
at which the data is written.
- * @param len the number of bytes to read.
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
- void readBytes(byte[] b, int off, int len) throws IOException;
-
- /**
- * Reads up to eight bytes as a long value. This method blocks until all
- * bytes could be read, the end of the stream is detected, or an I/O error
- * occurs.
- *
- * @param n the number of bytes to read >0 and <=8
- * @return the read bytes as a long value
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- * @throws IndexOutOfBoundsException if n
is not in the range
- * [1...8] inclusive.
- */
- long readBytes(int n) throws IOException;
-
- /**
- * Reads data from the input stream and stores them into the buffer array b.
- * This method blocks until all bytes could be read, the end of the stream
- * is detected, or an I/O error occurs.
- * If the length of b is zero, then no bytes are read.
- *
- * @param b the buffer into which the data is read.
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
-
- void readBytes(byte[] b) throws IOException;
-
- /**
- * Reads n
bytes from the input as a String. The bytes are
- * directly converted into characters. If not enough bytes could be read, an
- * EOFException is thrown.
- * This method blocks until all bytes could be read, the end of the stream
- * is detected, or an I/O error occurs.
- *
- * @param n the length of the String.
- * @return the String, that was read
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
- String readString(int n) throws IOException;
-
- /**
- * Reads a null-terminated UTF-encoded String from the input. The maximum
- * number of bytes that can be read before the null must appear must be
- * specified.
- * Although the method is preferred for unicode, the encoding can be any
- * charset name, that is supported by the system.
- *
- * This method blocks until all bytes could be read, the end of the stream
- * is detected, or an I/O error occurs.
- *
- * @param max the maximum number of bytes to read, before the null-terminator
- * must appear.
- * @param encoding the charset used to encode the String
- * @return the decoded String
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
- String readUTFString(int max, String encoding) throws IOException;
-
- /**
- * Reads a null-terminated UTF-encoded String from the input. The maximum
- * number of bytes that can be read before the null must appear must be
- * specified.
- * The encoding is detected automatically, it may be UTF-8 or UTF-16
- * (determined by a byte order mask at the beginning).
- *
- * This method blocks until all bytes could be read, the end of the stream
- * is detected, or an I/O error occurs.
- *
- * @param max the maximum number of bytes to read, before the null-terminator
- * must appear.
- * @return the decoded String
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
- String readUTFString(int max) throws IOException;
-
- /**
- * Reads a byte array from the input that is terminated by a specific byte
- * (the 'terminator'). The maximum number of bytes that can be read before
- * the terminator must appear must be specified.
- *
- * The terminator will not be included in the returned array.
- *
- * This method blocks until all bytes could be read, the end of the stream
- * is detected, or an I/O error occurs.
- *
- * @param max the maximum number of bytes to read, before the terminator
- * must appear.
- * @param terminator the byte that indicates the end of the array
- * @return the buffer into which the data is read.
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
- byte[] readTerminated(int max, int terminator) throws IOException;
-
- /**
- * Reads a fixed point number from the input. The number is read as a
- * m.n
value, that results from deviding an integer by
- * 2n.
- *
- * @param m the number of bits before the point
- * @param n the number of bits after the point
- * @return a floating point number with the same value
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- * @throws IllegalArgumentException if the total number of bits (m+n) is not
- * a multiple of eight
- */
- double readFixedPoint(int m, int n) throws IOException;
-
- /**
- * Skips n
bytes in the input. This method blocks until all
- * bytes could be skipped, the end of the stream is detected, or an I/O
- * error occurs.
- *
- * @param n the number of bytes to skip
- * @throws IOException If the end of the stream is detected, the input
- * stream has been closed, or if some other I/O error occurs.
- */
- void skipBytes(long n) throws IOException;
-
- /**
- * Returns the current offset in the stream.
- *
- * @return the current offset
- * @throws IOException if an I/O error occurs (only when using a RandomAccessFile)
- */
- long getOffset() throws IOException;
-
- /**
- * Seeks to a specific offset in the stream. This is only possible when
- * using a RandomAccessFile. If an InputStream is used, this method throws
- * an IOException.
- *
- * @param pos the offset position, measured in bytes from the beginning of the
- * stream
- * @throws IOException if an InputStream is used, pos is less than 0 or an
- * I/O error occurs
- */
- void seek(long pos) throws IOException;
-
- /**
- * Indicates, if random access is available. That is, if this
- * MP4InputStream
was constructed with a RandomAccessFile. If
- * this method returns false, seeking is not possible.
- *
- * @return true if random access is available
- */
- boolean hasRandomAccess();
-
- /**
- * Indicates, if the input has some data left.
- *
- * @return true if there is at least one byte left
- * @throws IOException if an I/O error occurs
- */
- boolean hasLeft() throws IOException;
-
-
- /**
- * Closes the input and releases any system resources associated with it.
- * Once the stream has been closed, further reading or skipping will throw
- * an IOException. Closing a previously closed stream has no effect.
- *
- * @throws IOException if an I/O error occurs
- */
- void close() throws IOException;
+ static MP4Input open(InputStream in) {
+ return new MP4InputStream(in);
+ }
+
+ static MP4Input open(RandomAccessFile in) {
+ return new MP4RandomAccessStream(in);
+ }
+
+ String UTF8 = "UTF-8";
+ String UTF16 = "UTF-16";
+
+ /**
+ * Reads the next byte of data from the input. The value byte is returned as
+ * an int in the range 0 to 255. If no byte is available because the end of
+ * the stream has been reached, an EOFException is thrown. This method
+ * blocks until input data is available, the end of the stream is detected,
+ * or an I/O error occurs.
+ *
+ * @return the next byte of data
+ * @throws IOException If the end of the stream is detected or any I/O error occurs.
+ */
+ int readByte() throws IOException;
+
+ /**
+ * Reads len
bytes of data from the input into the array
+ * b
. If len is zero, then no bytes are read.
+ *
+ * This method blocks until all bytes could be read, the end of the stream
+ * is detected, or an I/O error occurs.
+ *
+ * If the stream ends before len
bytes could be read an
+ * EOFException is thrown.
+ *
+ * @param b the buffer into which the data is read.
+ * @param off the start offset in array b
at which the data is written.
+ * @param len the number of bytes to read.
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ void readBytes(byte[] b, int off, int len) throws IOException;
+
+ /**
+ * Reads up to eight bytes as a long value. This method blocks until all
+ * bytes could be read, the end of the stream is detected, or an I/O error
+ * occurs.
+ *
+ * @param n the number of bytes to read >0 and <=8
+ * @return the read bytes as a long value
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ * @throws IndexOutOfBoundsException if n
is not in the range
+ * [1...8] inclusive.
+ */
+ long readBytes(int n) throws IOException;
+
+ /**
+ * Reads data from the input stream and stores them into the buffer array b.
+ * This method blocks until all bytes could be read, the end of the stream
+ * is detected, or an I/O error occurs.
+ * If the length of b is zero, then no bytes are read.
+ *
+ * @param b the buffer into which the data is read.
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+
+ void readBytes(byte[] b) throws IOException;
+
+ /**
+ * Reads n
bytes from the input as a String. The bytes are
+ * directly converted into characters. If not enough bytes could be read, an
+ * EOFException is thrown.
+ * This method blocks until all bytes could be read, the end of the stream
+ * is detected, or an I/O error occurs.
+ *
+ * @param n the length of the String.
+ * @return the String, that was read
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ String readString(int n) throws IOException;
+
+ /**
+ * Reads a null-terminated UTF-encoded String from the input. The maximum
+ * number of bytes that can be read before the null must appear must be
+ * specified.
+ * Although the method is preferred for unicode, the encoding can be any
+ * charset name, that is supported by the system.
+ *
+ * This method blocks until all bytes could be read, the end of the stream
+ * is detected, or an I/O error occurs.
+ *
+ * @param max the maximum number of bytes to read, before the null-terminator
+ * must appear.
+ * @param encoding the charset used to encode the String
+ * @return the decoded String
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ String readUTFString(int max, String encoding) throws IOException;
+
+ /**
+ * Reads a null-terminated UTF-encoded String from the input. The maximum
+ * number of bytes that can be read before the null must appear must be
+ * specified.
+ * The encoding is detected automatically, it may be UTF-8 or UTF-16
+ * (determined by a byte order mask at the beginning).
+ *
+ * This method blocks until all bytes could be read, the end of the stream
+ * is detected, or an I/O error occurs.
+ *
+ * @param max the maximum number of bytes to read, before the null-terminator
+ * must appear.
+ * @return the decoded String
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ String readUTFString(int max) throws IOException;
+
+ /**
+ * Reads a byte array from the input that is terminated by a specific byte
+ * (the 'terminator'). The maximum number of bytes that can be read before
+ * the terminator must appear must be specified.
+ *
+ * The terminator will not be included in the returned array.
+ *
+ * This method blocks until all bytes could be read, the end of the stream
+ * is detected, or an I/O error occurs.
+ *
+ * @param max the maximum number of bytes to read, before the terminator
+ * must appear.
+ * @param terminator the byte that indicates the end of the array
+ * @return the buffer into which the data is read.
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ byte[] readTerminated(int max, int terminator) throws IOException;
+
+ /**
+ * Reads a fixed point number from the input. The number is read as a
+ * m.n
value, that results from dividing an integer by
+ * 2n.
+ *
+ * @param m the number of bits before the point
+ * @param n the number of bits after the point
+ * @return a floating point number with the same value
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ * @throws IllegalArgumentException if the total number of bits (m+n) is not
+ * a multiple of eight
+ */
+ double readFixedPoint(int m, int n) throws IOException;
+
+ /**
+ * Skips n
bytes in the input. This method blocks until all
+ * bytes could be skipped, the end of the stream is detected, or an I/O
+ * error occurs.
+ *
+ * @param n the number of bytes to skip
+ * @throws IOException If the end of the stream is detected, the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ void skipBytes(long n) throws IOException;
+
+ /**
+ * Returns the current offset in the stream.
+ *
+ * @return the current offset
+ * @throws IOException if an I/O error occurs (only when using a RandomAccessFile)
+ */
+ long getOffset() throws IOException;
+
+ /**
+ * Seeks to a specific offset in the stream. This is only possible when
+ * using a RandomAccessFile. If an InputStream is used, this method throws
+ * an IOException.
+ *
+ * @param pos the offset position, measured in bytes from the beginning of the
+ * stream
+ * @throws IOException if an InputStream is used, pos is less than 0 or an
+ * I/O error occurs
+ */
+ void seek(long pos) throws IOException;
+
+ /**
+ * Indicates, if random access is available. That is, if this
+ * MP4InputStream
was constructed with a RandomAccessFile. If
+ * this method returns false, seeking is not possible.
+ *
+ * @return true if random access is available
+ */
+ boolean hasRandomAccess();
+
+ /**
+ * Indicates, if the input has some data left.
+ *
+ * @return true if there is at least one byte left
+ * @throws IOException if an I/O error occurs
+ */
+ boolean hasLeft() throws IOException;
+
+
+ /**
+ * Closes the input and releases any system resources associated with it.
+ * Once the stream has been closed, further reading or skipping will throw
+ * an IOException. Closing a previously closed stream has no effect.
+ *
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ void close() throws IOException;
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/MP4InputReader.java b/src/main/java/net/sourceforge/jaad/mp4/MP4InputReader.java
index e71fbed..e62a9f6 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/MP4InputReader.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/MP4InputReader.java
@@ -5,6 +5,7 @@
import java.nio.charset.Charset;
import java.util.Arrays;
+
/**
* Created by IntelliJ IDEA.
* User: stueken
@@ -13,125 +14,127 @@
*/
abstract public class MP4InputReader implements MP4Input {
- private static final int BYTE_ORDER_MASK = 0xFEFF;
-
- // to be implemented
- abstract protected int read() throws IOException;
- abstract protected int read(byte[] b, int off, int len) throws IOException;
- abstract protected long skip(int n) throws IOException;
-
- @Override
- public int readByte() throws IOException {
- int i = read();
-
- if(i==-1){
- throw new EOFException();
- }
-
- return i;
- }
-
- @Override
- public void readBytes(byte[] b, int off, int len) throws IOException {
- int read = 0;
-
- while(read8)
- throw new IndexOutOfBoundsException("invalid number of bytes to read: "+n);
-
- byte[] b = new byte[n];
- readBytes(b, 0, n);
-
- long result = 0;
- for(int i = 0; i 8)
+ throw new IndexOutOfBoundsException("invalid number of bytes to read: " + n);
+
+ byte[] b = new byte[n];
+ readBytes(b, 0, n);
+
+ long result = 0;
+ for (int i = 0; i < n; i++) {
+ result = (result << 8) | (b[i] & 0xFF);
+ }
+ return result;
+ }
+
+ @Override
+ public void readBytes(byte[] b) throws IOException {
+ readBytes(b, 0, b.length);
+ }
+
+ @Override
+ public String readString(int n) throws IOException {
+ int i = -1;
+ int pos = 0;
+ char[] c = new char[n];
+ while (pos < n) {
+ i = readByte();
+ c[pos] = (char) i;
+ pos++;
+ }
+ return new String(c, 0, pos);
+ }
+
+ @Override
+ public String readUTFString(int max, String encoding) throws IOException {
+ return new String(readTerminated(max, 0), Charset.forName(encoding));
+ }
+
+ @Override
+ public String readUTFString(int max) throws IOException {
+ // read byte order mask
+ byte[] bom = new byte[2];
+ readBytes(bom, 0, 2);
+ if (bom[0] == 0 || bom[1] == 0)
+ return "";
+ int i = (bom[0] << 8) | bom[1];
+
+ // read null-terminated
+ byte[] b = readTerminated(max - 2, 0);
+ // copy bom
+ byte[] b2 = new byte[b.length + bom.length];
+ System.arraycopy(bom, 0, b2, 0, bom.length);
+ System.arraycopy(b, 0, b2, bom.length, b.length);
+
+ return new String(b2, Charset.forName((i == BYTE_ORDER_MASK) ? UTF16 : UTF8));
+ }
+
+ @Override
+ public byte[] readTerminated(int max, int terminator) throws IOException {
+ byte[] b = new byte[max];
+ int pos = 0;
+ int i = 0;
+ while (pos < max && i != -1) {
+ i = readByte();
+ if (i != -1)
+ b[pos++] = (byte) i;
+ }
+ return Arrays.copyOf(b, pos);
+ }
+
+ @Override
+ public double readFixedPoint(int m, int n) throws IOException {
+ int bits = m + n;
+ if ((bits % 8) != 0)
+ throw new IllegalArgumentException("number of bits is not a multiple of 8: " + (m + n));
+
+ long l = readBytes(bits / 8);
+ double x = Math.pow(2, n);
+ double d = ((double) l) / x;
+ return d;
+ }
+
+ @Override
+ public void skipBytes(long n) throws IOException {
+ long l = 0;
+
+ while (l < n) {
+ l += skip((int) (n - l));
+ }
+ }
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/MP4RandomAccessStream.java b/src/main/java/net/sourceforge/jaad/mp4/MP4RandomAccessStream.java
index 07e282b..432eeaa 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/MP4RandomAccessStream.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/MP4RandomAccessStream.java
@@ -3,59 +3,61 @@
import java.io.IOException;
import java.io.RandomAccessFile;
+
public class MP4RandomAccessStream extends MP4InputReader {
- private final RandomAccessFile fin;
-
- /**
- * Constructs an MP4InputStream
that reads from a
- * RandomAccessFile
. It will have random access and seeking
- * will be possible.
- *
- * @param fin a RandomAccessFile
to read from
- */
- MP4RandomAccessStream(RandomAccessFile fin) {
- this.fin = fin;
- }
-
- @Override
- protected int read() throws IOException {
- return fin.read();
- }
-
-
- @Override
- protected int read(byte[] b, int off, int len) throws IOException {
- return fin.read(b, off, len);
- }
-
- @Override
- protected long skip(int n) throws IOException {
- return fin.skipBytes(n);
- }
-
- @Override
- public long getOffset() throws IOException {
- return fin.getFilePointer();
- }
-
- @Override
- public void seek(long pos) throws IOException {
- fin.seek(pos);
- }
-
- @Override
- public boolean hasRandomAccess() {
- return true;
- }
-
-
- @Override
- public boolean hasLeft() throws IOException {
- return fin.getFilePointer()<(fin.length()-1);
- }
-
- public void close() throws IOException {
- fin.close();
- }
+ private final RandomAccessFile fin;
+
+ /**
+ * Constructs an MP4InputStream
that reads from a
+ * RandomAccessFile
. It will have random access and seeking
+ * will be possible.
+ *
+ * @param fin a RandomAccessFile
to read from
+ */
+ MP4RandomAccessStream(RandomAccessFile fin) {
+ this.fin = fin;
+ }
+
+ @Override
+ protected int read() throws IOException {
+ return fin.read();
+ }
+
+
+ @Override
+ protected int read(byte[] b, int off, int len) throws IOException {
+ return fin.read(b, off, len);
+ }
+
+ @Override
+ protected long skip(int n) throws IOException {
+ return fin.skipBytes(n);
+ }
+
+ @Override
+ public long getOffset() throws IOException {
+ return fin.getFilePointer();
+ }
+
+ @Override
+ public void seek(long pos) throws IOException {
+ fin.seek(pos);
+ }
+
+ @Override
+ public boolean hasRandomAccess() {
+ return true;
+ }
+
+
+ @Override
+ public boolean hasLeft() throws IOException {
+ return fin.getFilePointer() < (fin.length() - 1);
+ }
+
+ @Override
+ public void close() throws IOException {
+ fin.close();
+ }
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/AudioTrack.java b/src/main/java/net/sourceforge/jaad/mp4/api/AudioTrack.java
index f1c2307..d742efc 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/AudioTrack.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/AudioTrack.java
@@ -52,7 +52,7 @@ public AudioTrack(Box trak, MP4Input in) {
Box stbl = minf.getChild(BoxTypes.SAMPLE_TABLE_BOX);
- //sample descriptions: 'mp4a' and 'enca' have an ESDBox, all others have a CodecSpecificBox
+ // sample descriptions: 'mp4a' and 'enca' have an ESDBox, all others have a CodecSpecificBox
SampleDescriptionBox stsd = (SampleDescriptionBox) stbl.getChild(BoxTypes.SAMPLE_DESCRIPTION_BOX);
if (stsd.getChildren().get(0) instanceof AudioSampleEntry) {
sampleEntry = (AudioSampleEntry) stsd.getChildren().get(0);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/Brand.java b/src/main/java/net/sourceforge/jaad/mp4/api/Brand.java
index 767c20e..f83b969 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/Brand.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/Brand.java
@@ -1,14 +1,13 @@
package net.sourceforge.jaad.mp4.api;
/**
- * @see "https://www.ftyps.com"
- *
* @author in-somnia
+ * @see "https:// www.ftyps.com"
*/
public enum Brand {
UNKNOWN_BRAND("\0\0\0\0", "unknown brand"),
- //iso
+ // iso
ISO_BASE_MEDIA("isom", "ISO base media file format v1"),
ISO_BASE_MEDIA_2("iso2", "ISO base media file format v2"),
ISO_BASE_MEDIA_3("iso3", "ISO base media file format v3"),
@@ -44,7 +43,7 @@ public enum Brand {
MPEG_21("mp21", "MPEG-21"),
MPPI_PHOTO_PLAYER("MPPI", "MPPI Photo Player"),
JPSEARCH("jpsi", "JPSearch data interchange format"),
- //3gpp
+ // 3gpp
THREE_GPP_RELEASE_1("3gp1", "3GPP Release 1"),
THREE_GPP_RELEASE_2("3gp2", "3GPP Release 2"),
THREE_GPP_RELEASE_3("3gp3", "3GPP Release 3"),
@@ -72,13 +71,13 @@ public enum Brand {
THREE_GPP2_C("3g2c", "3GPP2 compliant with 3GPP2 C.S0050-B v1.0"),
THREE_GPP2_KDDI_3G_EZMOVIE("KDDI", "3GPP2 EZmovie for KDDI 3G cellphones"),
MPEG_4_MOBILE_PROFILE_("mmp4", "MPEG-4/3GPP Mobile Profile"),
- //others
+ // others
DIRAC("drc1", "Dirac wavelet compression encapsulated in ISO base media"),
DIGITAL_MEDIA_PROJECT("dmpf", "Digital Media Project"),
DVB_OVER_RTP("dvr1", "DVB over RTP"),
DVB_OVER_MPEG_2_TRANSPORT_STREAM("dvt1", "DVB over MPEG-2 Transport Stream"),
SD_MEMORY_CARD_VIDEO("sdv ", "SD Memory Card Video"),
- //producers
+ // producers
ADOBE_FLASH_PLAYER_VIDEO("F4V ", "Video for Adobe Flash Player 9+"),
ADOBE_FLASH_PLAYER_PROTECTED_VIDEO("F4P ", "Protected Video for Adobe Flash Player 9+"),
ADOBE_FLASH_PLAYER_AUDIO("F4A ", "Audio for Adobe Flash Player 9+"),
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/DecoderInfo.java b/src/main/java/net/sourceforge/jaad/mp4/api/DecoderInfo.java
index 0afeec4..bdc8304 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/DecoderInfo.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/DecoderInfo.java
@@ -13,7 +13,7 @@
/**
- * The DecoderInfo
object contains the neccessary data to
+ * The DecoderInfo
object contains the necessary data to
* initialize a decoder. A track either contains a DecoderInfo
or a
* byte-Array called the 'DecoderSpecificInfo', which is e.g. used for AAC.
*
@@ -46,5 +46,6 @@ static DecoderInfo parse(CodecSpecificBox css) {
}
private static class UnknownDecoderInfo extends DecoderInfo {
+
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/Frame.java b/src/main/java/net/sourceforge/jaad/mp4/api/Frame.java
index 4c717aa..3ac3e48 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/Frame.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/Frame.java
@@ -30,9 +30,10 @@ public double getTime() {
return time;
}
+ @Override
public int compareTo(Frame f) {
double d = time - f.time;
- //0 should not happen, since frames don't have the same timestamps
+ // 0 should not happen, since frames don't have the same timestamps
return (d < 0) ? -1 : ((d > 0) ? 1 : 0);
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/ID3Frame.java b/src/main/java/net/sourceforge/jaad/mp4/api/ID3Frame.java
index 0f54146..261878d 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/ID3Frame.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/ID3Frame.java
@@ -11,89 +11,89 @@
class ID3Frame {
- static final int ALBUM_TITLE = 1413565506; //TALB
- static final int ALBUM_SORT_ORDER = 1414745921; //TSOA
- static final int ARTIST = 1414546737; //TPE1
- static final int ATTACHED_PICTURE = 1095780675; //APIC
- static final int AUDIO_ENCRYPTION = 1095061059; //AENC
- static final int AUDIO_SEEK_POINT_INDEX = 1095979081; //ASPI
- static final int BAND = 1414546738; //TPE2
- static final int BEATS_PER_MINUTE = 1413632077; //TBPM
- static final int COMMENTS = 1129270605; //COMM
- static final int COMMERCIAL_FRAME = 1129270610; //COMR
- static final int COMMERCIAL_INFORMATION = 1464029005; //WCOM
- static final int COMPOSER = 1413697357; //TCOM
- static final int CONDUCTOR = 1414546739; //TPE3
- static final int CONTENT_GROUP_DESCRIPTION = 1414091825; //TIT1
- static final int CONTENT_TYPE = 1413697358; //TCON
- static final int COPYRIGHT = 1464029008; //WCOP
- static final int COPYRIGHT_MESSAGE = 1413697360; //TCOP
- static final int ENCODED_BY = 1413828163; //TENC
- static final int ENCODING_TIME = 1413760334; //TDEN
- static final int ENCRYPTION_METHOD_REGISTRATION = 1162756946; //ENCR
- static final int EQUALISATION = 1162958130; //EQU2
- static final int EVENT_TIMING_CODES = 1163150159; //ETCO
- static final int FILE_OWNER = 1414485838; //TOWN
- static final int FILE_TYPE = 1413893204; //TFLT
- static final int GENERAL_ENCAPSULATED_OBJECT = 1195724610; //GEOB
- static final int GROUP_IDENTIFICATION_REGISTRATION = 1196575044; //GRID
- static final int INITIAL_KEY = 1414219097; //TKEY
- static final int INTERNET_RADIO_STATION_NAME = 1414681422; //TRSN
- static final int INTERNET_RADIO_STATION_OWNER = 1414681423; //TRSO
- static final int MODIFIED_BY = 1414546740; //TPE4
- static final int INVOLVED_PEOPLE_LIST = 1414090828; //TIPL
- static final int INTERNATIONAL_STANDARD_RECORDING_CODE = 1414746691; //TSRC
- static final int LANGUAGES = 1414283598; //TLAN
- static final int LENGTH = 1414284622; //TLEN
- static final int LINKED_INFORMATION = 1279872587; //LINK
- static final int LYRICIST = 1413830740; //TEXT
- static final int MEDIA_TYPE = 1414350148; //TMED
- static final int MOOD = 1414352719; //TMOO
- static final int MPEG_LOCATION_LOOKUP_TABLE = 1296845908; //MLLT
- static final int MUSICIAN_CREDITS_LIST = 1414349644; //TMCL
- static final int MUSIC_CD_IDENTIFIER = 1296254025; //MCDI
- static final int OFFICIAL_ARTIST_WEBPAGE = 1464811858; //WOAR
- static final int OFFICIAL_AUDIO_FILE_WEBPAGE = 1464811846; //WOAF
- static final int OFFICIAL_AUDIO_SOURCE_WEBPAGE = 1464811859; //WOAS
- static final int OFFICIAL_INTERNET_RADIO_STATION_HOMEPAGE = 1464816211; //WORS
- static final int ORIGINAL_ALBUM_TITLE = 1414480204; //TOAL
- static final int ORIGINAL_ARTIST = 1414484037; //TOPE
- static final int ORIGINAL_FILENAME = 1414481486; //TOFN
- static final int ORIGINAL_LYRICIST = 1414483033; //TOLY
- static final int ORIGINAL_RELEASE_TIME = 1413762898; //TDOR
- static final int OWNERSHIP_FRAME = 1331121733; //OWNE
- static final int PART_OF_A_SET = 1414549331; //TPOS
- static final int PAYMENT = 1464877401; //WPAY
- static final int PERFORMER_SORT_ORDER = 1414745936; //TSOP
- static final int PLAYLIST_DELAY = 1413762137; //TDLY
- static final int PLAY_COUNTER = 1346588244; //PCNT
- static final int POPULARIMETER = 1347375181; //POPM
- static final int POSITION_SYNCHRONISATION_FRAME = 1347375955; //POSS
- static final int PRIVATE_FRAME = 1347570006; //PRIV
- static final int PRODUCED_NOTICE = 1414550095; //TPRO
- static final int PUBLISHER = 1414550850; //TPUB
- static final int PUBLISHERS_OFFICIAL_WEBPAGE = 1464882498; //WPUB
- static final int RECOMMENDED_BUFFER_SIZE = 1380078918; //RBUF
- static final int RECORDING_TIME = 1413763651; //TDRC
- static final int RELATIVE_VOLUME_ADJUSTMENT = 1381384498; //RVA2
- static final int RELEASE_TIME = 1413763660; //TDRL
- static final int REVERB = 1381388866; //RVRB
- static final int SEEK_FRAME = 1397048651; //SEEK
- static final int SET_SUBTITLE = 1414746964; //TSST
- static final int SIGNATURE_FRAME = 1397311310; //SIGN
- static final int ENCODING_TOOLS_AND_SETTINGS = 1414746949; //TSSE
- static final int SUBTITLE = 1414091827; //TIT3
- static final int SYNCHRONISED_LYRIC = 1398361172; //SYLT
- static final int SYNCHRONISED_TEMPO_CODES = 1398363203; //SYTC
- static final int TAGGING_TIME = 1413764167; //TDTG
- static final int TERMS_OF_USE = 1431520594; //USER
- static final int TITLE = 1414091826; //TIT2
- static final int TITLE_SORT_ORDER = 1414745940; //TSOT
- static final int TRACK_NUMBER = 1414677323; //TRCK
- static final int UNIQUE_FILE_IDENTIFIER = 1430669636; //UFID
- static final int UNSYNCHRONISED_LYRIC = 1431522388; //USLT
- static final int USER_DEFINED_TEXT_INFORMATION_FRAME = 1415075928; //TXXX
- static final int USER_DEFINED_URL_LINK_FRAME = 1465407576; //WXXX
+ static final int ALBUM_TITLE = 1413565506; // TALB
+ static final int ALBUM_SORT_ORDER = 1414745921; // TSOA
+ static final int ARTIST = 1414546737; // TPE1
+ static final int ATTACHED_PICTURE = 1095780675; // APIC
+ static final int AUDIO_ENCRYPTION = 1095061059; // AENC
+ static final int AUDIO_SEEK_POINT_INDEX = 1095979081; // ASPI
+ static final int BAND = 1414546738; // TPE2
+ static final int BEATS_PER_MINUTE = 1413632077; // TBPM
+ static final int COMMENTS = 1129270605; // COMM
+ static final int COMMERCIAL_FRAME = 1129270610; // COMR
+ static final int COMMERCIAL_INFORMATION = 1464029005; // WCOM
+ static final int COMPOSER = 1413697357; // TCOM
+ static final int CONDUCTOR = 1414546739; // TPE3
+ static final int CONTENT_GROUP_DESCRIPTION = 1414091825; // TIT1
+ static final int CONTENT_TYPE = 1413697358; // TCON
+ static final int COPYRIGHT = 1464029008; // WCOP
+ static final int COPYRIGHT_MESSAGE = 1413697360; // TCOP
+ static final int ENCODED_BY = 1413828163; // TENC
+ static final int ENCODING_TIME = 1413760334; // TDEN
+ static final int ENCRYPTION_METHOD_REGISTRATION = 1162756946; // ENCR
+ static final int EQUALISATION = 1162958130; // EQU2
+ static final int EVENT_TIMING_CODES = 1163150159; // ETCO
+ static final int FILE_OWNER = 1414485838; // TOWN
+ static final int FILE_TYPE = 1413893204; // TFLT
+ static final int GENERAL_ENCAPSULATED_OBJECT = 1195724610; // GEOB
+ static final int GROUP_IDENTIFICATION_REGISTRATION = 1196575044; // GRID
+ static final int INITIAL_KEY = 1414219097; // TKEY
+ static final int INTERNET_RADIO_STATION_NAME = 1414681422; // TRSN
+ static final int INTERNET_RADIO_STATION_OWNER = 1414681423; // TRSO
+ static final int MODIFIED_BY = 1414546740; // TPE4
+ static final int INVOLVED_PEOPLE_LIST = 1414090828; // TIPL
+ static final int INTERNATIONAL_STANDARD_RECORDING_CODE = 1414746691; // TSRC
+ static final int LANGUAGES = 1414283598; // TLAN
+ static final int LENGTH = 1414284622; // TLEN
+ static final int LINKED_INFORMATION = 1279872587; // LINK
+ static final int LYRICIST = 1413830740; // TEXT
+ static final int MEDIA_TYPE = 1414350148; // TMED
+ static final int MOOD = 1414352719; // TMOO
+ static final int MPEG_LOCATION_LOOKUP_TABLE = 1296845908; // MLLT
+ static final int MUSICIAN_CREDITS_LIST = 1414349644; // TMCL
+ static final int MUSIC_CD_IDENTIFIER = 1296254025; // MCDI
+ static final int OFFICIAL_ARTIST_WEBPAGE = 1464811858; // WOAR
+ static final int OFFICIAL_AUDIO_FILE_WEBPAGE = 1464811846; // WOAF
+ static final int OFFICIAL_AUDIO_SOURCE_WEBPAGE = 1464811859; // WOAS
+ static final int OFFICIAL_INTERNET_RADIO_STATION_HOMEPAGE = 1464816211; // WORS
+ static final int ORIGINAL_ALBUM_TITLE = 1414480204; // TOAL
+ static final int ORIGINAL_ARTIST = 1414484037; // TOPE
+ static final int ORIGINAL_FILENAME = 1414481486; // TOFN
+ static final int ORIGINAL_LYRICIST = 1414483033; // TOLY
+ static final int ORIGINAL_RELEASE_TIME = 1413762898; // TDOR
+ static final int OWNERSHIP_FRAME = 1331121733; // OWNE
+ static final int PART_OF_A_SET = 1414549331; // TPOS
+ static final int PAYMENT = 1464877401; // WPAY
+ static final int PERFORMER_SORT_ORDER = 1414745936; // TSOP
+ static final int PLAYLIST_DELAY = 1413762137; // TDLY
+ static final int PLAY_COUNTER = 1346588244; // PCNT
+ static final int POPULARIMETER = 1347375181; // POPM
+ static final int POSITION_SYNCHRONISATION_FRAME = 1347375955; // POSS
+ static final int PRIVATE_FRAME = 1347570006; // PRIV
+ static final int PRODUCED_NOTICE = 1414550095; // TPRO
+ static final int PUBLISHER = 1414550850; // TPUB
+ static final int PUBLISHERS_OFFICIAL_WEBPAGE = 1464882498; // WPUB
+ static final int RECOMMENDED_BUFFER_SIZE = 1380078918; // RBUF
+ static final int RECORDING_TIME = 1413763651; // TDRC
+ static final int RELATIVE_VOLUME_ADJUSTMENT = 1381384498; // RVA2
+ static final int RELEASE_TIME = 1413763660; // TDRL
+ static final int REVERB = 1381388866; // RVRB
+ static final int SEEK_FRAME = 1397048651; // SEEK
+ static final int SET_SUBTITLE = 1414746964; // TSST
+ static final int SIGNATURE_FRAME = 1397311310; // SIGN
+ static final int ENCODING_TOOLS_AND_SETTINGS = 1414746949; // TSSE
+ static final int SUBTITLE = 1414091827; // TIT3
+ static final int SYNCHRONISED_LYRIC = 1398361172; // SYLT
+ static final int SYNCHRONISED_TEMPO_CODES = 1398363203; // SYTC
+ static final int TAGGING_TIME = 1413764167; // TDTG
+ static final int TERMS_OF_USE = 1431520594; // USER
+ static final int TITLE = 1414091826; // TIT2
+ static final int TITLE_SORT_ORDER = 1414745940; // TSOT
+ static final int TRACK_NUMBER = 1414677323; // TRCK
+ static final int UNIQUE_FILE_IDENTIFIER = 1430669636; // UFID
+ static final int UNSYNCHRONISED_LYRIC = 1431522388; // USLT
+ static final int USER_DEFINED_TEXT_INFORMATION_FRAME = 1415075928; // TXXX
+ static final int USER_DEFINED_URL_LINK_FRAME = 1465407576; // WXXX
private static final String[] TEXT_ENCODINGS = {"ISO-8859-1", "UTF-16"/*BOM*/, "UTF-16", "UTF-8"};
private static final String[] VALID_TIMESTAMPS = {"yyyy, yyyy-MM", "yyyy-MM-dd", "yyyy-MM-ddTHH", "yyyy-MM-ddTHH:mm", "yyyy-MM-ddTHH:mm:ss"};
private static final String UNKNOWN_LANGUAGE = "xxx";
@@ -108,13 +108,13 @@ class ID3Frame {
if (isInGroup()) groupID = in.read();
if (isEncrypted()) encryptionMethod = in.read();
- //TODO: data length indicator, unsync
+ // TODO: data length indicator, unsync
data = new byte[(int) size];
in.readFully(data);
}
- //header data
+ // header data
public int getID() {
return id;
}
@@ -143,7 +143,7 @@ public int getEncryptionMethod() {
return encryptionMethod;
}
- //content data
+ // content data
public byte[] getData() {
return data;
}
@@ -153,10 +153,10 @@ public String getText() {
}
public String getEncodedText() {
- //first byte indicates encoding
+ // first byte indicates encoding
int enc = data[0];
- //charsets 0,3 end with '0'; 1,2 end with '00'
+ // charsets 0,3 end with '0'; 1,2 end with '00'
int t = -1;
for (int i = 1; i < data.length && t < 0; i++) {
if (data[i] == 0 && (enc == 0 || enc == 3 || data[i + 1] == 0)) t = i;
@@ -169,7 +169,7 @@ public int getNumber() {
}
public int[] getNumbers() {
- //multiple numbers separated by '/'
+ // multiple numbers separated by '/'
String x = new String(data, Charset.forName(TEXT_ENCODINGS[0]));
int i = x.indexOf('/');
int[] y;
@@ -179,7 +179,7 @@ public int[] getNumbers() {
}
public Date getDate() {
- //timestamp lengths: 4,7,10,13,16,19
+ // timestamp lengths: 4,7,10,13,16,19
int i = (int) Math.floor(data.length / 3f) - 1;
Date date;
if (i >= 0 && i < VALID_TIMESTAMPS.length) {
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/ID3Tag.java b/src/main/java/net/sourceforge/jaad/mp4/api/ID3Tag.java
index 8a42029..b0fe03f 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/ID3Tag.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/ID3Tag.java
@@ -9,29 +9,29 @@
class ID3Tag {
- private static final int ID3_TAG = 4801587; //'ID3'
- private static final int SUPPORTED_VERSION = 4; //id3v2.4
+ private static final int ID3_TAG = 4801587; // 'ID3'
+ private static final int SUPPORTED_VERSION = 4; // id3v2.4
private final List frames;
private final int tag, flags, len;
ID3Tag(DataInputStream in) throws IOException {
frames = new ArrayList<>();
- //id3v2 header
- tag = (in.read() << 16) | (in.read() << 8) | in.read(); //'ID3'
+ // id3v2 header
+ tag = (in.read() << 16) | (in.read() << 8) | in.read(); // 'ID3'
int majorVersion = in.read();
- in.read(); //revision
+ in.read(); // revision
flags = in.read();
len = readSynch(in);
if (tag == ID3_TAG && majorVersion <= SUPPORTED_VERSION) {
if ((flags & 0x40) == 0x40) {
- //extended header; TODO: parse
+ // extended header; TODO: parse
int extSize = readSynch(in);
in.skipBytes(extSize - 6);
}
- //read all id3 frames
+ // read all id3 frames
int left = len;
ID3Frame frame;
while (left > 0) {
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/MetaData.java b/src/main/java/net/sourceforge/jaad/mp4/api/MetaData.java
index 252b26e..4f4894f 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/MetaData.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/MetaData.java
@@ -78,7 +78,7 @@ public static class Field {
public static final Field GAPLESS_PLAYBACK = new Field<>("Gapless Playback");
public static final Field HD_VIDEO = new Field<>("HD Video");
public static final Field LANGUAGE = new Field<>("Language");
- //sorting
+ // sorting
public static final Field ARTIST_SORT_TEXT = new Field<>("Artist Sort Text");
public static final Field TITLE_SORT_TEXT = new Field<>("Title Sort Text");
public static final Field ALBUM_SORT_TEXT = new Field<>("Album Sort Text");
@@ -95,7 +95,7 @@ public String getName() {
private static final String[] STANDARD_GENRES = {
"undefined",
- //IDv1 standard
+ // IDv1 standard
"blues",
"classic rock",
"country",
@@ -175,7 +175,7 @@ public String getName() {
"retro",
"musical",
"rock and roll",
- //winamp extension
+ // winamp extension
"hard rock",
"folk",
"folk rock",
@@ -245,34 +245,34 @@ public String getName() {
* ---tshd
*/
void parse(Box udta, Box meta) {
- //standard boxes
+ // standard boxes
if (meta.hasChild(BoxTypes.COPYRIGHT_BOX)) {
CopyrightBox cprt = (CopyrightBox) meta.getChild(BoxTypes.COPYRIGHT_BOX);
put(Field.LANGUAGE, new Locale(cprt.getLanguageCode()));
put(Field.COPYRIGHT, cprt.getNotice());
}
- //3gpp user data
+ // 3gpp user data
if (udta != null) parse3GPPData(udta);
- //id3, TODO: can be present in different languages
+ // id3, TODO: can be present in different languages
if (meta.hasChild(BoxTypes.ID3_TAG_BOX)) parseID3((ID3TagBox) meta.getChild(BoxTypes.ID3_TAG_BOX));
- //itunes
+ // itunes
if (meta.hasChild(BoxTypes.ITUNES_META_LIST_BOX))
parseITunesMetaData(meta.getChild(BoxTypes.ITUNES_META_LIST_BOX));
- //nero tags
+ // nero tags
if (meta.hasChild(BoxTypes.NERO_METADATA_TAGS_BOX))
parseNeroTags((NeroMetadataTagsBox) meta.getChild(BoxTypes.NERO_METADATA_TAGS_BOX));
}
- //parses specific children of 'udta': 3GPP
- //TODO: handle language codes
+ // parses specific children of 'udta': 3GPP
+ // TODO: handle language codes
private void parse3GPPData(Box udta) {
if (udta.hasChild(BoxTypes.THREE_GPP_ALBUM_BOX)) {
ThreeGPPAlbumBox albm = (ThreeGPPAlbumBox) udta.getChild(BoxTypes.THREE_GPP_ALBUM_BOX);
put(Field.ALBUM, albm.getData());
put(Field.TRACK_NUMBER, albm.getTrackNumber());
}
- //if(udta.hasChild(BoxTypes.THREE_GPP_AUTHOR_BOX));
- //if(udta.hasChild(BoxTypes.THREE_GPP_CLASSIFICATION_BOX));
+// if (udta.hasChild(BoxTypes.THREE_GPP_AUTHOR_BOX)) ;
+// if (udta.hasChild(BoxTypes.THREE_GPP_CLASSIFICATION_BOX)) ;
if (udta.hasChild(BoxTypes.THREE_GPP_DESCRIPTION_BOX))
put(Field.DESCRIPTION, ((ThreeGPPMetadataBox) udta.getChild(BoxTypes.THREE_GPP_DESCRIPTION_BOX)).getData());
if (udta.hasChild(BoxTypes.THREE_GPP_KEYWORDS_BOX))
@@ -293,7 +293,7 @@ private void parse3GPPData(Box udta) {
put(Field.TITLE, ((ThreeGPPMetadataBox) udta.getChild(BoxTypes.THREE_GPP_TITLE_BOX)).getData());
}
- //parses children of 'ilst': iTunes
+ // parses children of 'ilst': iTunes
private void parseITunesMetaData(Box ilst) {
List boxes = ilst.getChildren();
long l;
@@ -309,7 +309,7 @@ private void parseITunesMetaData(Box ilst) {
else if (l == BoxTypes.TRACK_NUMBER_BOX) {
byte[] b = data.getData();
put(Field.TRACK_NUMBER, (int) b[3]);
- put(Field.TOTAL_TRACKS, new Integer(b[5]));
+ put(Field.TOTAL_TRACKS, (int) b[5]);
} else if (l == BoxTypes.DISK_NUMBER_BOX) put(Field.DISK_NUMBER, data.getInteger());
else if (l == BoxTypes.COMPOSER_NAME_BOX) put(Field.COMPOSER, data.getText());
else if (l == BoxTypes.COMMENTS_BOX) put(Field.COMMENTS, data.getText());
@@ -358,7 +358,7 @@ else if (l == BoxTypes.COVER_BOX) {
}
}
- //parses children of ID3
+ // parses children of ID3
private void parseID3(ID3TagBox box) {
try {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(box.getID3Data()));
@@ -426,7 +426,7 @@ private void parseID3(ID3TagBox box) {
}
}
- //parses children of 'tags': Nero
+ // parses children of 'tags': Nero
private void parseNeroTags(NeroMetadataTagsBox tags) {
Map pairs = tags.getPairs();
String val;
@@ -446,16 +446,16 @@ private void parseNeroTags(NeroMetadataTagsBox tags) {
if (key.equals(NERO_TAGS[6])) put(Field.GENRE, val);
if (key.equals(NERO_TAGS[7])) put(Field.DISK_NUMBER, Integer.parseInt(val));
if (key.equals(NERO_TAGS[8])) put(Field.TOTAL_DISKS, Integer.parseInt(val));
- if (key.equals(NERO_TAGS[9])) ; //url
+ if (key.equals(NERO_TAGS[9])) ; // url
if (key.equals(NERO_TAGS[10])) put(Field.COPYRIGHT, val);
if (key.equals(NERO_TAGS[11])) put(Field.COMMENTS, val);
if (key.equals(NERO_TAGS[12])) put(Field.LYRICS, val);
- if (key.equals(NERO_TAGS[13])) ; //credits
+ if (key.equals(NERO_TAGS[13])) ; // credits
if (key.equals(NERO_TAGS[14])) put(Field.RATING, Integer.parseInt(val));
if (key.equals(NERO_TAGS[15])) put(Field.PUBLISHER, val);
if (key.equals(NERO_TAGS[16])) put(Field.COMPOSER, val);
- if (key.equals(NERO_TAGS[17])) ; //isrc
- if (key.equals(NERO_TAGS[18])) ; //mood
+ if (key.equals(NERO_TAGS[17])) ; // isrc
+ if (key.equals(NERO_TAGS[18])) ; // mood
if (key.equals(NERO_TAGS[19])) put(Field.TEMPO, Integer.parseInt(val));
} catch (NumberFormatException e) {
Logger.getLogger("MP4 API").log(Level.SEVERE, "Exception in MetaData.parseNeroTags: {0}", e.toString());
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/Movie.java b/src/main/java/net/sourceforge/jaad/mp4/api/Movie.java
index 7a2aab2..330f45e 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/Movie.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/Movie.java
@@ -24,7 +24,7 @@ public class Movie {
public Movie(Box moov, MP4Input in) {
this.in = in;
- //create tracks
+ // create tracks
mvhd = (MovieHeaderBox) moov.getChild(BoxTypes.MOVIE_HEADER_BOX);
List trackBoxes = moov.getChildren(BoxTypes.TRACK_BOX);
tracks = new ArrayList<>(trackBoxes.size());
@@ -34,7 +34,7 @@ public Movie(Box moov, MP4Input in) {
if (track != null) tracks.add(track);
}
- //read metadata: moov.meta/moov.udta.meta
+ // read metadata: moov.meta/moov.udta.meta
metaData = new MetaData();
if (moov.hasChild(BoxTypes.META_BOX)) metaData.parse(null, moov.getChild(BoxTypes.META_BOX));
else if (moov.hasChild(BoxTypes.USER_DATA_BOX)) {
@@ -42,7 +42,7 @@ else if (moov.hasChild(BoxTypes.USER_DATA_BOX)) {
if (udta.hasChild(BoxTypes.META_BOX)) metaData.parse(udta, udta.getChild(BoxTypes.META_BOX));
}
- //detect DRM
+ // detect DRM
protections = new ArrayList<>();
if (moov.hasChild(BoxTypes.ITEM_PROTECTION_BOX)) {
Box ipro = moov.getChild(BoxTypes.ITEM_PROTECTION_BOX);
@@ -139,7 +139,7 @@ public List getProtections() {
return Collections.unmodifiableList(protections);
}
- //mvhd
+ // mvhd
/**
* Returns the time this movie was created.
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/Protection.java b/src/main/java/net/sourceforge/jaad/mp4/api/Protection.java
index cc1abae..c283756 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/Protection.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/Protection.java
@@ -39,10 +39,10 @@ static Protection parse(Box sinf) {
private final Codec originalFormat;
protected Protection(Box sinf) {
- //original format
+ // original format
long type = ((OriginalFormatBox) sinf.getChild(BoxTypes.ORIGINAL_FORMAT_BOX)).getOriginalFormat();
Codec c;
- //TODO: currently it tests for audio and video codec, can do this any other way?
+ // TODO: currently it tests for audio and video codec, can do this any other way?
if (!(c = AudioTrack.AudioCodec.forType(type)).equals(AudioTrack.AudioCodec.UNKNOWN_AUDIO_CODEC))
originalFormat = c;
else if (!(c = VideoTrack.VideoCodec.forType(type)).equals(VideoTrack.VideoCodec.UNKNOWN_VIDEO_CODEC))
@@ -56,7 +56,7 @@ Codec getOriginalFormat() {
public abstract Scheme getScheme();
- //default implementation for unknown protection schemes
+ // default implementation for unknown protection schemes
private static class UnknownProtection extends Protection {
UnknownProtection(Box sinf) {
diff --git a/src/main/java/net/sourceforge/jaad/mp4/api/Track.java b/src/main/java/net/sourceforge/jaad/mp4/api/Track.java
index 0fb514b..2302d3c 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/api/Track.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/api/Track.java
@@ -37,11 +37,11 @@
*
* @author in-somnia
*/
-//TODO: expand javadoc; use generics for subclasses?
+// TODO: expand javadoc; use generics for subclasses?
public abstract class Track {
public interface Codec {
- //TODO: currently only marker interface
+ // TODO: currently only marker interface
}
private final MP4Input in;
@@ -51,7 +51,7 @@ public interface Codec {
private final List frames;
private URL location;
private int currentFrame;
- //info structures
+ // info structures
protected DecoderSpecificInfo decoderSpecificInfo;
protected DecoderInfo decoderInfo;
protected Protection protection;
@@ -67,7 +67,7 @@ public interface Codec {
Box dinf = minf.getChild(BoxTypes.DATA_INFORMATION_BOX);
DataReferenceBox dref = (DataReferenceBox) dinf.getChild(BoxTypes.DATA_REFERENCE_BOX);
- //TODO: support URNs
+ // TODO: support URNs
if (dref.hasChild(BoxTypes.DATA_ENTRY_URL_BOX)) {
DataEntryUrlBox url = (DataEntryUrlBox) dref.getChild(BoxTypes.DATA_ENTRY_URL_BOX);
inFile = url.isInFile();
@@ -90,7 +90,7 @@ public interface Codec {
location = null;
}
- //sample table
+ // sample table
Box stbl = minf.getChild(BoxTypes.SAMPLE_TABLE_BOX);
if (stbl.hasChildren()) {
frames = new ArrayList<>();
@@ -103,21 +103,21 @@ private void parseSampleTable(Box stbl) {
double timeScale = mdhd.getTimeScale();
Type type = getType();
- //sample sizes
+ // sample sizes
long[] sampleSizes = ((SampleSizeBox) stbl.getChild(BoxTypes.SAMPLE_SIZE_BOX)).getSampleSizes();
- //chunk offsets
+ // chunk offsets
ChunkOffsetBox stco;
if (stbl.hasChild(BoxTypes.CHUNK_OFFSET_BOX)) stco = (ChunkOffsetBox) stbl.getChild(BoxTypes.CHUNK_OFFSET_BOX);
else stco = (ChunkOffsetBox) stbl.getChild(BoxTypes.CHUNK_LARGE_OFFSET_BOX);
long[] chunkOffsets = stco.getChunks();
- //samples to chunks
+ // samples to chunks
SampleToChunkBox stsc = ((SampleToChunkBox) stbl.getChild(BoxTypes.SAMPLE_TO_CHUNK_BOX));
long[] firstChunks = stsc.getFirstChunks();
long[] samplesPerChunk = stsc.getSamplesPerChunk();
- //sample durations/timestamps
+ // sample durations/timestamps
DecodingTimeToSampleBox stts = (DecodingTimeToSampleBox) stbl.getChild(BoxTypes.DECODING_TIME_TO_SAMPLE_BOX);
long[] sampleCounts = stts.getSampleCounts();
long[] sampleDeltas = stts.getSampleDeltas();
@@ -129,26 +129,26 @@ private void parseSampleTable(Box stbl) {
timeOffsets[off + j] = tmp;
tmp += sampleDeltas[i];
}
- off += sampleCounts[i];
+ off = (int) (off + sampleCounts[i]);
}
- //create samples
+ // create samples
int current = 0;
int lastChunk;
double timeStamp;
long offset = 0;
- //iterate over all chunk groups
+ // iterate over all chunk groups
for (int i = 0; i < firstChunks.length; i++) {
if (i < firstChunks.length - 1) lastChunk = (int) firstChunks[i + 1] - 1;
else lastChunk = chunkOffsets.length;
- //iterate over all chunks in current group
+ // iterate over all chunks in current group
for (int j = (int) firstChunks[i] - 1; j < lastChunk; j++) {
offset = chunkOffsets[j];
- //iterate over all samples in current chunk
+ // iterate over all samples in current chunk
for (int k = 0; k < samplesPerChunk[i]; k++) {
- //create samples
+ // create samples
timeStamp = ((double) timeOffsets[current]) / timeScale;
frames.add(new Frame(type, offset, sampleSizes[current], timeStamp));
offset += sampleSizes[current];
@@ -157,12 +157,12 @@ private void parseSampleTable(Box stbl) {
}
}
- //frames need not to be time-ordered: sort by timestamp
- //TODO: is it possible to add them to the specific position?
+ // frames need not to be time-ordered: sort by timestamp
+ // TODO: is it possible to add them to the specific position?
Collections.sort(frames);
}
- //TODO: implement other entry descriptors
+ // TODO: implement other entry descriptors
protected void findDecoderSpecificInfo(ESDBox esds) {
Descriptor ed = esds.getEntryDescriptor();
List children = ed.getChildren();
@@ -196,7 +196,7 @@ protected void parseSampleEntry(Box sampleEntry, Class clazz) {
public abstract Codec getCodec();
- //tkhd
+ // tkhd
/**
* Returns true if the track is enabled. A disabled track is treated as if
@@ -244,7 +244,7 @@ public Date getModificationTime() {
return Utils.getDate(tkhd.getModificationTime());
}
- //mdhd
+ // mdhd
/**
* Returns the language for this media.
@@ -277,7 +277,7 @@ public URL getLocation() {
return location;
}
- //info structures
+ // info structures
/**
* Returns the decoder specific info, if present. It contains configuration
@@ -315,7 +315,7 @@ public Protection getProtection() {
return protection;
}
- //reading
+ // reading
/**
* Indicates if there are more frames to be read in this track.
@@ -370,7 +370,7 @@ else if (diff < 0) {
* @return the frame's timestamp that the method seeked to
*/
public double seek(double timestamp) {
- //find first frame > timestamp
+ // find first frame > timestamp
Frame frame = null;
for (int i = 0; i < frames.size(); i++) {
frame = frames.get(i++);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxFactory.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxFactory.java
index c74ffe3..3a95d32 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxFactory.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxFactory.java
@@ -64,7 +64,7 @@ public class BoxFactory implements BoxTypes {
private static final Map PARAMETER = new HashMap<>();
static {
- //classes
+ // classes
BOX_CLASSES.put(ADDITIONAL_METADATA_CONTAINER_BOX, BoxImpl.class);
BOX_CLASSES.put(APPLE_LOSSLESS_BOX, AppleLosslessBox.class);
BOX_CLASSES.put(BINARY_XML_BOX, BinaryXMLBox.class);
@@ -266,7 +266,7 @@ public class BoxFactory implements BoxTypes {
BOX_CLASSES.put(FAIRPLAY_USER_KEY_BOX, FairPlayDataBox.class);
BOX_CLASSES.put(FAIRPLAY_IV_BOX, FairPlayDataBox.class);
BOX_CLASSES.put(FAIRPLAY_PRIVATE_KEY_BOX, FairPlayDataBox.class);
- //parameter
+ // parameter
PARAMETER.put(ADDITIONAL_METADATA_CONTAINER_BOX, new String[] {"Additional Metadata Container Box"});
PARAMETER.put(DATA_INFORMATION_BOX, new String[] {"Data Information Box"});
PARAMETER.put(EDIT_BOX, new String[] {"Edit Box"});
@@ -377,9 +377,9 @@ public static Box parseBox(Box parent, long offset, long size, long type, MP4Inp
if (type == EXTENDED_TYPE)
in.skipBytes(16);
-LOGGER.finest("type: " + typeToString(type) + ", " + size);
+ LOGGER.finest("type: " + typeToString(type) + ", " + size);
- //error protection
+ // error protection
if (parent != null) {
long parentLeft = (parent.getOffset() + parent.getSize()) - offset;
if (size > parentLeft)
@@ -391,11 +391,11 @@ public static Box parseBox(Box parent, long offset, long size, long type, MP4Inp
box.setParams(parent, size, type, offset);
box.decode(in);
- //if box doesn't contain data it only contains children
+ // if box doesn't contain data it only contains children
Class> cl = box.getClass();
if (cl == BoxImpl.class || cl == FullBox.class) box.readChildren(in);
- //check bytes left
+ // check bytes left
long left = (box.getOffset() + box.getSize()) - in.getOffset();
if (left > 0
&& !(box instanceof MediaDataBox)
@@ -405,7 +405,7 @@ public static Box parseBox(Box parent, long offset, long size, long type, MP4Inp
else if (left < 0)
LOGGER.log(Level.SEVERE, "box {0} overread: {1} bytes, offset: {2}", new Object[] {typeToString(type), -left, in.getOffset()});
- //if mdat found and no random access, don't skip
+ // if mdat found and no random access, don't skip
if (box.getType() != MEDIA_DATA_BOX || in.hasRandomAccess()) in.skipBytes(left);
return box;
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxImpl.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxImpl.java
index 640749a..375f7c8 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxImpl.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxImpl.java
@@ -42,22 +42,27 @@ protected long getLeft(MP4Input in) throws IOException {
public void decode(MP4Input in) throws IOException {
}
+ @Override
public long getType() {
return type;
}
+ @Override
public long getSize() {
return size;
}
+ @Override
public long getOffset() {
return offset;
}
+ @Override
public Box getParent() {
return parent;
}
+ @Override
public String getName() {
return name;
}
@@ -67,11 +72,13 @@ public String toString() {
return name + " [" + BoxFactory.typeToString(type) + "]";
}
- //container methods
+ // container methods
+ @Override
public boolean hasChildren() {
return children.size() > 0;
}
+ @Override
public boolean hasChild(long type) {
boolean b = false;
for (Box box : children) {
@@ -83,6 +90,7 @@ public boolean hasChild(long type) {
return b;
}
+ @Override
public Box getChild(long type) {
Box box = null, b = null;
int i = 0;
@@ -94,10 +102,12 @@ public Box getChild(long type) {
return box;
}
+ @Override
public List getChildren() {
return Collections.unmodifiableList(children);
}
+ @Override
public List getChildren(long type) {
List l = new ArrayList<>();
for (Box box : children) {
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxTypes.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxTypes.java
index fee2aa9..5bea928 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxTypes.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/BoxTypes.java
@@ -7,218 +7,218 @@ public interface BoxTypes {
Logger LOGGER = Logger.getLogger(BoxTypes.class.getName());
- long EXTENDED_TYPE = 1970628964; //uuid
- //standard boxes (ISO BMFF)
- long ADDITIONAL_METADATA_CONTAINER_BOX = 1835361135L; //meco
- long APPLE_LOSSLESS_BOX = 1634492771L; //alac
- long BINARY_XML_BOX = 1652059500L; //bxml
- long BIT_RATE_BOX = 1651798644L; //btrt
- long CHAPTER_BOX = 1667788908L; //chpl
- long CHUNK_OFFSET_BOX = 1937007471L; //stco
- long CHUNK_LARGE_OFFSET_BOX = 1668232756L; //co64
- long CLEAN_APERTURE_BOX = 1668047216L; //clap
- long COMPACT_SAMPLE_SIZE_BOX = 1937013298L; //stz2
- long COMPOSITION_TIME_TO_SAMPLE_BOX = 1668576371L; //ctts
- long COPYRIGHT_BOX = 1668313716L; //cprt
- long DATA_ENTRY_URN_BOX = 1970433568L; //urn
- long DATA_ENTRY_URL_BOX = 1970433056L; //url
- long DATA_INFORMATION_BOX = 1684631142L; //dinf
- long DATA_REFERENCE_BOX = 1685218662L; //dref
- long DECODING_TIME_TO_SAMPLE_BOX = 1937011827L; //stts
- long DEGRADATION_PRIORITY_BOX = 1937007728L; //stdp
- long EDIT_BOX = 1701082227L; //edts
- long EDIT_LIST_BOX = 1701606260L; //elst
- long FD_ITEM_INFORMATION_BOX = 1718184302L; //fiin
- long FD_SESSION_GROUP_BOX = 1936025458L; //segr
- long FEC_RESERVOIR_BOX = 1717920626L; //fecr
- long FILE_PARTITION_BOX = 1718641010L; //fpar
- long FILE_TYPE_BOX = 1718909296L; //ftyp
- long FREE_SPACE_BOX = 1718773093L; //free
- long GROUP_ID_TO_NAME_BOX = 1734964334L; //gitn
- long HANDLER_BOX = 1751411826L; //hdlr
- long HINT_MEDIA_HEADER_BOX = 1752000612L; //hmhd
- long IPMP_CONTROL_BOX = 1768975715L; //ipmc
- long IPMP_INFO_BOX = 1768778086L; //imif
- long ITEM_INFORMATION_BOX = 1768517222L; //iinf
- long ITEM_INFORMATION_ENTRY = 1768842853L; //infe
- long ITEM_LOCATION_BOX = 1768714083L; //iloc
- long ITEM_PROTECTION_BOX = 1768977007L; //ipro
- long MEDIA_BOX = 1835297121L; //mdia
- long MEDIA_DATA_BOX = 1835295092L; //mdat
- long MEDIA_HEADER_BOX = 1835296868L; //mdhd
- long MEDIA_INFORMATION_BOX = 1835626086L; //minf
- long META_BOX = 1835365473L; //meta
- long META_BOX_RELATION_BOX = 1835364965L; //mere
- long MOVIE_BOX = 1836019574L; //moov
- long MOVIE_EXTENDS_BOX = 1836475768L; //mvex
- long MOVIE_EXTENDS_HEADER_BOX = 1835362404L; //mehd
- long MOVIE_FRAGMENT_BOX = 1836019558L; //moof
- long MOVIE_FRAGMENT_HEADER_BOX = 1835427940L; //mfhd
- long MOVIE_FRAGMENT_RANDOM_ACCESS_BOX = 1835430497L; //mfra
- long MOVIE_FRAGMENT_RANDOM_ACCESS_OFFSET_BOX = 1835430511L; //mfro
- long MOVIE_HEADER_BOX = 1836476516L; //mvhd
- long NERO_METADATA_TAGS_BOX = 1952540531L; //tags
- long NULL_MEDIA_HEADER_BOX = 1852663908L; //nmhd
- long ORIGINAL_FORMAT_BOX = 1718775137L; //frma
- long PADDING_BIT_BOX = 1885430882L; //padb
- long PARTITION_ENTRY = 1885431150L; //paen
- long PIXEL_ASPECT_RATIO_BOX = 1885434736L; //pasp
- long PRIMARY_ITEM_BOX = 1885959277L; //pitm
- long PROGRESSIVE_DOWNLOAD_INFORMATION_BOX = 1885628782L; //pdin
- long PROTECTION_SCHEME_INFORMATION_BOX = 1936289382L; //sinf
- long SAMPLE_DEPENDENCY_TYPE_BOX = 1935963248L; //sdtp
- long SAMPLE_DESCRIPTION_BOX = 1937011556L; //stsd
- long SAMPLE_GROUP_DESCRIPTION_BOX = 1936158820L; //sgpd
- long SAMPLE_SCALE_BOX = 1937011564L; //stsl
- long SAMPLE_SIZE_BOX = 1937011578L; //stsz
- long SAMPLE_TABLE_BOX = 1937007212L; //stbl
- long SAMPLE_TO_CHUNK_BOX = 1937011555L; //stsc
- long SAMPLE_TO_GROUP_BOX = 1935828848L; //sbgp
- long SCHEME_TYPE_BOX = 1935894637L; //schm
- long SCHEME_INFORMATION_BOX = 1935894633L; //schi
- long SHADOW_SYNC_SAMPLE_BOX = 1937011560L; //stsh
- long SKIP_BOX = 1936419184L; //skip
- long SOUND_MEDIA_HEADER_BOX = 1936549988L; //smhd
- long SUB_SAMPLE_INFORMATION_BOX = 1937072755L; //subs
- long SYNC_SAMPLE_BOX = 1937011571L; //stss
- long TRACK_BOX = 1953653099L; //trak
- long TRACK_EXTENDS_BOX = 1953654136L; //trex
- long TRACK_FRAGMENT_BOX = 1953653094L; //traf
- long TRACK_FRAGMENT_HEADER_BOX = 1952868452L; //tfhd
- long TRACK_FRAGMENT_RANDOM_ACCESS_BOX = 1952871009L; //tfra
- long TRACK_FRAGMENT_RUN_BOX = 1953658222L; //trun
- long TRACK_HEADER_BOX = 1953196132L; //tkhd
- long TRACK_REFERENCE_BOX = 1953654118L; //tref
- long TRACK_SELECTION_BOX = 1953719660L; //tsel
- long USER_DATA_BOX = 1969517665L; //udta
- long VIDEO_MEDIA_HEADER_BOX = 1986881636L; //vmhd
- long WIDE_BOX = 2003395685L; //wide
- long XML_BOX = 2020437024L; //xml
- //mp4 extension
- long OBJECT_DESCRIPTOR_BOX = 1768907891L; //iods
- long SAMPLE_DEPENDENCY_BOX = 1935959408L; //sdep
- //metadata: id3
- long ID3_TAG_BOX = 1768174386L; //id32
- //metadata: itunes
- long ITUNES_META_LIST_BOX = 1768715124L; //ilst
- long CUSTOM_ITUNES_METADATA_BOX = 757935405L; //----
- long ITUNES_METADATA_BOX = 1684108385L; //data
- long ITUNES_METADATA_NAME_BOX = 1851878757L; //name
- long ITUNES_METADATA_MEAN_BOX = 1835360622L; //mean
- long ALBUM_ARTIST_NAME_BOX = 1631670868L; //aART
- long ALBUM_ARTIST_SORT_BOX = 1936679265L; //soaa
- long ALBUM_NAME_BOX = 2841734242L; //©alb
- long ALBUM_SORT_BOX = 1936679276L; //soal
- long ARTIST_NAME_BOX = 2839630420L; //©ART
- long ARTIST_SORT_BOX = 1936679282L; //soar
- long CATEGORY_BOX = 1667331175L; //catg
- long COMMENTS_BOX = 2841865588L; //©cmt
- long COMPILATION_PART_BOX = 1668311404L; //cpil
- long COMPOSER_NAME_BOX = 2843177588L; //©wrt
- long COMPOSER_SORT_BOX = 1936679791L; //soco
- long COVER_BOX = 1668249202L; //covr
- long CUSTOM_GENRE_BOX = 2842125678L; //©gen
- long DESCRIPTION_BOX = 1684370275L; //desc
- long DISK_NUMBER_BOX = 1684632427L; //disk
- long ENCODER_NAME_BOX = 2841996899L; //©enc
- long ENCODER_TOOL_BOX = 2842980207L; //©too
- long EPISODE_GLOBAL_UNIQUE_ID_BOX = 1701276004L; //egid
- long GAPLESS_PLAYBACK_BOX = 1885823344L; //pgap
- long GENRE_BOX = 1735291493L; //gnre
- long GROUPING_BOX = 2842129008L; //©grp
- long HD_VIDEO_BOX = 1751414372L; //hdvd
- long ITUNES_PURCHASE_ACCOUNT_BOX = 1634748740L; //apID
- long ITUNES_ACCOUNT_TYPE_BOX = 1634421060L; //akID
- long ITUNES_CATALOGUE_ID_BOX = 1668172100L; //cnID
- long ITUNES_COUNTRY_CODE_BOX = 1936083268L; //sfID
- long KEYWORD_BOX = 1801812343L; //keyw
- long LONG_DESCRIPTION_BOX = 1818518899L; //ldes
- long LYRICS_BOX = 2842458482L; //©lyr
- long META_TYPE_BOX = 1937009003L; //stik
- long PODCAST_BOX = 1885565812L; //pcst
- long PODCAST_URL_BOX = 1886745196L; //purl
- long PURCHASE_DATE_BOX = 1886745188L; //purd
- long RATING_BOX = 1920233063L; //rtng
- long RELEASE_DATE_BOX = 2841928057L; //©day
- long REQUIREMENT_BOX = 2842846577L; //©req
- long TEMPO_BOX = 1953329263L; //tmpo
- long TRACK_NAME_BOX = 2842583405L; //©nam
- long TRACK_NUMBER_BOX = 1953655662L; //trkn
- long TRACK_SORT_BOX = 1936682605L; //sonm
- long TV_EPISODE_BOX = 1953916275L; //tves
- long TV_EPISODE_NUMBER_BOX = 1953916270L; //tven
- long TV_NETWORK_NAME_BOX = 1953918574L; //tvnn
- long TV_SEASON_BOX = 1953919854L; //tvsn
- long TV_SHOW_BOX = 1953919848L; //tvsh
- long TV_SHOW_SORT_BOX = 1936683886L; //sosn
- //metadata: 3gpp
- long THREE_GPP_ALBUM_BOX = 1634493037L; //albm
- long THREE_GPP_AUTHOR_BOX = 1635087464L; //auth
- long THREE_GPP_CLASSIFICATION_BOX = 1668051814L; //clsf
- long THREE_GPP_DESCRIPTION_BOX = 1685283696L; //dscp
- long THREE_GPP_KEYWORDS_BOX = 1803122532L; //kywd
- long THREE_GPP_LOCATION_INFORMATION_BOX = 1819239273L; //loci
- long THREE_GPP_PERFORMER_BOX = 1885696614L; //perf
- long THREE_GPP_RECORDING_YEAR_BOX = 2037543523L; //yrrc
- long THREE_GPP_TITLE_BOX = 1953068140L; //titl
- //metadata: google/youtube
- long GOOGLE_HOST_HEADER_BOX = 1735616616L; //gshh
- long GOOGLE_PING_MESSAGE_BOX = 1735618669L; //gspm
- long GOOGLE_PING_URL_BOX = 1735618677L; //gspu
- long GOOGLE_SOURCE_DATA_BOX = 1735619428L; //gssd
- long GOOGLE_START_TIME_BOX = 1735619444L; //gsst
- long GOOGLE_TRACK_DURATION_BOX = 1735619684L; //gstd
- //sample entries
- long MP4V_SAMPLE_ENTRY = 1836070006L; //mp4v
- long H263_SAMPLE_ENTRY = 1932670515L; //s263
- long ENCRYPTED_VIDEO_SAMPLE_ENTRY = 1701733238L; //encv
- long AVC_SAMPLE_ENTRY = 1635148593L; //avc1
- long MP4A_SAMPLE_ENTRY = 1836069985L; //mp4a
- long AC3_SAMPLE_ENTRY = 1633889587L; //ac-3
- long EAC3_SAMPLE_ENTRY = 1700998451L; //ec-3
- long DRMS_SAMPLE_ENTRY = 1685220723L; //drms
- long AMR_SAMPLE_ENTRY = 1935764850L; //samr
- long AMR_WB_SAMPLE_ENTRY = 1935767394L; //sawb
- long EVRC_SAMPLE_ENTRY = 1936029283L; //sevc
- long QCELP_SAMPLE_ENTRY = 1936810864L; //sqcp
- long SMV_SAMPLE_ENTRY = 1936944502L; //ssmv
- long ENCRYPTED_AUDIO_SAMPLE_ENTRY = 1701733217L; //enca
- long MPEG_SAMPLE_ENTRY = 1836070003L; //mp4s
- long TEXT_METADATA_SAMPLE_ENTRY = 1835365492L; //mett
- long XML_METADATA_SAMPLE_ENTRY = 1835365496L; //metx
- long RTP_HINT_SAMPLE_ENTRY = 1920233504L; //rtp
- long FD_HINT_SAMPLE_ENTRY = 1717858336L; //fdp
- //codec infos
- long ESD_BOX = 1702061171L; //esds
- //video codecs
- long H263_SPECIFIC_BOX = 1681012275L; //d263
- long AVC_SPECIFIC_BOX = 1635148611L; //avcC
- //audio codecs
- long AC3_SPECIFIC_BOX = 1684103987L; //dac3
- long EAC3_SPECIFIC_BOX = 1684366131L; //dec3
- long AMR_SPECIFIC_BOX = 1684106610L; //damr
- long EVRC_SPECIFIC_BOX = 1684371043L; //devc
- long QCELP_SPECIFIC_BOX = 1685152624L; //dqcp
- long SMV_SPECIFIC_BOX = 1685286262L; //dsmv
- //OMA DRM
- long OMA_ACCESS_UNIT_FORMAT_BOX = 1868849510L; //odaf
- long OMA_COMMON_HEADERS_BOX = 1869112434L; //ohdr
- long OMA_CONTENT_ID_BOX = 1667459428L; //ccid
- long OMA_CONTENT_OBJECT_BOX = 1868850273L; //odda
- long OMA_COVER_URI_BOX = 1668706933L; //cvru
- long OMA_DISCRETE_MEDIA_HEADERS_BOX = 1868851301L; //odhe
- long OMA_DRM_CONTAINER_BOX = 1868853869L; //odrm
- long OMA_ICON_URI_BOX = 1768124021L; //icnu
- long OMA_INFO_URL_BOX = 1768842869L; //infu
- long OMA_LYRICS_URI_BOX = 1819435893L; //lrcu
- long OMA_MUTABLE_DRM_INFORMATION_BOX = 1835299433L; //mdri
- long OMA_KEY_MANAGEMENT_BOX = 1868852077L; //odkm
- long OMA_RIGHTS_OBJECT_BOX = 1868853858L; //odrb
- long OMA_TRANSACTION_TRACKING_BOX = 1868854388L; //odtt
- //iTunes DRM (FairPlay)
- long FAIRPLAY_USER_ID_BOX = 1970496882L; //user
- long FAIRPLAY_USER_NAME_BOX = 1851878757L; //name
- long FAIRPLAY_USER_KEY_BOX = 1801812256L; //key
- long FAIRPLAY_IV_BOX = 1769367926L; //iviv
- long FAIRPLAY_PRIVATE_KEY_BOX = 1886546294L; //priv
+ long EXTENDED_TYPE = 1970628964; // uuid
+ // standard boxes (ISO BMFF)
+ long ADDITIONAL_METADATA_CONTAINER_BOX = 1835361135L; // meco
+ long APPLE_LOSSLESS_BOX = 1634492771L; // alac
+ long BINARY_XML_BOX = 1652059500L; // bxml
+ long BIT_RATE_BOX = 1651798644L; // btrt
+ long CHAPTER_BOX = 1667788908L; // chpl
+ long CHUNK_OFFSET_BOX = 1937007471L; // stco
+ long CHUNK_LARGE_OFFSET_BOX = 1668232756L; // co64
+ long CLEAN_APERTURE_BOX = 1668047216L; // clap
+ long COMPACT_SAMPLE_SIZE_BOX = 1937013298L; // stz2
+ long COMPOSITION_TIME_TO_SAMPLE_BOX = 1668576371L; // ctts
+ long COPYRIGHT_BOX = 1668313716L; // cprt
+ long DATA_ENTRY_URN_BOX = 1970433568L; // urn
+ long DATA_ENTRY_URL_BOX = 1970433056L; // url
+ long DATA_INFORMATION_BOX = 1684631142L; // dinf
+ long DATA_REFERENCE_BOX = 1685218662L; // dref
+ long DECODING_TIME_TO_SAMPLE_BOX = 1937011827L; // stts
+ long DEGRADATION_PRIORITY_BOX = 1937007728L; // stdp
+ long EDIT_BOX = 1701082227L; // edts
+ long EDIT_LIST_BOX = 1701606260L; // elst
+ long FD_ITEM_INFORMATION_BOX = 1718184302L; // fiin
+ long FD_SESSION_GROUP_BOX = 1936025458L; // segr
+ long FEC_RESERVOIR_BOX = 1717920626L; // fecr
+ long FILE_PARTITION_BOX = 1718641010L; // fpar
+ long FILE_TYPE_BOX = 1718909296L; // ftyp
+ long FREE_SPACE_BOX = 1718773093L; // free
+ long GROUP_ID_TO_NAME_BOX = 1734964334L; // gitn
+ long HANDLER_BOX = 1751411826L; // hdlr
+ long HINT_MEDIA_HEADER_BOX = 1752000612L; // hmhd
+ long IPMP_CONTROL_BOX = 1768975715L; // ipmc
+ long IPMP_INFO_BOX = 1768778086L; // imif
+ long ITEM_INFORMATION_BOX = 1768517222L; // iinf
+ long ITEM_INFORMATION_ENTRY = 1768842853L; // infe
+ long ITEM_LOCATION_BOX = 1768714083L; // iloc
+ long ITEM_PROTECTION_BOX = 1768977007L; // ipro
+ long MEDIA_BOX = 1835297121L; // mdia
+ long MEDIA_DATA_BOX = 1835295092L; // mdat
+ long MEDIA_HEADER_BOX = 1835296868L; // mdhd
+ long MEDIA_INFORMATION_BOX = 1835626086L; // minf
+ long META_BOX = 1835365473L; // meta
+ long META_BOX_RELATION_BOX = 1835364965L; // mere
+ long MOVIE_BOX = 1836019574L; // moov
+ long MOVIE_EXTENDS_BOX = 1836475768L; // mvex
+ long MOVIE_EXTENDS_HEADER_BOX = 1835362404L; // mehd
+ long MOVIE_FRAGMENT_BOX = 1836019558L; // moof
+ long MOVIE_FRAGMENT_HEADER_BOX = 1835427940L; // mfhd
+ long MOVIE_FRAGMENT_RANDOM_ACCESS_BOX = 1835430497L; // mfra
+ long MOVIE_FRAGMENT_RANDOM_ACCESS_OFFSET_BOX = 1835430511L; // mfro
+ long MOVIE_HEADER_BOX = 1836476516L; // mvhd
+ long NERO_METADATA_TAGS_BOX = 1952540531L; // tags
+ long NULL_MEDIA_HEADER_BOX = 1852663908L; // nmhd
+ long ORIGINAL_FORMAT_BOX = 1718775137L; // frma
+ long PADDING_BIT_BOX = 1885430882L; // padb
+ long PARTITION_ENTRY = 1885431150L; // paen
+ long PIXEL_ASPECT_RATIO_BOX = 1885434736L; // pasp
+ long PRIMARY_ITEM_BOX = 1885959277L; // pitm
+ long PROGRESSIVE_DOWNLOAD_INFORMATION_BOX = 1885628782L; // pdin
+ long PROTECTION_SCHEME_INFORMATION_BOX = 1936289382L; // sinf
+ long SAMPLE_DEPENDENCY_TYPE_BOX = 1935963248L; // sdtp
+ long SAMPLE_DESCRIPTION_BOX = 1937011556L; // stsd
+ long SAMPLE_GROUP_DESCRIPTION_BOX = 1936158820L; // sgpd
+ long SAMPLE_SCALE_BOX = 1937011564L; // stsl
+ long SAMPLE_SIZE_BOX = 1937011578L; // stsz
+ long SAMPLE_TABLE_BOX = 1937007212L; // stbl
+ long SAMPLE_TO_CHUNK_BOX = 1937011555L; // stsc
+ long SAMPLE_TO_GROUP_BOX = 1935828848L; // sbgp
+ long SCHEME_TYPE_BOX = 1935894637L; // schm
+ long SCHEME_INFORMATION_BOX = 1935894633L; // schi
+ long SHADOW_SYNC_SAMPLE_BOX = 1937011560L; // stsh
+ long SKIP_BOX = 1936419184L; // skip
+ long SOUND_MEDIA_HEADER_BOX = 1936549988L; // smhd
+ long SUB_SAMPLE_INFORMATION_BOX = 1937072755L; // subs
+ long SYNC_SAMPLE_BOX = 1937011571L; // stss
+ long TRACK_BOX = 1953653099L; // trak
+ long TRACK_EXTENDS_BOX = 1953654136L; // trex
+ long TRACK_FRAGMENT_BOX = 1953653094L; // traf
+ long TRACK_FRAGMENT_HEADER_BOX = 1952868452L; // tfhd
+ long TRACK_FRAGMENT_RANDOM_ACCESS_BOX = 1952871009L; // tfra
+ long TRACK_FRAGMENT_RUN_BOX = 1953658222L; // trun
+ long TRACK_HEADER_BOX = 1953196132L; // tkhd
+ long TRACK_REFERENCE_BOX = 1953654118L; // tref
+ long TRACK_SELECTION_BOX = 1953719660L; // tsel
+ long USER_DATA_BOX = 1969517665L; // udta
+ long VIDEO_MEDIA_HEADER_BOX = 1986881636L; // vmhd
+ long WIDE_BOX = 2003395685L; // wide
+ long XML_BOX = 2020437024L; // xml
+ // mp4 extension
+ long OBJECT_DESCRIPTOR_BOX = 1768907891L; // iods
+ long SAMPLE_DEPENDENCY_BOX = 1935959408L; // sdep
+ // metadata: id3
+ long ID3_TAG_BOX = 1768174386L; // id32
+ // metadata: itunes
+ long ITUNES_META_LIST_BOX = 1768715124L; // ilst
+ long CUSTOM_ITUNES_METADATA_BOX = 757935405L; // ----
+ long ITUNES_METADATA_BOX = 1684108385L; // data
+ long ITUNES_METADATA_NAME_BOX = 1851878757L; // name
+ long ITUNES_METADATA_MEAN_BOX = 1835360622L; // mean
+ long ALBUM_ARTIST_NAME_BOX = 1631670868L; // aART
+ long ALBUM_ARTIST_SORT_BOX = 1936679265L; // soaa
+ long ALBUM_NAME_BOX = 2841734242L; // ©alb
+ long ALBUM_SORT_BOX = 1936679276L; // soal
+ long ARTIST_NAME_BOX = 2839630420L; // ©ART
+ long ARTIST_SORT_BOX = 1936679282L; // soar
+ long CATEGORY_BOX = 1667331175L; // catg
+ long COMMENTS_BOX = 2841865588L; // ©cmt
+ long COMPILATION_PART_BOX = 1668311404L; // cpil
+ long COMPOSER_NAME_BOX = 2843177588L; // ©wrt
+ long COMPOSER_SORT_BOX = 1936679791L; // soco
+ long COVER_BOX = 1668249202L; // covr
+ long CUSTOM_GENRE_BOX = 2842125678L; // ©gen
+ long DESCRIPTION_BOX = 1684370275L; // desc
+ long DISK_NUMBER_BOX = 1684632427L; // disk
+ long ENCODER_NAME_BOX = 2841996899L; // ©enc
+ long ENCODER_TOOL_BOX = 2842980207L; // ©too
+ long EPISODE_GLOBAL_UNIQUE_ID_BOX = 1701276004L; // egid
+ long GAPLESS_PLAYBACK_BOX = 1885823344L; // pgap
+ long GENRE_BOX = 1735291493L; // gnre
+ long GROUPING_BOX = 2842129008L; // ©grp
+ long HD_VIDEO_BOX = 1751414372L; // hdvd
+ long ITUNES_PURCHASE_ACCOUNT_BOX = 1634748740L; // apID
+ long ITUNES_ACCOUNT_TYPE_BOX = 1634421060L; // akID
+ long ITUNES_CATALOGUE_ID_BOX = 1668172100L; // cnID
+ long ITUNES_COUNTRY_CODE_BOX = 1936083268L; // sfID
+ long KEYWORD_BOX = 1801812343L; // keyw
+ long LONG_DESCRIPTION_BOX = 1818518899L; // ldes
+ long LYRICS_BOX = 2842458482L; // ©lyr
+ long META_TYPE_BOX = 1937009003L; // stik
+ long PODCAST_BOX = 1885565812L; // pcst
+ long PODCAST_URL_BOX = 1886745196L; // purl
+ long PURCHASE_DATE_BOX = 1886745188L; // purd
+ long RATING_BOX = 1920233063L; // rtng
+ long RELEASE_DATE_BOX = 2841928057L; // ©day
+ long REQUIREMENT_BOX = 2842846577L; // ©req
+ long TEMPO_BOX = 1953329263L; // tmpo
+ long TRACK_NAME_BOX = 2842583405L; // ©nam
+ long TRACK_NUMBER_BOX = 1953655662L; // trkn
+ long TRACK_SORT_BOX = 1936682605L; // sonm
+ long TV_EPISODE_BOX = 1953916275L; // tves
+ long TV_EPISODE_NUMBER_BOX = 1953916270L; // tven
+ long TV_NETWORK_NAME_BOX = 1953918574L; // tvnn
+ long TV_SEASON_BOX = 1953919854L; // tvsn
+ long TV_SHOW_BOX = 1953919848L; // tvsh
+ long TV_SHOW_SORT_BOX = 1936683886L; // sosn
+ // metadata: 3gpp
+ long THREE_GPP_ALBUM_BOX = 1634493037L; // albm
+ long THREE_GPP_AUTHOR_BOX = 1635087464L; // auth
+ long THREE_GPP_CLASSIFICATION_BOX = 1668051814L; // clsf
+ long THREE_GPP_DESCRIPTION_BOX = 1685283696L; // dscp
+ long THREE_GPP_KEYWORDS_BOX = 1803122532L; // kywd
+ long THREE_GPP_LOCATION_INFORMATION_BOX = 1819239273L; // loci
+ long THREE_GPP_PERFORMER_BOX = 1885696614L; // perf
+ long THREE_GPP_RECORDING_YEAR_BOX = 2037543523L; // yrrc
+ long THREE_GPP_TITLE_BOX = 1953068140L; // titl
+ // metadata: google/youtube
+ long GOOGLE_HOST_HEADER_BOX = 1735616616L; // gshh
+ long GOOGLE_PING_MESSAGE_BOX = 1735618669L; // gspm
+ long GOOGLE_PING_URL_BOX = 1735618677L; // gspu
+ long GOOGLE_SOURCE_DATA_BOX = 1735619428L; // gssd
+ long GOOGLE_START_TIME_BOX = 1735619444L; // gsst
+ long GOOGLE_TRACK_DURATION_BOX = 1735619684L; // gstd
+ // sample entries
+ long MP4V_SAMPLE_ENTRY = 1836070006L; // mp4v
+ long H263_SAMPLE_ENTRY = 1932670515L; // s263
+ long ENCRYPTED_VIDEO_SAMPLE_ENTRY = 1701733238L; // encv
+ long AVC_SAMPLE_ENTRY = 1635148593L; // avc1
+ long MP4A_SAMPLE_ENTRY = 1836069985L; // mp4a
+ long AC3_SAMPLE_ENTRY = 1633889587L; // ac-3
+ long EAC3_SAMPLE_ENTRY = 1700998451L; // ec-3
+ long DRMS_SAMPLE_ENTRY = 1685220723L; // drms
+ long AMR_SAMPLE_ENTRY = 1935764850L; // samr
+ long AMR_WB_SAMPLE_ENTRY = 1935767394L; // sawb
+ long EVRC_SAMPLE_ENTRY = 1936029283L; // sevc
+ long QCELP_SAMPLE_ENTRY = 1936810864L; // sqcp
+ long SMV_SAMPLE_ENTRY = 1936944502L; // ssmv
+ long ENCRYPTED_AUDIO_SAMPLE_ENTRY = 1701733217L; // enca
+ long MPEG_SAMPLE_ENTRY = 1836070003L; // mp4s
+ long TEXT_METADATA_SAMPLE_ENTRY = 1835365492L; // mett
+ long XML_METADATA_SAMPLE_ENTRY = 1835365496L; // metx
+ long RTP_HINT_SAMPLE_ENTRY = 1920233504L; // rtp
+ long FD_HINT_SAMPLE_ENTRY = 1717858336L; // fdp
+ // codec infos
+ long ESD_BOX = 1702061171L; // esds
+ // video codecs
+ long H263_SPECIFIC_BOX = 1681012275L; // d263
+ long AVC_SPECIFIC_BOX = 1635148611L; // avcC
+ // audio codecs
+ long AC3_SPECIFIC_BOX = 1684103987L; // dac3
+ long EAC3_SPECIFIC_BOX = 1684366131L; // dec3
+ long AMR_SPECIFIC_BOX = 1684106610L; // damr
+ long EVRC_SPECIFIC_BOX = 1684371043L; // devc
+ long QCELP_SPECIFIC_BOX = 1685152624L; // dqcp
+ long SMV_SPECIFIC_BOX = 1685286262L; // dsmv
+ // OMA DRM
+ long OMA_ACCESS_UNIT_FORMAT_BOX = 1868849510L; // odaf
+ long OMA_COMMON_HEADERS_BOX = 1869112434L; // ohdr
+ long OMA_CONTENT_ID_BOX = 1667459428L; // ccid
+ long OMA_CONTENT_OBJECT_BOX = 1868850273L; // odda
+ long OMA_COVER_URI_BOX = 1668706933L; // cvru
+ long OMA_DISCRETE_MEDIA_HEADERS_BOX = 1868851301L; // odhe
+ long OMA_DRM_CONTAINER_BOX = 1868853869L; // odrm
+ long OMA_ICON_URI_BOX = 1768124021L; // icnu
+ long OMA_INFO_URL_BOX = 1768842869L; // infu
+ long OMA_LYRICS_URI_BOX = 1819435893L; // lrcu
+ long OMA_MUTABLE_DRM_INFORMATION_BOX = 1835299433L; // mdri
+ long OMA_KEY_MANAGEMENT_BOX = 1868852077L; // odkm
+ long OMA_RIGHTS_OBJECT_BOX = 1868853858L; // odrb
+ long OMA_TRANSACTION_TRACKING_BOX = 1868854388L; // odtt
+ // iTunes DRM (FairPlay)
+ long FAIRPLAY_USER_ID_BOX = 1970496882L; // user
+ long FAIRPLAY_USER_NAME_BOX = 1851878757L; // name
+ long FAIRPLAY_USER_KEY_BOX = 1801812256L; // key
+ long FAIRPLAY_IV_BOX = 1769367926L; // iviv
+ long FAIRPLAY_PRIVATE_KEY_BOX = 1886546294L; // priv
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/UnknownBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/UnknownBox.java
index 96222e8..57a8fae 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/UnknownBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/UnknownBox.java
@@ -18,6 +18,6 @@ class UnknownBox extends BoxImpl {
@Override
public void decode(MP4Input in) throws IOException {
- //no need to read, box will be skipped
+ // no need to read, box will be skipped
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/Utils.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/Utils.java
index 505f128..8e06f41 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/Utils.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/Utils.java
@@ -5,7 +5,7 @@ public final class Utils {
private static final long UNDETERMINED = 4294967295L;
public static String getLanguageCode(long l) {
- //1 bit padding, 5*3 bits language code (ISO-639-2/T)
+ // 1 bit padding, 5*3 bits language code (ISO-639-2/T)
char[] c = new char[3];
c[0] = (char) (((l >> 10) & 31) + 0x60);
c[1] = (char) (((l >> 5) & 31) + 0x60);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ChapterBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ChapterBox.java
index c62b3c1..c4d5d0e 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ChapterBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ChapterBox.java
@@ -28,7 +28,7 @@ public ChapterBox() {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- in.skipBytes(4); //??
+ in.skipBytes(4); // ??
int count = in.readByte();
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ColorParameterBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ColorParameterBox.java
index ed45e75..5331f99 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ColorParameterBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ColorParameterBox.java
@@ -6,7 +6,7 @@
import net.sourceforge.jaad.mp4.boxes.FullBox;
-//TODO: check decoding, add get-methods
+// TODO: check decoding, add get-methods
public class ColorParameterBox extends FullBox {
private long colorParameterType;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/CopyrightBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/CopyrightBox.java
index 036f758..b35938d 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/CopyrightBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/CopyrightBox.java
@@ -26,7 +26,7 @@ public CopyrightBox() {
public void decode(MP4Input in) throws IOException {
if (parent.getType() == BoxTypes.USER_DATA_BOX) {
super.decode(in);
- //1 bit padding, 5*3 bits language code (ISO-639-2/T)
+ // 1 bit padding, 5*3 bits language code (ISO-639-2/T)
languageCode = Utils.getLanguageCode(in.readBytes(2));
notice = in.readUTFString((int) getLeft(in));
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DataReferenceBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DataReferenceBox.java
index 163e8e0..187610f 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DataReferenceBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DataReferenceBox.java
@@ -28,6 +28,6 @@ public void decode(MP4Input in) throws IOException {
int entryCount = (int) in.readBytes(4);
- readChildren(in, entryCount); //DataEntryUrlBox, DataEntryUrnBox
+ readChildren(in, entryCount); // DataEntryUrlBox, DataEntryUrnBox
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DegradationPriorityBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DegradationPriorityBox.java
index 2fa9742..f4b5060 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DegradationPriorityBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/DegradationPriorityBox.java
@@ -26,7 +26,7 @@ public DegradationPriorityBox() {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- //get number of samples from SampleSizeBox
+ // get number of samples from SampleSizeBox
int sampleCount = ((SampleSizeBox) parent.getChild(BoxTypes.SAMPLE_SIZE_BOX)).getSampleCount();
priorities = new int[sampleCount];
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/EditListBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/EditListBox.java
index 9be6dc4..ad1507e 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/EditListBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/EditListBox.java
@@ -50,8 +50,8 @@ public void decode(MP4Input in) throws IOException {
segmentDuration[i] = in.readBytes(len);
mediaTime[i] = in.readBytes(len);
- //int(16) mediaRate_integer;
- //int(16) media_rate_fraction = 0;
+ // int(16) mediaRate_integer;
+ // int(16) media_rate_fraction = 0;
mediaRate[i] = in.readFixedPoint(16, 16);
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FileTypeBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FileTypeBox.java
index e5d816d..5a546b6 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FileTypeBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FileTypeBox.java
@@ -6,7 +6,7 @@
import net.sourceforge.jaad.mp4.boxes.BoxImpl;
-//TODO: 3gpp brands
+// TODO: 3gpp brands
public class FileTypeBox extends BoxImpl {
public static final String BRAND_ISO_BASE_MEDIA = "isom";
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FreeSpaceBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FreeSpaceBox.java
index f466f66..a78e5be 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FreeSpaceBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/FreeSpaceBox.java
@@ -20,6 +20,6 @@ public FreeSpaceBox() {
@Override
public void decode(MP4Input in) throws IOException {
- //no need to read, box will be skipped
+ // no need to read, box will be skipped
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HandlerBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HandlerBox.java
index d28dcaa..aecb67e 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HandlerBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HandlerBox.java
@@ -24,20 +24,20 @@
*/
public class HandlerBox extends FullBox {
- //ISO BMFF types
- public static final int TYPE_VIDEO = 1986618469; //vide
- public static final int TYPE_SOUND = 1936684398; //soun
- public static final int TYPE_HINT = 1751740020; //hint
- public static final int TYPE_META = 1835365473; //meta
- public static final int TYPE_NULL = 1853189228; //null
- //MP4 types
- public static final int TYPE_ODSM = 1868854125; //odsm
- public static final int TYPE_CRSM = 1668445037; //crsm
- public static final int TYPE_SDSM = 1935962989; //sdsm
- public static final int TYPE_M7SM = 1832350573; //m7sm
- public static final int TYPE_OCSM = 1868788589; //ocsm
- public static final int TYPE_IPSM = 1768977261; //ipsm
- public static final int TYPE_MJSM = 1835692909; //mjsm
+ // ISO BMFF types
+ public static final int TYPE_VIDEO = 1986618469; // vide
+ public static final int TYPE_SOUND = 1936684398; // soun
+ public static final int TYPE_HINT = 1751740020; // hint
+ public static final int TYPE_META = 1835365473; // meta
+ public static final int TYPE_NULL = 1853189228; // null
+ // MP4 types
+ public static final int TYPE_ODSM = 1868854125; // odsm
+ public static final int TYPE_CRSM = 1668445037; // crsm
+ public static final int TYPE_SDSM = 1935962989; // sdsm
+ public static final int TYPE_M7SM = 1832350573; // m7sm
+ public static final int TYPE_OCSM = 1868788589; // ocsm
+ public static final int TYPE_IPSM = 1768977261; // ipsm
+ public static final int TYPE_MJSM = 1835692909; // mjsm
private long handlerType;
private String handlerName;
@@ -49,13 +49,13 @@ public HandlerBox() {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- in.skipBytes(4); //pre-defined: 0
+ in.skipBytes(4); // pre-defined: 0
handlerType = in.readBytes(4);
- in.readBytes(4); //reserved
- in.readBytes(4); //reserved
- in.readBytes(4); //reserved
+ in.readBytes(4); // reserved
+ in.readBytes(4); // reserved
+ in.readBytes(4); // reserved
handlerName = in.readUTFString((int) getLeft(in), MP4Input.UTF8);
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HintMediaHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HintMediaHeaderBox.java
index 552dbc3..df7999c 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HintMediaHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/HintMediaHeaderBox.java
@@ -30,7 +30,7 @@ public void decode(MP4Input in) throws IOException {
maxBitrate = in.readBytes(4);
avgBitrate = in.readBytes(4);
- in.skipBytes(4); //reserved
+ in.skipBytes(4); // reserved
}
/**
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ItemInformationEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ItemInformationEntry.java
index 995bfb6..21e09d8 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ItemInformationEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ItemInformationEntry.java
@@ -29,7 +29,7 @@ public void decode(MP4Input in) throws IOException {
contentEncoding = in.readUTFString((int) getLeft(in), MP4Input.UTF8); // optional
}
if (version == 1 && getLeft(in) > 0) {
- //optional
+ // optional
extensionType = in.readBytes(4);
if (getLeft(in) > 0) {
extension = Extension.forType((int) extensionType);
@@ -116,7 +116,7 @@ public Extension getExtension() {
public abstract static class Extension {
- private static final int TYPE_FDEL = 1717855596; //fdel
+ private static final int TYPE_FDEL = 1717855596; // fdel
static Extension forType(int type) {
Extension ext;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaDataBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaDataBox.java
index 7ee66a0..5693a83 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaDataBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaDataBox.java
@@ -25,6 +25,6 @@ public MediaDataBox() {
@Override
public void decode(MP4Input in) throws IOException {
- //if random access: skip, else: do nothing
+ // if random access: skip, else: do nothing
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaHeaderBox.java
index fa29530..3cabc14 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MediaHeaderBox.java
@@ -32,7 +32,7 @@ public void decode(MP4Input in) throws IOException {
language = Utils.getLanguageCode(in.readBytes(2));
- in.skipBytes(2); //pre-defined: 0
+ in.skipBytes(2); // pre-defined: 0
}
/**
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MetaBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MetaBox.java
index 17fa51f..15fbe5b 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MetaBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MetaBox.java
@@ -9,7 +9,7 @@
import net.sourceforge.jaad.mp4.boxes.FullBox;
-//needs to be defined, because readChildren() is not called by factory
+// needs to be defined, because readChildren() is not called by factory
/* TODO: this class shouldn't be needed. at least here, things become too
complicated. change this!!! */
public class MetaBox extends FullBox {
@@ -37,12 +37,12 @@ protected Box parseBox(MP4Input in) throws IOException {
// Indication of it that size already contains the type.
// Shift back all parameters by 4 bytes: type <- size <- version:flags <- 0
- if(children.isEmpty() && size==BoxTypes.HANDLER_BOX) {
+ if (children.isEmpty() && size == BoxTypes.HANDLER_BOX) {
offset -= 4;
type = size;
- size = (version&(2L*Integer.MAX_VALUE+1))<<24;
+ size = (version & (2L * Integer.MAX_VALUE + 1)) << 24;
size += flags;
- version=flags=0;
+ version = flags = 0;
}
return BoxFactory.parseBox(this, offset, size, type, in);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MovieHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MovieHeaderBox.java
index 46e7d7a..c2f6bd1 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MovieHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/MovieHeaderBox.java
@@ -37,14 +37,14 @@ public void decode(MP4Input in) throws IOException {
rate = in.readFixedPoint(16, 16);
volume = in.readFixedPoint(8, 8);
- in.skipBytes(10); //reserved
+ in.skipBytes(10); // reserved
for (int i = 0; i < 9; i++) {
if (i < 6) matrix[i] = in.readFixedPoint(16, 16);
else matrix[i] = in.readFixedPoint(2, 30);
}
- in.skipBytes(24); //reserved
+ in.skipBytes(24); // reserved
nextTrackID = in.readBytes(4);
}
@@ -94,7 +94,7 @@ public long getDuration() {
}
/**
- * The rate is a floting point number that indicates the preferred rate
+ * The rate is a floating point number that indicates the preferred rate
* to play the presentation; 1.0 is normal forward playback
*
* @return the playback rate
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/PaddingBitBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/PaddingBitBox.java
index 67f8e28..3cec2c8 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/PaddingBitBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/PaddingBitBox.java
@@ -33,11 +33,11 @@ public void decode(MP4Input in) throws IOException {
byte b;
for (int i = 0; i < sampleCount; i++) {
b = (byte) in.readByte();
- //1 bit reserved
- //3 bits pad1
+ // 1 bit reserved
+ // 3 bits pad1
pad1[i] = (b >> 4) & 7;
- //1 bit reserved
- //3 bits pad2
+ // 1 bit reserved
+ // 3 bits pad2
pad2[i] = b & 7;
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleDependencyTypeBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleDependencyTypeBox.java
index 8508338..cef2a18 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleDependencyTypeBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleDependencyTypeBox.java
@@ -52,12 +52,12 @@ public SampleDependencyTypeBox() {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- //get number of samples from SampleSizeBox
+ // get number of samples from SampleSizeBox
long sampleCount = -1;
if (parent.hasChild(BoxTypes.SAMPLE_SIZE_BOX))
sampleCount = ((SampleSizeBox) parent.getChild(BoxTypes.SAMPLE_SIZE_BOX)).getSampleCount();
- //TODO: uncomment when CompactSampleSizeBox is implemented
- //else if(parent.containsChild(BoxTypes.COMPACT_SAMPLE_SIZE_BOX)) sampleCount = ((CompactSampleSizeBox)parent.getChild(BoxTypes.SAMPLE_SIZE_BOX)).getSampleSize();
+ // TODO: uncomment when CompactSampleSizeBox is implemented
+ // else if(parent.containsChild(BoxTypes.COMPACT_SAMPLE_SIZE_BOX)) sampleCount = ((CompactSampleSizeBox)parent.getChild(BoxTypes.SAMPLE_SIZE_BOX)).getSampleSize();
sampleHasRedundancy = new int[(int) sampleCount];
sampleIsDependedOn = new int[(int) sampleCount];
sampleDependsOn = new int[(int) sampleCount];
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleGroupDescriptionBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleGroupDescriptionBox.java
index 4b7a01e..86d61cf 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleGroupDescriptionBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleGroupDescriptionBox.java
@@ -45,36 +45,36 @@ public void decode(MP4Input in) throws IOException {
int entryCount = (int) in.readBytes(4);
- //TODO!
- /*final HandlerBox hdlr = (HandlerBox) parent.getParent().getParent().getChild(BoxTypes.HANDLER_BOX);
- final int handlerType = (int) hdlr.getHandlerType();
-
- final Class extends BoxImpl> boxClass;
- switch(handlerType) {
- case HandlerBox.TYPE_VIDEO:
- boxClass = VisualSampleGroupEntry.class;
- break;
- case HandlerBox.TYPE_SOUND:
- boxClass = AudioSampleGroupEntry.class;
- break;
- case HandlerBox.TYPE_HINT:
- boxClass = HintSampleGroupEntry.class;
- break;
- default:
- boxClass = null;
- }
-
- for(int i = 1; i boxClass;
+// switch (handlerType) {
+// case HandlerBox.TYPE_VIDEO:
+// boxClass = VisualSampleGroupEntry.class;
+// break;
+// case HandlerBox.TYPE_SOUND:
+// boxClass = AudioSampleGroupEntry.class;
+// break;
+// case HandlerBox.TYPE_HINT:
+// boxClass = HintSampleGroupEntry.class;
+// break;
+// default:
+// boxClass = null;
+// }
+//
+// for (int i = 1; i < entryCount; i++) {
+// if (version == 1 && defaultLength == 0) {
+// descriptionLength = in.readBytes(4);
+// left -= 4;
+// }
+// if (boxClass != null) {
+// entries[i] = (SampleGroupDescriptionEntry) BoxFactory.parseBox(in, boxClass);
+// if (entries[i] != null)
+// left -= entries[i].getSize();
+// }
+// }
}
/**
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleScaleBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleScaleBox.java
index 0d8a256..9c62039 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleScaleBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleScaleBox.java
@@ -43,7 +43,7 @@ public SampleScaleBox() {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- //7 bits reserved, 1 bit flag
+ // 7 bits reserved, 1 bit flag
constrained = (in.readByte() & 1) == 1;
scaleMethod = in.readByte();
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleSizeBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleSizeBox.java
index ade73b7..8444571 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleSizeBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SampleSizeBox.java
@@ -33,7 +33,7 @@ public void decode(MP4Input in) throws IOException {
sampleSizes = new long[(int) sampleCount];
if (compact) {
- //compact: sampleSize can be 4, 8 or 16 bits
+ // compact: sampleSize can be 4, 8 or 16 bits
if (sampleSize == 4) {
int x;
for (int i = 0; i < sampleCount; i += 2) {
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SchemeTypeBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SchemeTypeBox.java
index 38f5628..946e410 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SchemeTypeBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SchemeTypeBox.java
@@ -13,7 +13,7 @@
*/
public class SchemeTypeBox extends FullBox {
- public static final long ITUNES_SCHEME = 1769239918; //itun
+ public static final long ITUNES_SCHEME = 1769239918; // itun
private long schemeType, schemeVersion;
private String schemeURI;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ShadowSyncSampleBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ShadowSyncSampleBox.java
index 11c8b7f..dfd2152 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ShadowSyncSampleBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/ShadowSyncSampleBox.java
@@ -16,7 +16,7 @@
* a shadow sync will be defined for. This should always be a non-sync sample
* (e.g. a frame difference). The second sample number (sync-sample-number)
* indicates the sample number of the sync sample (i.e. key frame) that can be
- * used when there is a random access at, or before, the shadowed-sample-number.
+ * used when there is random access at, or before, the shadowed-sample-number.
*
* The entries in the ShadowSyncBox shall be sorted based on the
* shadowed-sample-number field. The shadow sync samples are normally placed in
@@ -54,8 +54,8 @@ public void decode(MP4Input in) throws IOException {
sampleNumbers = new long[entryCount][2];
for (int i = 0; i < entryCount; i++) {
- sampleNumbers[i][0] = in.readBytes(4); //shadowedSampleNumber;
- sampleNumbers[i][1] = in.readBytes(4); //syncSampleNumber;
+ sampleNumbers[i][0] = in.readBytes(4); // shadowedSampleNumber;
+ sampleNumbers[i][1] = in.readBytes(4); // syncSampleNumber;
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SoundMediaHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SoundMediaHeaderBox.java
index 9698ce7..dc9f3a6 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SoundMediaHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SoundMediaHeaderBox.java
@@ -26,7 +26,7 @@ public void decode(MP4Input in) throws IOException {
super.decode(in);
balance = in.readFixedPoint(8, 8);
- in.skipBytes(2); //reserved
+ in.skipBytes(2); // reserved
}
/**
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SubSampleInformationBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SubSampleInformationBox.java
index 8124d7f..0a63cfd 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SubSampleInformationBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/SubSampleInformationBox.java
@@ -54,7 +54,7 @@ public void decode(MP4Input in) throws IOException {
subsampleSize[i][j] = in.readBytes(len);
subsamplePriority[i][j] = in.readByte();
discardable[i][j] = (in.readByte() & 1) == 1;
- in.skipBytes(4); //reserved
+ in.skipBytes(4); // reserved
}
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentHeaderBox.java
index f251121..838e4fc 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentHeaderBox.java
@@ -33,7 +33,7 @@ public void decode(MP4Input in) throws IOException {
trackID = in.readBytes(4);
- //optional fields
+ // optional fields
baseDataOffsetPresent = ((flags & 1) == 1);
baseDataOffset = baseDataOffsetPresent ? in.readBytes(8) : 0;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRandomAccessBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRandomAccessBox.java
index dacc9be..ececd7c 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRandomAccessBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRandomAccessBox.java
@@ -21,7 +21,7 @@ public void decode(MP4Input in) throws IOException {
super.decode(in);
trackID = in.readBytes(4);
- //26 bits reserved, 2 bits trafSizeLen, 2 bits trunSizeLen, 2 bits sampleSizeLen
+ // 26 bits reserved, 2 bits trafSizeLen, 2 bits trunSizeLen, 2 bits sampleSizeLen
long l = in.readBytes(4);
int trafNumberLen = (int) ((l >> 4) & 0x3) + 1;
int trunNumberLen = (int) ((l >> 2) & 0x3) + 1;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRunBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRunBox.java
index b1ee2da..95b52c2 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRunBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackFragmentRunBox.java
@@ -39,14 +39,14 @@ public void decode(MP4Input in) throws IOException {
sampleCount = (int) in.readBytes(4);
- //optional fields
+ // optional fields
dataOffsetPresent = ((flags & 1) == 1);
if (dataOffsetPresent) dataOffset = in.readBytes(4);
firstSampleFlagsPresent = ((flags & 4) == 4);
if (firstSampleFlagsPresent) firstSampleFlags = in.readBytes(4);
- //all fields are optional
+ // all fields are optional
sampleDurationPresent = ((flags & 0x100) == 0x100);
if (sampleDurationPresent) sampleDuration = new long[sampleCount];
sampleSizePresent = ((flags & 0x200) == 0x200);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackHeaderBox.java
index c97ca55..b2bedb3 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/TrackHeaderBox.java
@@ -49,16 +49,16 @@ public void decode(MP4Input in) throws IOException {
creationTime = in.readBytes(len);
modificationTime = in.readBytes(len);
trackID = (int) in.readBytes(4);
- in.skipBytes(4); //reserved
+ in.skipBytes(4); // reserved
duration = Utils.detectUndetermined(in.readBytes(len));
- in.skipBytes(8); //reserved
+ in.skipBytes(8); // reserved
layer = (int) in.readBytes(2);
alternateGroup = (int) in.readBytes(2);
volume = in.readFixedPoint(8, 8);
- in.skipBytes(2); //reserved
+ in.skipBytes(2); // reserved
for (int i = 0; i < 9; i++) {
if (i < 6) matrix[i] = in.readFixedPoint(16, 16);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/VideoMediaHeaderBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/VideoMediaHeaderBox.java
index 1511cb6..3d1d991 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/VideoMediaHeaderBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/VideoMediaHeaderBox.java
@@ -27,7 +27,7 @@ public void decode(MP4Input in) throws IOException {
super.decode(in);
graphicsMode = in.readBytes(2);
- //6 byte RGB color
+ // 6 byte RGB color
int[] c = new int[3];
for (int i = 0; i < 3; i++) {
c[i] = (in.readByte() & 0xFF) | ((in.readByte() << 8) & 0xFF);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/Base64Decoder.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/Base64Decoder.java
index cd39604..cd33897 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/Base64Decoder.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/Base64Decoder.java
@@ -24,7 +24,7 @@ class Base64Decoder {
'w', 'x', 'y', 'z', '0', '1', '2', '3', // 6
'4', '5', '6', '7', '8', '9', '+', '/' // 7
};*/
- //CHAR_CONVERT_ARRAY[CHAR_ARRAY[i]] = i;
+ // CHAR_CONVERT_ARRAY[CHAR_ARRAY[i]] = i;
private static final byte[] CHAR_CONVERT_ARRAY = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FDItemInformationBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FDItemInformationBox.java
index 19535cb..6bb573b 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FDItemInformationBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FDItemInformationBox.java
@@ -29,8 +29,8 @@ public void decode(MP4Input in) throws IOException {
super.decode(in);
int entryCount = (int) in.readBytes(2);
- readChildren(in, entryCount); //partition entries
+ readChildren(in, entryCount); // partition entries
- readChildren(in); //FDSessionGroupBox and GroupIDToNameBox
+ readChildren(in); // FDSessionGroupBox and GroupIDToNameBox
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FilePartitionBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FilePartitionBox.java
index c029b08..e4a96af 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FilePartitionBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/FilePartitionBox.java
@@ -24,7 +24,7 @@ public void decode(MP4Input in) throws IOException {
itemID = (int) in.readBytes(2);
packetPayloadSize = (int) in.readBytes(2);
- in.skipBytes(1); //reserved
+ in.skipBytes(1); // reserved
fecEncodingID = in.readByte();
fecInstanceID = (int) in.readBytes(2);
maxSourceBlockLength = (int) in.readBytes(2);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/GenreBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/GenreBox.java
index 58c9110..4841d38 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/GenreBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/GenreBox.java
@@ -19,7 +19,7 @@ public GenreBox() {
@Override
public void decode(MP4Input in) throws IOException {
- //3gpp or iTunes
+ // 3gpp or iTunes
if (parent.getType() == BoxTypes.USER_DATA_BOX) {
super.decode(in);
languageCode = Utils.getLanguageCode(in.readBytes(2));
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ID3TagBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ID3TagBox.java
index 8cc7bf1..8fb6e52 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ID3TagBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ID3TagBox.java
@@ -7,7 +7,7 @@
import net.sourceforge.jaad.mp4.boxes.Utils;
-//TODO: use nio ByteBuffer instead of array
+// TODO: use nio ByteBuffer instead of array
public class ID3TagBox extends FullBox {
private String language;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ITunesMetadataBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ITunesMetadataBox.java
index 1921beb..3af133d 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ITunesMetadataBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/ITunesMetadataBox.java
@@ -77,7 +77,7 @@ public void decode(MP4Input in) throws IOException {
dataType = DataType.forInt(flags);
- in.skipBytes(4); //padding?
+ in.skipBytes(4); // padding?
data = new byte[(int) getLeft(in)];
in.readBytes(data);
@@ -103,7 +103,7 @@ public byte[] getData() {
* @return the metadata as text
*/
public String getText() {
- //first four bytes are padding (zero)
+ // first four bytes are padding (zero)
return new String(data, StandardCharsets.UTF_8);
}
@@ -113,7 +113,7 @@ public String getText() {
* @return the metadata as an integer
*/
public long getNumber() {
- //first four bytes are padding (zero)
+ // first four bytes are padding (zero)
long l = 0;
for (byte datum : data) {
l <<= 8;
@@ -136,7 +136,7 @@ public boolean getBoolean() {
}
public Date getDate() {
- //timestamp lengths: 4,7,9
+ // timestamp lengths: 4,7,9
int i = (int) Math.floor(data.length / 3f) - 1;
Date date;
if (i >= 0 && i < TIMESTAMPS.length) {
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/NeroMetadataTagsBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/NeroMetadataTagsBox.java
index 97b0549..b57ce12 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/NeroMetadataTagsBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/meta/NeroMetadataTagsBox.java
@@ -20,15 +20,15 @@ public NeroMetadataTagsBox() {
@Override
public void decode(MP4Input in) throws IOException {
- in.skipBytes(12); //meta box
+ in.skipBytes(12); // meta box
String key, val;
int len;
- //TODO: what are the other skipped fields for?
+ // TODO: what are the other skipped fields for?
while (getLeft(in) > 0 && in.readByte() == 0x80) {
- in.skipBytes(2); //x80 x00 x06/x05
+ in.skipBytes(2); // x80 x00 x06/x05
key = in.readUTFString((int) getLeft(in), MP4InputStream.UTF8);
- in.skipBytes(4); //0x00 0x01 0x00 0x00 0x00
+ in.skipBytes(4); // 0x00 0x01 0x00 0x00 0x00
len = in.readByte();
val = in.readString(len);
pairs.put(key, val);
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMAAccessUnitFormatBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMAAccessUnitFormatBox.java
index f8a2652..9692f62 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMAAccessUnitFormatBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMAAccessUnitFormatBox.java
@@ -19,9 +19,9 @@ public OMAAccessUnitFormatBox() {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- //1 bit selective encryption, 7 bits reserved
+ // 1 bit selective encryption, 7 bits reserved
selectiveEncrypted = ((in.readByte() >> 7) & 1) == 1;
- keyIndicatorLength = in.readByte(); //always zero?
+ keyIndicatorLength = in.readByte(); // always zero?
initialVectorLength = in.readByte();
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMACommonHeadersBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMACommonHeadersBox.java
index b7ab684..e26eece 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMACommonHeadersBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/oma/OMACommonHeadersBox.java
@@ -8,7 +8,7 @@
import net.sourceforge.jaad.mp4.boxes.FullBox;
-//TODO: add remaining javadoc
+// TODO: add remaining javadoc
public class OMACommonHeadersBox extends FullBox {
private int encryptionMethod, paddingScheme;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/AudioSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/AudioSampleEntry.java
index 15687d1..7dca858 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/AudioSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/AudioSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
@@ -37,13 +37,13 @@ public AudioSampleEntry(String name) {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- in.skipBytes(8); //reserved
+ in.skipBytes(8); // reserved
channelCount = (int) in.readBytes(2);
sampleSize = (int) in.readBytes(2);
- in.skipBytes(2); //pre-defined: 0
- in.skipBytes(2); //reserved
+ in.skipBytes(2); // pre-defined: 0
+ in.skipBytes(2); // reserved
sampleRate = (int) in.readBytes(2);
- in.skipBytes(2); //not used by samplerate
+ in.skipBytes(2); // not used by samplerate
readChildren(in);
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/FDHintSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/FDHintSampleEntry.java
index e11a6cf..1e0dbd0 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/FDHintSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/FDHintSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MPEGSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MPEGSampleEntry.java
index dd5de4b..812fdd8 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MPEGSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MPEGSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MetadataSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MetadataSampleEntry.java
index 943e4b3..619fbf6 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MetadataSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/MetadataSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/RTPHintSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/RTPHintSampleEntry.java
index f8bf86c..21c61db 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/RTPHintSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/RTPHintSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/SampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/SampleEntry.java
index 614e5d1..b75d227 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/SampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/SampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
@@ -36,7 +36,7 @@ protected SampleEntry(String name) {
@Override
public void decode(MP4Input in) throws IOException {
- in.skipBytes(6); //reserved
+ in.skipBytes(6); // reserved
dataReferenceIndex = in.readBytes(2);
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/TextMetadataSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/TextMetadataSampleEntry.java
index 1523f71..cc82e60 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/TextMetadataSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/TextMetadataSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/VideoSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/VideoSampleEntry.java
index 8bc8244..eada11c 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/VideoSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/VideoSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
@@ -40,18 +40,18 @@ public VideoSampleEntry(String name) {
public void decode(MP4Input in) throws IOException {
super.decode(in);
- in.skipBytes(2); //pre-defined: 0
- in.skipBytes(2); //reserved
- //3x32 pre_defined
- in.skipBytes(4); //pre-defined: 0
- in.skipBytes(4); //pre-defined: 0
- in.skipBytes(4); //pre-defined: 0
+ in.skipBytes(2); // pre-defined: 0
+ in.skipBytes(2); // reserved
+ // 3x32 pre_defined
+ in.skipBytes(4); // pre-defined: 0
+ in.skipBytes(4); // pre-defined: 0
+ in.skipBytes(4); // pre-defined: 0
width = (int) in.readBytes(2);
height = (int) in.readBytes(2);
horizontalResolution = in.readFixedPoint(16, 16);
verticalResolution = in.readFixedPoint(16, 16);
- in.skipBytes(4); //reserved
+ in.skipBytes(4); // reserved
frameCount = (int) in.readBytes(2);
int len = in.readByte();
@@ -59,7 +59,7 @@ public void decode(MP4Input in) throws IOException {
in.skipBytes(31 - len);
depth = (int) in.readBytes(2);
- in.skipBytes(2); //pre-defined: -1
+ in.skipBytes(2); // pre-defined: -1
readChildren(in);
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/XMLMetadataSampleEntry.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/XMLMetadataSampleEntry.java
index c51d472..f3e5438 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/XMLMetadataSampleEntry.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/XMLMetadataSampleEntry.java
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
- * If not, see .
+ * If not, see .
*/
package net.sourceforge.jaad.mp4.boxes.impl.sampleentries;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AC3SpecificBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AC3SpecificBox.java
index 8203a9c..d0f885b 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AC3SpecificBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AC3SpecificBox.java
@@ -8,8 +8,8 @@
/**
* This box contains parameters for AC-3 decoders. For more information see the
* AC-3 specification "ETSI TS 102 366 V1.2.1 (2008-08)
" at
- *
+ * http:// www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.02.01_60/ts_102366v010201p.pdf.
*
* @author in-somnia
*/
@@ -26,19 +26,19 @@ public AC3SpecificBox() {
public void decode(MP4Input in) throws IOException {
long l = in.readBytes(3);
- //2 bits fscod
+ // 2 bits fscod
fscod = (int) ((l >> 22) & 0x3);
- //5 bits bsid
+ // 5 bits bsid
bsid = (int) ((l >> 17) & 0x1F);
- //3 bits bsmod
+ // 3 bits bsmod
bsmod = (int) ((l >> 14) & 0x7);
- //3 bits acmod
+ // 3 bits acmod
acmod = (int) ((l >> 11) & 0x7);
- //1 bit lfeon
+ // 1 bit lfeon
lfeon = ((l >> 10) & 0x1) == 1;
- //5 bits bitRateCode
+ // 5 bits bitRateCode
bitRateCode = (int) ((l >> 5) & 0x1F);
- //5 bits reserved
+ // 5 bits reserved
}
/**
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AVCSpecificBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AVCSpecificBox.java
index 041a60b..3121bc1 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AVCSpecificBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/AVCSpecificBox.java
@@ -5,7 +5,7 @@
import net.sourceforge.jaad.mp4.MP4Input;
-//defined in ISO 14496-15 as 'AVC Configuration Record'
+// defined in ISO 14496-15 as 'AVC Configuration Record'
public class AVCSpecificBox extends CodecSpecificBox {
private int configurationVersion, profile, level, lengthSize;
@@ -22,11 +22,11 @@ public void decode(MP4Input in) throws IOException {
profile = in.readByte();
profileCompatibility = (byte) in.readByte();
level = in.readByte();
- //6 bits reserved, 2 bits 'length size minus one'
+ // 6 bits reserved, 2 bits 'length size minus one'
lengthSize = (in.readByte() & 3) + 1;
int len;
- //3 bits reserved, 5 bits number of sequence parameter sets
+ // 3 bits reserved, 5 bits number of sequence parameter sets
int sequenceParameterSets = in.readByte() & 31;
sequenceParameterSetNALUnit = new byte[sequenceParameterSets][];
diff --git a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/EAC3SpecificBox.java b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/EAC3SpecificBox.java
index 7b67192..de03fad 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/EAC3SpecificBox.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/boxes/impl/sampleentries/codec/EAC3SpecificBox.java
@@ -8,8 +8,8 @@
/**
* This box contains parameters for Extended AC-3 decoders. For more information
* see the AC-3 specification "ETSI TS 102 366 V1.2.1 (2008-08)
" at
- *
+ * http:// www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.02.01_60/ts_102366v010201p.pdf.
*
* @author in-somnia
*/
@@ -26,32 +26,32 @@ public EAC3SpecificBox() {
@Override
public void decode(MP4Input in) throws IOException {
long l = in.readBytes(2);
- //13 bits dataRate
+ // 13 bits dataRate
dataRate = (int) ((l >> 3) & 0x1FFF);
- //3 bits number of independent substreams
+ // 3 bits number of independent substreams
independentSubstreamCount = (int) (l & 0x7);
for (int i = 0; i < independentSubstreamCount; i++) {
l = in.readBytes(3);
- //2 bits fscod
+ // 2 bits fscod
fscods[i] = (int) ((l >> 22) & 0x3);
- //5 bits bsid
+ // 5 bits bsid
bsids[i] = (int) ((l >> 17) & 0x1F);
- //5 bits bsmod
+ // 5 bits bsmod
bsmods[i] = (int) ((l >> 12) & 0x1F);
- //3 bits acmod
+ // 3 bits acmod
acmods[i] = (int) ((l >> 9) & 0x7);
- //3 bits reserved
- //1 bit lfeon
+ // 3 bits reserved
+ // 1 bit lfeon
lfeons[i] = ((l >> 5) & 0x1) == 1;
- //4 bits number of dependent substreams
+ // 4 bits number of dependent substreams
dependentSubstreamCount[i] = (int) ((l >> 1) & 0xF);
if (dependentSubstreamCount[i] > 0) {
- //9 bits dependent substream location
+ // 9 bits dependent substream location
l = (l << 8) | in.readByte();
dependentSubstreamLocation[i] = (int) (l & 0x1FF);
}
- //else: 1 bit reserved
+ // else: 1 bit reserved
}
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/DecoderConfigDescriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/DecoderConfigDescriptor.java
index 500cb26..794b744 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/DecoderConfigDescriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/DecoderConfigDescriptor.java
@@ -22,9 +22,10 @@ public class DecoderConfigDescriptor extends Descriptor {
private boolean upstream;
private long maxBitRate, averageBitRate;
+ @Override
void decode(MP4Input in) throws IOException {
objectProfile = in.readByte();
- //6 bits stream type, 1 bit upstream flag, 1 bit reserved
+ // 6 bits stream type, 1 bit upstream flag, 1 bit reserved
int x = in.readByte();
streamType = (x >> 2) & 0x3F;
upstream = ((x >> 1) & 1) == 1;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/DecoderSpecificInfo.java b/src/main/java/net/sourceforge/jaad/mp4/od/DecoderSpecificInfo.java
index b3c2950..ef0d5b8 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/DecoderSpecificInfo.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/DecoderSpecificInfo.java
@@ -7,7 +7,7 @@
/**
* The DecoderSpecificInfo
constitutes an opaque container with
- * information for a specific media decoder. Depending on the required amout of
+ * information for a specific media decoder. Depending on the required amount of
* data, two classes with a maximum of 255 and 232-1 bytes of data
* are provided. The existence and semantics of the
* DecoderSpecificInfo
depends on the stream type and object
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/Descriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/Descriptor.java
index 582a168..4d0d89b 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/Descriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/Descriptor.java
@@ -18,7 +18,7 @@
*/
public abstract class Descriptor {
- static final Logger LOGGER = Logger.getLogger(Descriptor.class.getName());
+ static final Logger LOGGER = Logger.getLogger(Descriptor.class.getName());
public static final int TYPE_OBJECT_DESCRIPTOR = 1;
public static final int TYPE_INITIAL_OBJECT_DESCRIPTOR = 2;
@@ -30,7 +30,7 @@ public abstract class Descriptor {
public static final int TYPE_MP4_INITIAL_OBJECT_DESCRIPTOR = 16;
public static Descriptor createDescriptor(MP4Input in) throws IOException {
- //read tag and size
+ // read tag and size
int type = in.readByte();
int read = 1;
int size = 0;
@@ -43,21 +43,21 @@ public static Descriptor createDescriptor(MP4Input in) throws IOException {
}
while ((b & 0x80) == 0x80);
- //create descriptor
+ // create descriptor
Descriptor desc = forTag(type);
desc.type = type;
desc.size = size;
desc.start = in.getOffset();
- //decode
+ // decode
desc.decode(in);
- //skip remaining bytes
+ // skip remaining bytes
long remaining = size - (in.getOffset() - desc.start);
if (remaining > 0) {
Logger.getLogger("MP4 Boxes").log(Level.FINE, "Descriptor: bytes left: {0}, offset: {1}", new Long[] {remaining, in.getOffset()});
in.skipBytes(remaining);
}
- desc.size += read; //include type and size fields
+ desc.size += read; // include type and size fields
return desc;
}
@@ -82,8 +82,8 @@ private static Descriptor forTag(int tag) {
desc = new DecoderSpecificInfo();
break;
case TYPE_SL_CONFIG_DESCRIPTOR:
- //desc = new SLConfigDescriptor();
- //break;
+// desc = new SLConfigDescriptor();
+// break;
default:
Logger.getLogger("MP4 Boxes").log(Level.FINE, "Unknown descriptor type: {0}", tag);
desc = new UnknownDescriptor();
@@ -101,7 +101,7 @@ protected Descriptor() {
abstract void decode(MP4Input in) throws IOException;
- //children
+ // children
protected void readChildren(MP4Input in) throws IOException {
Descriptor desc;
while ((size - (in.getOffset() - start)) > 0) {
@@ -114,7 +114,7 @@ public List getChildren() {
return Collections.unmodifiableList(children);
}
- //getter
+ // getter
public int getType() {
return type;
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/ESDescriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/ESDescriptor.java
index f5b8ed2..84e46e8 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/ESDescriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/ESDescriptor.java
@@ -29,10 +29,11 @@ public class ESDescriptor extends Descriptor {
private boolean streamDependency, urlPresent, ocrPresent;
private String url;
+ @Override
void decode(MP4Input in) throws IOException {
esID = (int) in.readBytes(2);
- //1 bit stream dependence flag, 1 it url flag, 1 reserved, 5 bits stream priority
+ // 1 bit stream dependence flag, 1 it url flag, 1 reserved, 5 bits stream priority
int flags = in.readByte();
streamDependency = ((flags >> 7) & 1) == 1;
urlPresent = ((flags >> 6) & 1) == 1;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/InitialObjectDescriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/InitialObjectDescriptor.java
index 074356c..1874e60 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/InitialObjectDescriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/InitialObjectDescriptor.java
@@ -21,8 +21,8 @@ public class InitialObjectDescriptor extends Descriptor {
@Override
void decode(MP4Input in) throws IOException {
- //10 bits objectDescriptorID, 1 bit url flag, 1 bit
- //includeInlineProfiles flag, 4 bits reserved
+ // 10 bits objectDescriptorID, 1 bit url flag, 1 bit
+ // includeInlineProfiles flag, 4 bits reserved
int x = (int) in.readBytes(2);
objectDescriptorID = (x >> 6) & 0x3FF;
urlPresent = ((x >> 5) & 1) == 1;
@@ -93,7 +93,7 @@ public boolean areProfilesPresent() {
return !urlPresent;
}
- //TODO: javadoc
+ // TODO: javadoc
public int getODProfile() {
return odProfile;
}
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/ObjectDescriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/ObjectDescriptor.java
index 13ff42f..dd823ce 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/ObjectDescriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/ObjectDescriptor.java
@@ -29,8 +29,9 @@ public class ObjectDescriptor extends Descriptor {
private boolean urlPresent;
private String url;
+ @Override
void decode(MP4Input in) throws IOException {
- //10 bits objectDescriptorID, 1 bit url flag, 5 bits reserved
+ // 10 bits objectDescriptorID, 1 bit url flag, 5 bits reserved
int x = (int) in.readBytes(2);
objectDescriptorID = (x >> 6) & 0x3FF;
urlPresent = ((x >> 5) & 1) == 1;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/SLConfigDescriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/SLConfigDescriptor.java
index 3603f63..d0f52a6 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/SLConfigDescriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/SLConfigDescriptor.java
@@ -5,8 +5,8 @@
import net.sourceforge.jaad.mp4.MP4Input;
-//ISO 14496-1 - 10.2.3
-//TODO: not working: reads too much! did the specification change?
+// ISO 14496-1 - 10.2.3
+// TODO: not working: reads too much! did the specification change?
public class SLConfigDescriptor extends Descriptor {
private boolean useAccessUnitStart, useAccessUnitEnd, useRandomAccessPoint,
@@ -26,7 +26,7 @@ void decode(MP4Input in) throws IOException {
boolean predefined = in.readByte() == 1;
if (!predefined) {
- //flags
+ // flags
tmp = in.readByte();
useAccessUnitStart = ((tmp >> 7) & 1) == 1;
useAccessUnitEnd = ((tmp >> 6) & 1) == 1;
diff --git a/src/main/java/net/sourceforge/jaad/mp4/od/UnknownDescriptor.java b/src/main/java/net/sourceforge/jaad/mp4/od/UnknownDescriptor.java
index 6944f4e..374ada9 100644
--- a/src/main/java/net/sourceforge/jaad/mp4/od/UnknownDescriptor.java
+++ b/src/main/java/net/sourceforge/jaad/mp4/od/UnknownDescriptor.java
@@ -15,6 +15,6 @@ public class UnknownDescriptor extends Descriptor {
@Override
void decode(MP4Input in) throws IOException {
- //content will be skipped
+ // content will be skipped
}
}
diff --git a/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioFileReader.java b/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioFileReader.java
index bb9902e..d0d2642 100644
--- a/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioFileReader.java
+++ b/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioFileReader.java
@@ -35,6 +35,7 @@ public class AACAudioFileReader extends AudioFileReader {
public static final AudioFormat.Encoding AAC_ENCODING = new AudioFormat.Encoding("AAC");
private static class LimitedInputStream extends FilterInputStream {
+
static final String ERROR_MESSAGE_REACHED_TO_LIMIT = "stop reading, prevent form eof";
protected LimitedInputStream(InputStream in) throws IOException {
@@ -76,49 +77,44 @@ public long skip(long n) throws IOException {
@Override
public AudioFileFormat getAudioFileFormat(InputStream in) throws UnsupportedAudioFileException, IOException {
- try {
- if (!in.markSupported()) in = new BufferedInputStream(in);
- in.mark(1000);
- return getAudioFileFormat(new LimitedInputStream(in), AudioSystem.NOT_SPECIFIED);
- } finally {
- in.reset();
- }
+ return getAudioFileFormat(in, AudioSystem.NOT_SPECIFIED);
}
@Override
public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
try (InputStream in = url.openStream()) {
- return getAudioFileFormat(in);
+ return getAudioFileFormat(in instanceof BufferedInputStream ? in : new BufferedInputStream(in, Integer.MAX_VALUE - 8));
}
}
@Override
public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
- InputStream in = null;
- try {
- in = new BufferedInputStream(Files.newInputStream(file.toPath()));
- in.mark(1000);
- AudioFileFormat aff = getAudioFileFormat(new LimitedInputStream(in), (int) file.length());
- return aff;
- } finally {
- if (in != null) {
- in.reset();
- in.close();
- }
+ try (InputStream in = Files.newInputStream(file.toPath())) {
+ return getAudioFileFormat(new BufferedInputStream(in, Integer.MAX_VALUE - 8), (int) file.length());
}
}
private AudioFileFormat getAudioFileFormat(InputStream in, int mediaLength) throws UnsupportedAudioFileException, IOException {
try {
+ if (!in.markSupported()) throw new IllegalArgumentException("mark not supported");
+
byte[] head = new byte[12];
- in.read(head);
- boolean canHandle = false;
+ synchronized (this) {
+ in.mark(12);
+ in.read(head);
+ in.reset(); // (*a)
+ }
+
+ int whole = in.available();
+ in.mark(whole);
+logger.fine("mark: " + whole);
+ in = new LimitedInputStream(in);
+
+ boolean canHandle;
AudioFileFormat.Type type = AAC;
if (new String(head, 4, 4).equals("ftyp")) {
- in.reset();
- in.mark(1000);
- // in position should be zero
+ // ⚠⚠⚠ in position must be zero ⚠⚠⚠
MP4Input is = MP4Input.open(in);
MP4Container cont = new MP4Container(is);
Movie movie = cont.getMovie();
@@ -129,21 +125,21 @@ private AudioFileFormat getAudioFileFormat(InputStream in, int mediaLength) thro
canHandle = true;
type = MP4;
- //This code is pulled directly from MP3-SPI.
+ // This code is pulled directly from MP3-SPI.
} else if ((head[0] == 'R') && (head[1] == 'I') && (head[2] == 'F') && (head[3] == 'F') && (head[8] == 'W') && (head[9] == 'A') && (head[10] == 'V') && (head[11] == 'E')) {
- canHandle = false; //RIFF/WAV stream found
+ canHandle = false; // RIFF/WAV stream found
} else if ((head[0] == '.') && (head[1] == 's') && (head[2] == 'n') && (head[3] == 'd')) {
- canHandle = false; //AU stream found
+ canHandle = false; // AU stream found
} else if ((head[0] == 'F') && (head[1] == 'O') && (head[2] == 'R') && (head[3] == 'M') && (head[8] == 'A') && (head[9] == 'I') && (head[10] == 'F') && (head[11] == 'F')) {
- canHandle = false; //AIFF stream found
+ canHandle = false; // AIFF stream found
} else if (((head[0] == 'M') | (head[0] == 'm')) && ((head[1] == 'A') | (head[1] == 'a')) && ((head[2] == 'C') | (head[2] == 'c'))) {
- canHandle = false; //APE stream found
+ canHandle = false; // APE stream found
} else if (((head[0] == 'F') | (head[0] == 'f')) && ((head[1] == 'L') | (head[1] == 'l')) && ((head[2] == 'A') | (head[2] == 'a')) && ((head[3] == 'C') | (head[3] == 'c'))) {
- canHandle = false; //FLAC stream found
+ canHandle = false; // FLAC stream found
} else if (((head[0] == 'I') | (head[0] == 'i')) && ((head[1] == 'C') | (head[1] == 'c')) && ((head[2] == 'Y') | (head[2] == 'y'))) {
- canHandle = false; //Shoutcast / ICE stream ?
+ canHandle = false; // Shoutcast / ICE stream ?
} else if (((head[0] == 'O') | (head[0] == 'o')) && ((head[1] == 'G') | (head[1] == 'g')) && ((head[2] == 'G') | (head[2] == 'g'))) {
- canHandle = false; //Ogg stream ?
+ canHandle = false; // Ogg stream ?
} else {
ADTSDemultiplexer adts = new ADTSDemultiplexer(in);
Decoder.create(adts.getDecoderInfo());
@@ -161,40 +157,49 @@ private AudioFileFormat getAudioFileFormat(InputStream in, int mediaLength) thro
} else {
throw new UnsupportedAudioFileException("no match sequence");
}
- } catch (Exception e) {
- logger.fine(e.getClass().getSimpleName() + ": " + e.getMessage());
- throw (UnsupportedAudioFileException) new UnsupportedAudioFileException().initCause(e);
+
+ } catch (IOException e) {
+ if (e.getMessage().equals(LimitedInputStream.ERROR_MESSAGE_REACHED_TO_LIMIT)) {
+ logger.fine(LimitedInputStream.ERROR_MESSAGE_REACHED_TO_LIMIT);
+ throw new UnsupportedAudioFileException(e.getMessage());
+ } else if (e.getMessage().equals("no ADTS header found")) {
+ logger.fine("no ADTS header found");
+ throw new UnsupportedAudioFileException(e.getMessage());
+ } else if (e instanceof net.sourceforge.jaad.mp4.MP4Exception) {
+ logger.fine(e.toString());
+ throw new UnsupportedAudioFileException(e.getMessage());
+ } else {
+ logger.info(e.toString());
+ throw e;
+ }
+ } finally {
+ try {
+ in.reset();
+logger.fine("reset");
+ } catch (IOException e) {
+ logger.info("FAIL TO RESET: " + e);
+ } finally {
+ logger.fine("finally available: " + in.available());
+ }
}
}
- //================================================
+ // ----
+
@Override
public AudioInputStream getAudioInputStream(InputStream in) throws UnsupportedAudioFileException, IOException {
- boolean needReset = false;
try {
- if (!in.markSupported()) in = new BufferedInputStream(in);
- synchronized (this) {
- in.mark(1000);
- logger.finer("mark: " + in.available());
- needReset = true;
- }
- AudioFileFormat aff = getAudioFileFormat(new LimitedInputStream(in), AudioSystem.NOT_SPECIFIED);
- synchronized (this) {
- logger.finer("before reset: " + in.available());
- in.reset();
- logger.finer("after reset: " + in.available());
- needReset = false;
- }
- synchronized (this) {
- in.mark(in.available());
- logger.finer("mark2: " + in.available());
- needReset = true;
- }
+ AudioFileFormat aff = getAudioFileFormat(in, AudioSystem.NOT_SPECIFIED);
+logger.fine("format: " + aff);
+
+ int whole = in.available();
+ in.mark(whole);
+logger.fine("mark: " + whole);
+ in = new LimitedInputStream(in);
+
// in position should be zero
- logger.fine("format: " + aff.getFormat());
return new AudioInputStream(in, aff.getFormat(), aff.getFrameLength());
- } catch (UnsupportedAudioFileException e) {
- throw e;
+
} catch (IOException e) {
if (e.getMessage().equals(LimitedInputStream.ERROR_MESSAGE_REACHED_TO_LIMIT)) {
logger.fine(LimitedInputStream.ERROR_MESSAGE_REACHED_TO_LIMIT);
@@ -206,40 +211,36 @@ public AudioInputStream getAudioInputStream(InputStream in) throws UnsupportedAu
logger.info(e.toString());
throw e;
}
- } catch (Exception e) {
- logger.info(e.toString());
- throw e;
} finally {
- logger.fine("reset?: " + needReset + ", available: " + in.available());
try {
- if (needReset) {
- in.reset();
- }
- logger.fine("finally available: " + in.available());
+ in.reset();
+logger.fine("reset");
} catch (IOException e) {
- logger.info(e.toString());
+ logger.info("FAIL TO RESET: " + e);
+ } finally {
+ logger.fine("finally available: " + in.available());
}
}
}
@Override
public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
- InputStream in = url.openStream();
+ InputStream inputStream = url.openStream();
try {
- return getAudioInputStream(in);
+ return getAudioInputStream(inputStream instanceof BufferedInputStream ? inputStream : new BufferedInputStream(inputStream, Integer.MAX_VALUE - 8));
} catch (UnsupportedAudioFileException | IOException e) {
- if (in != null) in.close();
+ inputStream.close();
throw e;
}
}
@Override
public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
- InputStream in = Files.newInputStream(file.toPath());
+ InputStream inputStream = Files.newInputStream(file.toPath());
try {
- return getAudioInputStream(in);
+ return getAudioInputStream(new BufferedInputStream(inputStream, Integer.MAX_VALUE - 8));
} catch (UnsupportedAudioFileException | IOException e) {
- in.close();
+ inputStream.close();
throw e;
}
}
diff --git a/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioInputStream.java b/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioInputStream.java
index a3d5709..426b7c3 100644
--- a/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioInputStream.java
+++ b/src/main/java/net/sourceforge/jaad/spi/javasound/AACAudioInputStream.java
@@ -4,8 +4,8 @@
import java.io.InputStream;
import javax.sound.sampled.AudioFormat;
-import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.SampleBuffer;
+import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.adts.ADTSDemultiplexer;
@@ -27,7 +27,7 @@ class AACAudioInputStream extends AsynchronousAudioInputStream {
@Override
public AudioFormat getFormat() {
if (audioFormat == null) {
- //read first frame
+ // read first frame
try {
decoder.decodeFrame(adts.readNextFrame(), sampleBuffer);
audioFormat = new AudioFormat(sampleBuffer.getSampleRate(), sampleBuffer.getBitsPerSample(), sampleBuffer.getChannels(), true, true);
@@ -39,6 +39,7 @@ public AudioFormat getFormat() {
return audioFormat;
}
+ @Override
public void execute() {
try {
if (saved == null) {
diff --git a/src/main/java/net/sourceforge/jaad/spi/javasound/CircularBuffer.java b/src/main/java/net/sourceforge/jaad/spi/javasound/CircularBuffer.java
index 0899492..9d65845 100644
--- a/src/main/java/net/sourceforge/jaad/spi/javasound/CircularBuffer.java
+++ b/src/main/java/net/sourceforge/jaad/spi/javasound/CircularBuffer.java
@@ -2,7 +2,7 @@
/**
* CircularBuffer for asynchronous reading.
- * Adopted from Tritonus ("https://www.tritonus.org/").
+ * Adopted from Tritonus ("https:// www.tritonus.org/").
*
* @author in-somnia
*/
diff --git a/src/main/java/net/sourceforge/jaad/spi/javasound/MP4AudioInputStream.java b/src/main/java/net/sourceforge/jaad/spi/javasound/MP4AudioInputStream.java
index 736029b..656107d 100644
--- a/src/main/java/net/sourceforge/jaad/spi/javasound/MP4AudioInputStream.java
+++ b/src/main/java/net/sourceforge/jaad/spi/javasound/MP4AudioInputStream.java
@@ -5,8 +5,8 @@
import java.util.List;
import javax.sound.sampled.AudioFormat;
-import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.SampleBuffer;
+import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.mp4.MP4Container;
import net.sourceforge.jaad.mp4.MP4Input;
import net.sourceforge.jaad.mp4.api.AudioTrack;
@@ -42,7 +42,7 @@ class MP4AudioInputStream extends AsynchronousAudioInputStream {
@Override
public AudioFormat getFormat() {
if (audioFormat == null) {
- //read first frame
+ // read first frame
decodeFrame();
audioFormat = new AudioFormat(sampleBuffer.getSampleRate(), sampleBuffer.getBitsPerSample(), sampleBuffer.getChannels(), true, true);
saved = sampleBuffer.getData();
@@ -50,6 +50,7 @@ public AudioFormat getFormat() {
return audioFormat;
}
+ @Override
public void execute() {
if (saved == null) {
decodeFrame();
diff --git a/src/main/java/net/sourceforge/jaad/spi/javasound/PcmAudioInputStream.java b/src/main/java/net/sourceforge/jaad/spi/javasound/PcmAudioInputStream.java
index aab47ef..284c06b 100644
--- a/src/main/java/net/sourceforge/jaad/spi/javasound/PcmAudioInputStream.java
+++ b/src/main/java/net/sourceforge/jaad/spi/javasound/PcmAudioInputStream.java
@@ -5,8 +5,8 @@
import java.util.logging.Logger;
import javax.sound.sampled.AudioFormat;
-import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.SampleBuffer;
+import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.adts.ADTSDemultiplexer;
@@ -30,7 +30,7 @@ class PcmAudioInputStream extends AsynchronousAudioInputStream {
@Override
public AudioFormat getFormat() {
if (audioFormat == null) {
- //read first frame
+ // read first frame
try {
decoder.decodeFrame(adts.readNextFrame(), sampleBuffer);
audioFormat = new AudioFormat(sampleBuffer.getSampleRate(), sampleBuffer.getBitsPerSample(), sampleBuffer.getChannels(), true, true);
@@ -43,6 +43,7 @@ public AudioFormat getFormat() {
return audioFormat;
}
+ @Override
public void execute() {
try {
if (saved == null) {
diff --git a/src/main/java/net/sourceforge/jaad/util/wav/WaveFileWriter.java b/src/main/java/net/sourceforge/jaad/util/wav/WaveFileWriter.java
index 2e10c63..7f4e803 100644
--- a/src/main/java/net/sourceforge/jaad/util/wav/WaveFileWriter.java
+++ b/src/main/java/net/sourceforge/jaad/util/wav/WaveFileWriter.java
@@ -8,9 +8,9 @@
public class WaveFileWriter {
private static final int HEADER_LENGTH = 44;
- private static final int RIFF = 1380533830; //'RIFF'
- private static final long WAVE_FMT = 6287401410857104416L; //'WAVEfmt '
- private static final int DATA = 1684108385; //'data'
+ private static final int RIFF = 1380533830; // 'RIFF'
+ private static final long WAVE_FMT = 6287401410857104416L; // 'WAVEfmt '
+ private static final int DATA = 1684108385; // 'data'
private static final int BYTE_MASK = 0xFF;
private final RandomAccessFile out;
private final int sampleRate;
@@ -25,7 +25,7 @@ public WaveFileWriter(File output, int sampleRate, int channels, int bitsPerSamp
bytesWritten = 0;
out = new RandomAccessFile(output, "rw");
- out.write(new byte[HEADER_LENGTH]); //space for the header
+ out.write(new byte[HEADER_LENGTH]); // space for the header
}
public void write(byte[] data) throws IOException {
@@ -33,7 +33,7 @@ public void write(byte[] data) throws IOException {
}
public void write(byte[] data, int off, int len) throws IOException {
- //convert to little endian
+ // convert to little endian
byte tmp;
for (int i = off; i < off + data.length; i += 2) {
tmp = data[i + 1];
@@ -65,17 +65,17 @@ private void writeWaveHeader() throws IOException {
out.seek(0);
int bytesPerSec = (bitsPerSample + 7) / 8;
- out.writeInt(RIFF); //wave label
- out.writeInt(Integer.reverseBytes(bytesWritten + 36)); //length in bytes without header
+ out.writeInt(RIFF); // wave label
+ out.writeInt(Integer.reverseBytes(bytesWritten + 36)); // length in bytes without header
out.writeLong(WAVE_FMT);
- out.writeInt(Integer.reverseBytes(16)); //length of pcm format declaration area
- out.writeShort(Short.reverseBytes((short) 1)); //is PCM
- out.writeShort(Short.reverseBytes((short) channels)); //number of channels
- out.writeInt(Integer.reverseBytes(sampleRate)); //sample rate
- out.writeInt(Integer.reverseBytes(sampleRate * channels * bytesPerSec)); //bytes per second
- out.writeShort(Short.reverseBytes((short) (channels * bytesPerSec))); //bytes per sample time
- out.writeShort(Short.reverseBytes((short) bitsPerSample)); //bits per sample
- out.writeInt(DATA); //data section label
- out.writeInt(Integer.reverseBytes(bytesWritten)); //length of raw pcm data in bytes
+ out.writeInt(Integer.reverseBytes(16)); // length of pcm format declaration area
+ out.writeShort(Short.reverseBytes((short) 1)); // is PCM
+ out.writeShort(Short.reverseBytes((short) channels)); // number of channels
+ out.writeInt(Integer.reverseBytes(sampleRate)); // sample rate
+ out.writeInt(Integer.reverseBytes(sampleRate * channels * bytesPerSec)); // bytes per second
+ out.writeShort(Short.reverseBytes((short) (channels * bytesPerSec))); // bytes per sample time
+ out.writeShort(Short.reverseBytes((short) bitsPerSample)); // bits per sample
+ out.writeInt(DATA); // data section label
+ out.writeInt(Integer.reverseBytes(bytesWritten)); // length of raw pcm data in bytes
}
}
diff --git a/src/test/java/Test1.java b/src/test/java/Test1.java
index 89e04a9..ca556f3 100644
--- a/src/test/java/Test1.java
+++ b/src/test/java/Test1.java
@@ -9,32 +9,29 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
-
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.SourceDataLine;
-import net.sourceforge.jaad.mp4.MP4Input;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import vavi.util.Debug;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static vavi.sound.SoundUtil.volume;
-import static vavix.util.DelayedWorker.later;
-
-import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.SampleBuffer;
+import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.adts.ADTSDemultiplexer;
import net.sourceforge.jaad.mp4.MP4Container;
+import net.sourceforge.jaad.mp4.MP4Input;
import net.sourceforge.jaad.mp4.api.AudioTrack;
import net.sourceforge.jaad.mp4.api.Frame;
import net.sourceforge.jaad.mp4.api.Movie;
import net.sourceforge.jaad.mp4.api.Track;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import vavi.util.Debug;
import vavi.util.properties.annotation.Property;
import vavi.util.properties.annotation.PropsEntity;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static vavi.sound.SoundUtil.volume;
+import static vavix.util.DelayedWorker.later;
+
/**
* test basic functions.
@@ -62,7 +59,7 @@ void setup() throws Exception {
static long time;
static {
- time = System.getProperty("vavi.test", "").equals("ide") ? 10 * 1000 : 1000 * 1000;
+ time = System.getProperty("vavi.test", "").equals("ide") ? 1000 * 1000 : 9 * 1000;
}
@Test
@@ -82,7 +79,7 @@ void decodeMP4() throws Exception {
track.getSampleRate(), track.getSampleSize(), track.getChannelCount(), true, true);
line = AudioSystem.getSourceDataLine(aufmt);
line.open();
- volume(line, .2f);
+ volume(line, .1f);
line.start();
// create AAC decoder
@@ -118,7 +115,7 @@ void decodeAAC() throws Exception {
Debug.println("IN: " + aufmt);
line = AudioSystem.getSourceDataLine(aufmt);
line.open();
- volume(line, .2f);
+ volume(line, .1f);
line.start();
}
b = buf.getData();
diff --git a/src/test/java/net/sourceforge/jaad/spi/javasound/AacFormatConversionProviderTest.java b/src/test/java/net/sourceforge/jaad/spi/javasound/AacFormatConversionProviderTest.java
index 4d52023..c702a7d 100644
--- a/src/test/java/net/sourceforge/jaad/spi/javasound/AacFormatConversionProviderTest.java
+++ b/src/test/java/net/sourceforge/jaad/spi/javasound/AacFormatConversionProviderTest.java
@@ -7,46 +7,78 @@
package net.sourceforge.jaad.spi.javasound;
import java.io.BufferedInputStream;
+import java.io.File;
+import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.concurrent.CountDownLatch;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
+import javax.sound.sampled.LineEvent;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;
-import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import vavi.sound.SoundUtil;
import vavi.util.Debug;
+import vavi.util.properties.annotation.Property;
+import vavi.util.properties.annotation.PropsEntity;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static vavi.sound.SoundUtil.volume;
import static vavix.util.DelayedWorker.later;
+
+/**
+ * AacFormatConversionProviderTest.
+ *
+ * @author Naohide Sano (umjammer)
+ * @version 0.00 2023/05/23 umjammer initial version
+ */
+@PropsEntity(url = "file:local.properties")
class AacFormatConversionProviderTest {
- static final String inFile1 = "/test.aac";
- static final String inFile = "/test.mid";
- static final String inFile2 = "/test.m4a";
- static final String inFile4 = "/alac.m4a";
- static final String inFile3 = "/test.caf";
+ static boolean localPropertiesExists() {
+ return Files.exists(Paths.get("local.properties"));
+ }
+
+ @BeforeEach
+ void setup() throws Exception {
+ if (localPropertiesExists()) {
+ PropsEntity.Util.bind(this);
+ }
+ }
static long time;
- @BeforeAll
- static void setup() throws Exception {
- time = System.getProperty("vavi.test", "").equals("ide") ? 10 * 1000 : 1000 * 1000;
+ static {
+ System.setProperty("vavi.util.logging.VaviFormatter.extraClassMethod", "org\\.tritonus\\.share\\.TDebug#out");
+
+ time = System.getProperty("vavi.test", "").equals("ide") ? 1000 * 1000 : 9 * 1000;
}
+ @Property
+ String mp4 = "src/test/resources/test.m4a";
+
+ static final String aac = "/test.aac";
+ static final String mid = "/test.mid";
+ static final String alac = "/alac.m4a";
+ static final String caf = "/test.caf";
+
@Test
@DisplayName("unsupported exception is able to detect in 3 ways")
public void test1() throws Exception {
- Path path = Paths.get("src/test/resources", inFile);
+ Path path = Paths.get("src/test/resources", mid);
assertThrows(UnsupportedAudioFileException.class, () -> {
// don't replace with Files#newInputStream(Path)
@@ -59,28 +91,27 @@ public void test1() throws Exception {
}
@Test
+ @DisplayName("not aac")
public void test11() throws Exception {
-
- Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(inFile).toURI());
-
+ Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(mid).toURI());
+Debug.println(path);
assertThrows(UnsupportedAudioFileException.class, () -> new AACAudioFileReader().getAudioInputStream(new BufferedInputStream(Files.newInputStream(path))));
}
@Test
@DisplayName("movie does not contain any AAC track")
public void test12() throws Exception {
-
- Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(inFile4).toURI());
-
+ Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(alac).toURI());
+Debug.println(path);
assertThrows(UnsupportedAudioFileException.class, () -> new AACAudioFileReader().getAudioInputStream(new BufferedInputStream(Files.newInputStream(path))));
}
@Test
+ @Disabled("couldn't find good sample")
@DisplayName("a file consumes input stream all")
public void test13() throws Exception {
-
- Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(inFile3).toURI());
-
+ Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(caf).toURI());
+Debug.println(path);
assertThrows(UnsupportedAudioFileException.class, () -> new AACAudioFileReader().getAudioInputStream(new BufferedInputStream(Files.newInputStream(path))));
}
@@ -89,7 +120,7 @@ public void test13() throws Exception {
public void test2() throws Exception {
//
- Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(inFile1).toURI());
+ Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(aac).toURI());
Debug.println("file: " + path);
AudioInputStream aacAis = AudioSystem.getAudioInputStream(path.toFile());
Debug.println("INS: " + aacAis);
@@ -131,7 +162,7 @@ public void test2() throws Exception {
public void test3() throws Exception {
//
- Path path = Paths.get(AacFormatConversionProviderTest.class.getResource(inFile2).toURI());
+ Path path = Paths.get(mp4);
Debug.println("file: " + path);
AudioInputStream aacAis = AudioSystem.getAudioInputStream(path.toFile());
Debug.println("INS: " + aacAis);
@@ -168,6 +199,53 @@ public void test3() throws Exception {
line.stop();
line.close();
}
+
+ @Test
+ @DisplayName("another input type 2")
+ void test62() throws Exception {
+ URL url = Paths.get(mp4).toUri().toURL();
+Debug.println(url);
+ AudioInputStream ais = AudioSystem.getAudioInputStream(url);
+ assertEquals(AACAudioFileReader.AAC_ENCODING, ais.getFormat().getEncoding());
+ }
+
+ @Test
+ @DisplayName("another input type 3")
+ void test63() throws Exception {
+ File file = Paths.get(mp4).toFile();
+Debug.println(file);
+ AudioInputStream ais = AudioSystem.getAudioInputStream(file);
+ assertEquals(AACAudioFileReader.AAC_ENCODING, ais.getFormat().getEncoding());
+ }
+
+ @Test
+ @DisplayName("clip")
+ void test4() throws Exception {
+
+ AudioInputStream ais = AudioSystem.getAudioInputStream(Paths.get(mp4).toFile());
+Debug.println(ais.getFormat());
+
+ Clip clip = AudioSystem.getClip();
+CountDownLatch cdl = new CountDownLatch(1);
+clip.addLineListener(ev -> {
+ Debug.println(ev.getType());
+ if (ev.getType() == LineEvent.Type.STOP)
+ cdl.countDown();
+});
+ clip.open(AudioSystem.getAudioInputStream(new AudioFormat(44100, 16, 2, true, false), ais));
+SoundUtil.volume(clip, 0.1f);
+ clip.start();
+if (!System.getProperty("vavi.test", "").equals("ide")) {
+ Thread.sleep(10 * 1000);
+ clip.stop();
+ Debug.println("Interrupt");
+} else {
+ cdl.await();
+}
+ clip.drain();
+ clip.stop();
+ clip.close();
+ }
}
/* */
diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties
index 3b2a8ba..a18586d 100644
--- a/src/test/resources/logging.properties
+++ b/src/test/resources/logging.properties
@@ -3,4 +3,6 @@ handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=vavi.util.logging.VaviFormatter
-#vavi.util.level=FINE
+vavi.util.level=FINE
+net.sourceforge.jaad.level=FINE
+net.sourceforge.jaad.spi.level=FINER