summaryrefslogtreecommitdiff
path: root/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base
diff options
context:
space:
mode:
Diffstat (limited to 'isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base')
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/AudioSpecificConfig.java.svn-base1176
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BaseDescriptor.java.svn-base99
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitReaderBuffer.java.svn-base51
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitWriterBuffer.java.svn-base36
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderConfigDescriptor.java.svn-base262
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderSpecificInfo.java.svn-base85
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/Descriptor.java.svn-base39
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ESDescriptor.java.svn-base376
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionDescriptor.java.svn-base73
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionProfileLevelDescriptor.java.svn-base51
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/InitialObjectDescriptor.java.svn-base136
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptor.java_bak.svn-base104
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorBase.java.svn-base27
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorFactory.java.svn-base189
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ProfileLevelIndicationDescriptor.java.svn-base70
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/SLConfigDescriptor.java.svn-base119
-rw-r--r--isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/UnknownDescriptor.java.svn-base42
17 files changed, 2935 insertions, 0 deletions
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/AudioSpecificConfig.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/AudioSpecificConfig.java.svn-base
new file mode 100644
index 0000000..86e319e
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/AudioSpecificConfig.java.svn-base
@@ -0,0 +1,1176 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.Hex;
+import com.coremedia.iso.IsoTypeWriter;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+
+//
+//GetAudioObjectType()
+//{
+//audioObjectType; 5 uimsbf
+//if (audioObjectType == 31) {
+//audioObjectType = 32 + audioObjectTypeExt; 6 uimsbf
+//}
+//return audioObjectType;
+//}
+//AudioSpecificConfig ()
+//{
+//audioObjectType = GetAudioObjectType();
+//samplingFrequencyIndex; 4 bslbf
+//if ( samplingFrequencyIndex == 0xf ) {
+//samplingFrequency; 24 uimsbf
+//}
+//channelConfiguration; 4 bslbf
+//sbrPresentFlag = -1;
+//psPresentFlag = -1;
+//if ( audioObjectType == 5 ||
+//audioObjectType == 29 ) {
+//extensionAudioObjectType = 5;
+//sbrPresentFlag = 1;
+//if ( audioObjectType == 29 ) {
+//psPresentFlag = 1;
+//}
+//extensionSamplingFrequencyIndex; 4 uimsbf
+//if ( extensionSamplingFrequencyIndex == 0xf )
+//extensionSamplingFrequency; 24 uimsbf
+//audioObjectType = GetAudioObjectType();
+//if ( audioObjectType == 22 )
+//extensionChannelConfiguration; 4 uimsbf
+//}
+//else {
+//extensionAudioObjectType = 0;
+//}
+//switch (audioObjectType) {
+//case 1:
+//case 2:
+//case 3:
+//case 4:
+//case 6:
+//case 7:
+//case 17:
+//case 19:
+//case 20:
+//case 21:
+//case 22:
+//case 23:
+//GASpecificConfig();
+//break:
+//case 8:
+//CelpSpecificConfig();
+//break;
+//case 9:
+//HvxcSpecificConfig();
+//break:
+//case 12:
+//TTSSpecificConfig();
+//break;
+//case 13:
+//case 14:
+//case 15:
+//case 16:
+//StructuredAudioSpecificConfig();
+//break;
+//case 24:
+//ErrorResilientCelpSpecificConfig();
+//break;
+//case 25:
+//ErrorResilientHvxcSpecificConfig();
+//break;
+//case 26:
+//case 27:
+//ParametricSpecificConfig();
+//break;
+// case 28:
+//SSCSpecificConfig();
+//break;
+//case 30:
+//sacPayloadEmbedding; 1 uimsbf
+//SpatialSpecificConfig();
+//break;
+//case 32:
+//case 33:
+//case 34:
+//MPEG_1_2_SpecificConfig();
+//break;
+//case 35:
+//DSTSpecificConfig();
+//break;
+//case 36:
+//fillBits; 5 bslbf
+//ALSSpecificConfig();
+//break;
+//case 37:
+//case 38:
+//SLSSpecificConfig();
+//break;
+//case 39:
+//ELDSpecificConfig(channelConfiguration);
+//break:
+//case 40:
+//case 41:
+//SymbolicMusicSpecificConfig();
+//break;
+//default:
+///* reserved */
+//}
+//switch (audioObjectType) {
+//case 17:
+//case 19:
+//case 20:
+//case 21:
+//case 22:
+//case 23:
+//case 24:
+//case 25:
+//case 26:
+//case 27:
+//case 39:
+//epConfig; 2 bslbf
+//if ( epConfig == 2 || epConfig == 3 ) {
+//ErrorProtectionSpecificConfig();
+//}
+//if ( epConfig == 3 ) {
+//directMapping; 1 bslbf
+//if ( ! directMapping ) {
+///* tbd */
+//}
+//}
+//}
+//if ( extensionAudioObjectType != 5 && bits_to_decode() >= 16 ) {
+//syncExtensionType; 11 bslbf
+//if (syncExtensionType == 0x2b7) {
+// extensionAudioObjectType = GetAudioObjectType();
+//if ( extensionAudioObjectType == 5 ) {
+//sbrPresentFlag; 1 uimsbf
+//if (sbrPresentFlag == 1) {
+//extensionSamplingFrequencyIndex; 4 uimsbf
+//if ( extensionSamplingFrequencyIndex == 0xf ) {
+//extensionSamplingFrequency; 24 uimsbf
+//}
+//if ( bits_to_decode() >= 12 ) {
+//syncExtensionType; 11 bslbf
+//if (syncExtesionType == 0x548) {
+//psPresentFlag; 1 uimsbf
+//}
+//}
+//}
+//}
+//if ( extensionAudioObjectType == 22 ) {
+//sbrPresentFlag; 1 uimsbf
+//if (sbrPresentFlag == 1) {
+//extensionSamplingFrequencyIndex; 4 uimsbf
+//if ( extensionSamplingFrequencyIndex == 0xf ) {
+//extensionSamplingFrequency; 24 uimsbf
+//}
+//}
+//extensionChannelConfiguration; 4 uimsbf
+//}
+//}
+//}
+//}
+// }
+//
+// TFCodingType
+//0x0 AAC scaleable
+//0x1 BSAC
+//0x2 TwinVQ
+//0x3 AAC non scaleable (i.e. multichannel)
+//
+// class TFSpecificConfig( uint(4) samplingFrequencyIndex, uint(4) channelConfiguration ) {
+//uint(2) TFCodingType;
+//uint(1) frameLength;
+//uint(1) dependsOnCoreCoder;
+//if (dependsOnCoreCoder == 1){
+//uint(14)coreCoderDelay
+//}
+//if (TFCodingType==BSAC) {
+//uint(11) lslayer_length
+//}
+//uint (1) extensionFlag;
+//if (channelConfiguration == 0 ){
+//program_config_element();
+//}
+//if (extensionFlag==1){
+//<to be defined in mpeg4 phase 2>
+//}
+//}
+//
+//program_config_element()
+//{
+//element_instance_tag 4 uimsbf
+//profile 2 uimsbf
+//sampling_frequency_index 4 uimsbf
+//num_front_channel_elements 4 uimsbf
+//num_side_channel_elements 4 uimsbf
+//num_back_channel_elements 4 uimsbf
+// num_lfe_channel_elements 2 uimsbf
+//num_assoc_data_elements 3 uimsbf
+//num_valid_cc_elements 4 uimsbf
+//mono_mixdown_present 1 uimsbf
+//if ( mono_mixdown_present == 1 )
+//mono_mixdown_element_number 4 uimsbf
+//stereo_mixdown_present 1 uimsbf
+//if ( stereo_mixdown_present == 1 )
+//stereo_mixdown_element_number 4 uimsbf
+//matrix_mixdown_idx_present 1 uimsbf
+//if ( matrix_mixdown_idx_present == 1 ) {
+//matrix_mixdown_idx 2 uimsbf
+//pseudo_surround_enable 1 uimsbf
+//}
+//for ( i = 0; i < num_front_channel_elements; i++) {
+//front_element_is_cpe[i]; 1 bslbf
+//front_element_tag_select[i]; 4 uimsbf
+//}
+//for ( i = 0; i < num_side_channel_elements; i++) {
+//side_element_is_cpe[i]; 1 bslbf
+//side_element_tag_select[i]; 4 uimsbf
+//}
+//for ( i = 0; i < num_back_channel_elements; i++) {
+//back_element_is_cpe[i]; 1 bslbf
+//back_element_tag_select[i]; 4 uimsbf
+//}
+//for ( i = 0; i < num_lfe_channel_elements; i++)
+//lfe_element_tag_select[i]; 4 uimsbf
+//for ( i = 0; i < num_assoc_data_elements; i++)
+//assoc_data_element_tag_select[i]; 4 uimsbf
+//for ( i = 0; i < num_valid_cc_elements; i++) {
+//cc_element_is_ind_sw[i]; 1 uimsbf
+//valid_cc_element_tag_select[i]; 4 uimsbf
+//}
+//byte_alignment()
+//comment_field_bytes 8 uimsbf
+//for ( i = 0; i < comment_field_bytes; i++)
+//comment_field_data[i]; 8 uimsbf
+//}
+
+@Descriptor(tags = 0x5, objectTypeIndication = 0x40)
+public class AudioSpecificConfig extends BaseDescriptor {
+ byte[] configBytes;
+
+ public static Map<Integer, Integer> samplingFrequencyIndexMap = new HashMap<Integer, Integer>();
+ public static Map<Integer, String> audioObjectTypeMap = new HashMap<Integer, String>();
+ int audioObjectType;
+ int samplingFrequencyIndex;
+ int samplingFrequency;
+ int channelConfiguration;
+ int extensionAudioObjectType;
+ int sbrPresentFlag;
+ int psPresentFlag;
+ int extensionSamplingFrequencyIndex;
+ int extensionSamplingFrequency;
+ int extensionChannelConfiguration;
+ int sacPayloadEmbedding;
+ int fillBits;
+ int epConfig;
+ int directMapping;
+ int syncExtensionType;
+
+ //GASpecificConfig
+ int frameLengthFlag;
+ int dependsOnCoreCoder;
+ int coreCoderDelay;
+ int extensionFlag;
+ int layerNr;
+ int numOfSubFrame;
+ int layer_length;
+ int aacSectionDataResilienceFlag;
+ int aacScalefactorDataResilienceFlag;
+ int aacSpectralDataResilienceFlag;
+ int extensionFlag3;
+ boolean gaSpecificConfig;
+
+ //ParametricSpecificConfig
+ int isBaseLayer;
+ int paraMode;
+ int paraExtensionFlag;
+ int hvxcVarMode;
+ int hvxcRateMode;
+ int erHvxcExtensionFlag;
+ int var_ScalableFlag;
+ int hilnQuantMode;
+ int hilnMaxNumLine;
+ int hilnSampleRateCode;
+ int hilnFrameLength;
+ int hilnContMode;
+ int hilnEnhaLayer;
+ int hilnEnhaQuantMode;
+ boolean parametricSpecificConfig;
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ ByteBuffer configBytes = bb.slice();
+ configBytes.limit(sizeOfInstance);
+ bb.position(bb.position() + sizeOfInstance);
+
+ //copy original bytes to internal array for constructing codec config strings (todo until writing of the config is supported)
+ this.configBytes = new byte[sizeOfInstance];
+ configBytes.get(this.configBytes);
+ configBytes.rewind();
+
+ BitReaderBuffer bitReaderBuffer = new BitReaderBuffer(configBytes);
+ audioObjectType = getAudioObjectType(bitReaderBuffer);
+ samplingFrequencyIndex = bitReaderBuffer.readBits(4);
+
+ if (samplingFrequencyIndex == 0xf) {
+ samplingFrequency = bitReaderBuffer.readBits(24);
+ }
+
+ channelConfiguration = bitReaderBuffer.readBits(4);
+
+ if (audioObjectType == 5 ||
+ audioObjectType == 29) {
+ extensionAudioObjectType = 5;
+ sbrPresentFlag = 1;
+ if (audioObjectType == 29) {
+ psPresentFlag = 1;
+ }
+ extensionSamplingFrequencyIndex = bitReaderBuffer.readBits(4);
+ if (extensionSamplingFrequencyIndex == 0xf)
+ extensionSamplingFrequency = bitReaderBuffer.readBits(24);
+ audioObjectType = getAudioObjectType(bitReaderBuffer);
+ if (audioObjectType == 22)
+ extensionChannelConfiguration = bitReaderBuffer.readBits(4);
+ } else {
+ extensionAudioObjectType = 0;
+ }
+
+ switch (audioObjectType) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 6:
+ case 7:
+ case 17:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ parseGaSpecificConfig(samplingFrequencyIndex, channelConfiguration, audioObjectType, bitReaderBuffer);
+ //GASpecificConfig();
+ break;
+ case 8:
+ throw new UnsupportedOperationException("can't parse CelpSpecificConfig yet");
+ //CelpSpecificConfig();
+ //break;
+ case 9:
+ throw new UnsupportedOperationException("can't parse HvxcSpecificConfig yet");
+ //HvxcSpecificConfig();
+ //break;
+ case 12:
+ throw new UnsupportedOperationException("can't parse TTSSpecificConfig yet");
+ //TTSSpecificConfig();
+ //break;
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ throw new UnsupportedOperationException("can't parse StructuredAudioSpecificConfig yet");
+ //StructuredAudioSpecificConfig();
+ //break;
+ case 24:
+ throw new UnsupportedOperationException("can't parse ErrorResilientCelpSpecificConfig yet");
+ //ErrorResilientCelpSpecificConfig();
+ //break;
+ case 25:
+ throw new UnsupportedOperationException("can't parse ErrorResilientHvxcSpecificConfig yet");
+ //ErrorResilientHvxcSpecificConfig();
+ //break;
+ case 26:
+ case 27:
+ parseParametricSpecificConfig(samplingFrequencyIndex, channelConfiguration, audioObjectType, bitReaderBuffer);
+ //ParametricSpecificConfig();
+ break;
+ case 28:
+ throw new UnsupportedOperationException("can't parse SSCSpecificConfig yet");
+ //SSCSpecificConfig();
+ //break;
+ case 30:
+ sacPayloadEmbedding = bitReaderBuffer.readBits(1);
+ throw new UnsupportedOperationException("can't parse SpatialSpecificConfig yet");
+ //SpatialSpecificConfig();
+ //break;
+ case 32:
+ case 33:
+ case 34:
+ throw new UnsupportedOperationException("can't parse MPEG_1_2_SpecificConfig yet");
+ //MPEG_1_2_SpecificConfig();
+ //break;
+ case 35:
+ throw new UnsupportedOperationException("can't parse DSTSpecificConfig yet");
+ //DSTSpecificConfig();
+ //break;
+ case 36:
+ fillBits = bitReaderBuffer.readBits(5);
+ throw new UnsupportedOperationException("can't parse ALSSpecificConfig yet");
+ //ALSSpecificConfig();
+ //break;
+ case 37:
+ case 38:
+ throw new UnsupportedOperationException("can't parse SLSSpecificConfig yet");
+ //SLSSpecificConfig();
+ //break;
+ case 39:
+ throw new UnsupportedOperationException("can't parse ELDSpecificConfig yet");
+ //ELDSpecificConfig(channelConfiguration);
+ //break;
+ case 40:
+ case 41:
+ throw new UnsupportedOperationException("can't parse SymbolicMusicSpecificConfig yet");
+ //SymbolicMusicSpecificConfig();
+ //break;
+ default:
+ /* reserved */
+ }
+
+ switch (audioObjectType) {
+ case 17:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 39:
+ epConfig = bitReaderBuffer.readBits(2);
+ if (epConfig == 2 || epConfig == 3) {
+ throw new UnsupportedOperationException("can't parse ErrorProtectionSpecificConfig yet");
+ //ErrorProtectionSpecificConfig();
+ }
+ if (epConfig == 3) {
+ directMapping = bitReaderBuffer.readBits(1);
+ if (directMapping == 0) {
+ /* tbd */
+ throw new RuntimeException("not implemented");
+ }
+ }
+ }
+
+ if (extensionAudioObjectType != 5 && bitReaderBuffer.remainingBits() >= 16) {
+ syncExtensionType = bitReaderBuffer.readBits(11);
+ if (syncExtensionType == 0x2b7) {
+ extensionAudioObjectType = getAudioObjectType(bitReaderBuffer);
+ if (extensionAudioObjectType == 5) {
+ sbrPresentFlag = bitReaderBuffer.readBits(1);
+ if (sbrPresentFlag == 1) {
+ extensionSamplingFrequencyIndex = bitReaderBuffer.readBits(4);
+ if (extensionSamplingFrequencyIndex == 0xf) {
+ extensionSamplingFrequency = bitReaderBuffer.readBits(24);
+ }
+ if (bitReaderBuffer.remainingBits() >= 12) {
+ syncExtensionType = bitReaderBuffer.readBits(11); //10101001000
+ if (syncExtensionType == 0x548) {
+ psPresentFlag = bitReaderBuffer.readBits(1);
+ }
+ }
+ }
+ }
+ if (extensionAudioObjectType == 22) {
+ sbrPresentFlag = bitReaderBuffer.readBits(1);
+ if (sbrPresentFlag == 1) {
+ extensionSamplingFrequencyIndex = bitReaderBuffer.readBits(4);
+ if (extensionSamplingFrequencyIndex == 0xf) {
+ extensionSamplingFrequency = bitReaderBuffer.readBits(24);
+ }
+ }
+ extensionChannelConfiguration = bitReaderBuffer.readBits(4);
+ }
+ }
+ }
+ }
+
+ private int gaSpecificConfigSize() {
+ return 0;
+ }
+
+ public int serializedSize() {
+ int out = 4;
+ if (audioObjectType == 2) {
+ out += gaSpecificConfigSize();
+ } else {
+ throw new UnsupportedOperationException("can't serialize that yet");
+ }
+ return out;
+ }
+
+ public ByteBuffer serialize() {
+ ByteBuffer out = ByteBuffer.allocate(serializedSize());
+ IsoTypeWriter.writeUInt8(out, 5);
+ IsoTypeWriter.writeUInt8(out, serializedSize() - 2);
+ BitWriterBuffer bwb = new BitWriterBuffer(out);
+ bwb.writeBits(audioObjectType, 5);
+ bwb.writeBits(samplingFrequencyIndex, 4);
+ if (samplingFrequencyIndex == 0xf) {
+ throw new UnsupportedOperationException("can't serialize that yet");
+ }
+ bwb.writeBits(channelConfiguration, 4);
+
+ // Don't support any extensions, unusual GASpecificConfig other than the default or anything...
+
+ return out;
+ }
+
+ private int getAudioObjectType(BitReaderBuffer in) throws IOException {
+ int audioObjectType = in.readBits(5);
+ if (audioObjectType == 31) {
+ audioObjectType = 32 + in.readBits(6);
+ }
+ return audioObjectType;
+ }
+
+ private void parseGaSpecificConfig(int samplingFrequencyIndex, int channelConfiguration, int audioObjectType, BitReaderBuffer in) throws IOException {
+// GASpecificConfig (samplingFrequencyIndex,
+// channelConfiguration,
+// audioObjectType)
+// {
+ frameLengthFlag = in.readBits(1);
+ dependsOnCoreCoder = in.readBits(1);
+ if (dependsOnCoreCoder == 1) {
+ coreCoderDelay = in.readBits(14);
+ }
+ extensionFlag = in.readBits(1);
+ if (channelConfiguration == 0) {
+ throw new UnsupportedOperationException("can't parse program_config_element yet");
+ //program_config_element ();
+ }
+ if ((audioObjectType == 6) || (audioObjectType == 20)) {
+ layerNr = in.readBits(3);
+ }
+ if (extensionFlag == 1) {
+ if (audioObjectType == 22) {
+ numOfSubFrame = in.readBits(5);
+ layer_length = in.readBits(11);
+ }
+ if (audioObjectType == 17 || audioObjectType == 19 ||
+ audioObjectType == 20 || audioObjectType == 23) {
+ aacSectionDataResilienceFlag = in.readBits(1);
+ aacScalefactorDataResilienceFlag = in.readBits(1);
+ aacSpectralDataResilienceFlag = in.readBits(1);
+ }
+ extensionFlag3 = in.readBits(1);
+ if (extensionFlag3 == 1) {
+ /* tbd in version 3 */
+ }
+ }
+// }
+ gaSpecificConfig = true;
+ }
+
+ private void parseParametricSpecificConfig(int samplingFrequencyIndex, int channelConfiguration, int audioObjectType, BitReaderBuffer in) throws IOException {
+ /*
+ ParametricSpecificConfig() {
+ isBaseLayer; 1 uimsbf
+ if (isBaseLayer) {
+ PARAconfig();
+ } else {
+ HILNenexConfig();
+ }
+ }
+ */
+ isBaseLayer = in.readBits(1);
+ if (isBaseLayer == 1) {
+ parseParaConfig(samplingFrequencyIndex, channelConfiguration, audioObjectType, in);
+ } else {
+ parseHilnEnexConfig(samplingFrequencyIndex, channelConfiguration, audioObjectType, in);
+ }
+ }
+
+ private void parseParaConfig(int samplingFrequencyIndex, int channelConfiguration, int audioObjectType, BitReaderBuffer in) throws IOException {
+ /*
+ PARAconfig()
+ {
+ PARAmode; 2 uimsbf
+ if (PARAmode != 1) {
+ ErHVXCconfig();
+ }
+ if (PARAmode != 0) {
+ HILNconfig();
+ }
+ PARAextensionFlag; 1 uimsbf
+ if (PARAextensionFlag) {
+ // to be defined in MPEG-4 Phase 3
+ }
+ }
+ */
+ paraMode = in.readBits(2);
+
+ if (paraMode != 1) {
+ parseErHvxcConfig(samplingFrequencyIndex, channelConfiguration, audioObjectType, in);
+ }
+ if (paraMode != 0) {
+ parseHilnConfig(samplingFrequencyIndex, channelConfiguration, audioObjectType, in);
+ }
+
+ paraExtensionFlag = in.readBits(1);
+ parametricSpecificConfig = true;
+ }
+
+ private void parseErHvxcConfig(int samplingFrequencyIndex, int channelConfiguration, int audioObjectType, BitReaderBuffer in) throws IOException {
+ /*
+ ErHVXCconfig()
+ {
+ HVXCvarMode; 1 uimsbf
+ HVXCrateMode; 2 uimsbf
+ extensionFlag; 1 uimsbf
+ if (extensionFlag) {
+ var_ScalableFlag; 1 uimsbf
+ }
+ }
+ */
+ hvxcVarMode = in.readBits(1);
+ hvxcRateMode = in.readBits(2);
+ erHvxcExtensionFlag = in.readBits(1);
+
+ if (erHvxcExtensionFlag == 1) {
+ var_ScalableFlag = in.readBits(1);
+ }
+ }
+
+ private void parseHilnConfig(int samplingFrequencyIndex, int channelConfiguration, int audioObjectType, BitReaderBuffer in) throws IOException {
+ /*
+ HILNconfig()
+ {
+ HILNquantMode; 1 uimsbf
+ HILNmaxNumLine; 8 uimsbf
+ HILNsampleRateCode; 4 uimsbf
+ HILNframeLength; 12 uimsbf
+ HILNcontMode; 2 uimsbf
+ }
+ */
+ hilnQuantMode = in.readBits(1);
+ hilnMaxNumLine = in.readBits(8);
+ hilnSampleRateCode = in.readBits(4);
+ hilnFrameLength = in.readBits(12);
+ hilnContMode = in.readBits(2);
+ }
+
+ private void parseHilnEnexConfig(int samplingFrequencyIndex, int channelConfiguration, int audioObjectType, BitReaderBuffer in) throws IOException {
+ /*
+ HILNenexConfig()
+ {
+ HILNenhaLayer; 1 uimsbf
+ if (HILNenhaLayer) {
+ HILNenhaQuantMode; 2 uimsbf
+ }
+ }
+ */
+ hilnEnhaLayer = in.readBits(1);
+ if (hilnEnhaLayer == 1) {
+ hilnEnhaQuantMode = in.readBits(2);
+ }
+ }
+
+ public byte[] getConfigBytes() {
+ return configBytes;
+ }
+
+ public int getAudioObjectType() {
+ return audioObjectType;
+ }
+
+ public int getExtensionAudioObjectType() {
+ return extensionAudioObjectType;
+ }
+
+ public int getSbrPresentFlag() {
+ return sbrPresentFlag;
+ }
+
+ public int getPsPresentFlag() {
+ return psPresentFlag;
+ }
+
+ public void setAudioObjectType(int audioObjectType) {
+ this.audioObjectType = audioObjectType;
+ }
+
+ public void setSamplingFrequencyIndex(int samplingFrequencyIndex) {
+ this.samplingFrequencyIndex = samplingFrequencyIndex;
+ }
+
+ public void setSamplingFrequency(int samplingFrequency) {
+ this.samplingFrequency = samplingFrequency;
+ }
+
+ public void setChannelConfiguration(int channelConfiguration) {
+ this.channelConfiguration = channelConfiguration;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("AudioSpecificConfig");
+ sb.append("{configBytes=").append(Hex.encodeHex(configBytes));
+ sb.append(", audioObjectType=").append(audioObjectType).append(" (").append(audioObjectTypeMap.get(audioObjectType)).append(")");
+ sb.append(", samplingFrequencyIndex=").append(samplingFrequencyIndex).append(" (").append(samplingFrequencyIndexMap.get(samplingFrequencyIndex)).append(")");
+ sb.append(", samplingFrequency=").append(samplingFrequency);
+ sb.append(", channelConfiguration=").append(channelConfiguration);
+ if (extensionAudioObjectType > 0) {
+ sb.append(", extensionAudioObjectType=").append(extensionAudioObjectType).append(" (").append(audioObjectTypeMap.get(extensionAudioObjectType)).append(")");
+ sb.append(", sbrPresentFlag=").append(sbrPresentFlag);
+ sb.append(", psPresentFlag=").append(psPresentFlag);
+ sb.append(", extensionSamplingFrequencyIndex=").append(extensionSamplingFrequencyIndex).append(" (").append(samplingFrequencyIndexMap.get(extensionSamplingFrequencyIndex)).append(")");
+ sb.append(", extensionSamplingFrequency=").append(extensionSamplingFrequency);
+ sb.append(", extensionChannelConfiguration=").append(extensionChannelConfiguration);
+ }
+// sb.append(", sacPayloadEmbedding=").append(sacPayloadEmbedding);
+// sb.append(", fillBits=").append(fillBits);
+// sb.append(", epConfig=").append(epConfig);
+// sb.append(", directMapping=").append(directMapping);
+ sb.append(", syncExtensionType=").append(syncExtensionType);
+ if (gaSpecificConfig) {
+ sb.append(", frameLengthFlag=").append(frameLengthFlag);
+ sb.append(", dependsOnCoreCoder=").append(dependsOnCoreCoder);
+ sb.append(", coreCoderDelay=").append(coreCoderDelay);
+ sb.append(", extensionFlag=").append(extensionFlag);
+ sb.append(", layerNr=").append(layerNr);
+ sb.append(", numOfSubFrame=").append(numOfSubFrame);
+ sb.append(", layer_length=").append(layer_length);
+ sb.append(", aacSectionDataResilienceFlag=").append(aacSectionDataResilienceFlag);
+ sb.append(", aacScalefactorDataResilienceFlag=").append(aacScalefactorDataResilienceFlag);
+ sb.append(", aacSpectralDataResilienceFlag=").append(aacSpectralDataResilienceFlag);
+ sb.append(", extensionFlag3=").append(extensionFlag3);
+ }
+ if (parametricSpecificConfig) {
+ sb.append(", isBaseLayer=").append(isBaseLayer);
+ sb.append(", paraMode=").append(paraMode);
+ sb.append(", paraExtensionFlag=").append(paraExtensionFlag);
+ sb.append(", hvxcVarMode=").append(hvxcVarMode);
+ sb.append(", hvxcRateMode=").append(hvxcRateMode);
+ sb.append(", erHvxcExtensionFlag=").append(erHvxcExtensionFlag);
+ sb.append(", var_ScalableFlag=").append(var_ScalableFlag);
+ sb.append(", hilnQuantMode=").append(hilnQuantMode);
+ sb.append(", hilnMaxNumLine=").append(hilnMaxNumLine);
+ sb.append(", hilnSampleRateCode=").append(hilnSampleRateCode);
+ sb.append(", hilnFrameLength=").append(hilnFrameLength);
+ sb.append(", hilnContMode=").append(hilnContMode);
+ sb.append(", hilnEnhaLayer=").append(hilnEnhaLayer);
+ sb.append(", hilnEnhaQuantMode=").append(hilnEnhaQuantMode);
+ }
+ sb.append('}');
+ return sb.toString();
+ }
+
+ static {
+ // sampling_frequency_index sampling frequeny
+//0x0 96000
+//0x1 88200
+//0x2 64000
+//0x3 48000
+//0x4 44100
+//0x5 32000
+//0x6 24000
+//0x7 22050
+//0x8 16000
+//0x9 12000
+//0xa 11025
+//0xb 8000
+//0xc reserved
+//0xd reserved
+//0xe reserved
+//0xf reserved
+ samplingFrequencyIndexMap.put(0x0, 96000);
+ samplingFrequencyIndexMap.put(0x1, 88200);
+ samplingFrequencyIndexMap.put(0x2, 64000);
+ samplingFrequencyIndexMap.put(0x3, 48000);
+ samplingFrequencyIndexMap.put(0x4, 44100);
+ samplingFrequencyIndexMap.put(0x5, 32000);
+ samplingFrequencyIndexMap.put(0x6, 24000);
+ samplingFrequencyIndexMap.put(0x7, 22050);
+ samplingFrequencyIndexMap.put(0x8, 16000);
+ samplingFrequencyIndexMap.put(0x9, 12000);
+ samplingFrequencyIndexMap.put(0xa, 11025);
+ samplingFrequencyIndexMap.put(0xb, 8000);
+
+ /* audioObjectType IDs
+ 0 Null
+ 1 AAC main X X
+ 2 AAC LC X X X X X X X
+ 3 AAC SSR X X
+ 4 AAC LTP X X X X
+ 5 SBR X X
+ 6 AAC Scalable X X X X
+ 7 TwinVQ X X X
+ 8 CELP X X X X X X
+ 9 HVXC X X X X X
+ 10 (reserved)
+ 11 (reserved)
+ 12 TTSI X X X X X X
+ 13 Main synthetic X X
+ 14 Wavetable synthesis X* X*
+ 15 General MIDI X* X*
+ 16 Algorithmic Synthesis and Audio FX X* X*
+ 17 ER AAC LC X X X
+ 18 (reserved)
+ 19 ER AAC LTP X X
+ 20 ER AAC Scalable X X X
+ 21 ER TwinVQ X X
+ 22 ER BSAC X X
+ 23 ER AAC LD X X X X
+ 24 ER CELP X X X
+ 25 ER HVXC X X
+ 26 ER HILN X
+ 27 ER Parametric X
+ 28 SSC
+ 29 PS X
+ 30 MPEG Surround
+ 31 (escape)
+ 32 Layer-1
+ 33 Layer-2
+ 34 Layer-3
+ 35 DST
+ 36 ALS
+ 37 SLS
+ 38 SLS non-core
+ 39 ER AAC ELD
+ 40 SMR Simple
+ 41 SMR Main
+ */
+ audioObjectTypeMap.put(1, "AAC main");
+ audioObjectTypeMap.put(2, "AAC LC");
+ audioObjectTypeMap.put(3, "AAC SSR");
+ audioObjectTypeMap.put(4, "AAC LTP");
+ audioObjectTypeMap.put(5, "SBR");
+ audioObjectTypeMap.put(6, "AAC Scalable");
+ audioObjectTypeMap.put(7, "TwinVQ");
+ audioObjectTypeMap.put(8, "CELP");
+ audioObjectTypeMap.put(9, "HVXC");
+ audioObjectTypeMap.put(10, "(reserved)");
+ audioObjectTypeMap.put(11, "(reserved)");
+ audioObjectTypeMap.put(12, "TTSI");
+ audioObjectTypeMap.put(13, "Main synthetic");
+ audioObjectTypeMap.put(14, "Wavetable synthesis");
+ audioObjectTypeMap.put(15, "General MIDI");
+ audioObjectTypeMap.put(16, "Algorithmic Synthesis and Audio FX");
+ audioObjectTypeMap.put(17, "ER AAC LC");
+ audioObjectTypeMap.put(18, "(reserved)");
+ audioObjectTypeMap.put(19, "ER AAC LTP");
+ audioObjectTypeMap.put(20, "ER AAC Scalable");
+ audioObjectTypeMap.put(21, "ER TwinVQ");
+ audioObjectTypeMap.put(22, "ER BSAC");
+ audioObjectTypeMap.put(23, "ER AAC LD");
+ audioObjectTypeMap.put(24, "ER CELP");
+ audioObjectTypeMap.put(25, "ER HVXC");
+ audioObjectTypeMap.put(26, "ER HILN");
+ audioObjectTypeMap.put(27, "ER Parametric");
+ audioObjectTypeMap.put(28, "SSC");
+ audioObjectTypeMap.put(29, "PS");
+ audioObjectTypeMap.put(30, "MPEG Surround");
+ audioObjectTypeMap.put(31, "(escape)");
+ audioObjectTypeMap.put(32, "Layer-1");
+ audioObjectTypeMap.put(33, "Layer-2");
+ audioObjectTypeMap.put(34, "Layer-3");
+ audioObjectTypeMap.put(35, "DST");
+ audioObjectTypeMap.put(36, "ALS");
+ audioObjectTypeMap.put(37, "SLS");
+ audioObjectTypeMap.put(38, "SLS non-core");
+ audioObjectTypeMap.put(39, "ER AAC ELD");
+ audioObjectTypeMap.put(40, "SMR Simple");
+ audioObjectTypeMap.put(41, "SMR Main");
+
+ /* profileLevelIds
+ 0x00 Reserved for ISO use -
+ 0x01 Main Audio Profile L1
+ 0x02 Main Audio Profile L2
+ 0x03 Main Audio Profile L3
+ 0x04 Main Audio Profile L4
+ 0x05 Scalable Audio Profile L1
+ 0x06 Scalable Audio Profile L2
+ 0x07 Scalable Audio Profile L3
+ 0x08 Scalable Audio Profile L4
+ 0x09 Speech Audio Profile L1
+ 0x0A Speech Audio Profile L2
+ 0x0B Synthetic Audio Profile L1
+ 0x0C Synthetic Audio Profile L2
+ 0x0D Synthetic Audio Profile L3
+ 0x0E High Quality Audio Profile L1
+ 0x0F High Quality Audio Profile L2
+ 0x10 High Quality Audio Profile L3
+ 0x11 High Quality Audio Profile L4
+ 0x12 High Quality Audio Profile L5
+ 0x13 High Quality Audio Profile L6
+ 0x14 High Quality Audio Profile L7
+ 0x15 High Quality Audio Profile L8
+ 0x16 Low Delay Audio Profile L1
+ 0x17 Low Delay Audio Profile L2
+ 0x18 Low Delay Audio Profile L3
+ 0x19 Low Delay Audio Profile L4
+ 0x1A Low Delay Audio Profile L5
+ 0x1B Low Delay Audio Profile L6
+ 0x1C Low Delay Audio Profile L7
+ 0x1D Low Delay Audio Profile L8
+ 0x1E Natural Audio Profile L1
+ 0x1F Natural Audio Profile L2
+ 0x20 Natural Audio Profile L3
+ 0x21 Natural Audio Profile L4
+ 0x22 Mobile Audio Internetworking Profile L1
+ 0x23 Mobile Audio Internetworking Profile L2
+ 0x24 Mobile Audio Internetworking Profile L3
+ 0x25 Mobile Audio Internetworking Profile L4
+ 0x26 Mobile Audio Internetworking Profile L5
+ 0x27 Mobile Audio Internetworking Profile L6
+ 0x28 AAC Profile L1
+ 0x29 AAC Profile L2
+ 0x2A AAC Profile L4
+ 0x2B AAC Profile L5
+ 0x2C High Efficiency AAC Profile L2
+ 0x2D High Efficiency AAC Profile L3
+ 0x2E High Efficiency AAC Profile L4
+ 0x2F High Efficiency AAC Profile L5
+ 0x30 High Efficiency AAC v2 Profile L2
+ 0x31 High Efficiency AAC v2 Profile L3
+ 0x32 High Efficiency AAC v2 Profile L4
+ 0x33 High Efficiency AAC v2 Profile L5
+ 0x34 Low Delay AAC Profile L1
+ 0x35 Baseline MPEG Surround Profile (see ISO/IEC
+ 23003-1)
+ L1
+ 0x36 Baseline MPEG Surround Profile (see ISO/IEC
+ 23003-1)
+ L2
+ 0x37 Baseline MPEG Surround Profile (see ISO/IEC
+ 23003-1)
+ L3
+ 0x38 Baseline MPEG Surround Profile (see ISO/IEC
+ 23003-1)
+ L4
+ 0c39 Baseline MPEG Surround Profile (see ISO/IEC
+ 23003-1)
+ L5
+ 0x3A Baseline MPEG Surround Profile (see ISO/IEC
+ 23003-1)
+ L6
+ 0x3B - 0x7F reserved for ISO use -
+ 0x80 - 0xFD user private -
+ 0xFE no audio profile specified -
+ 0xFF no audio capability required -
+
+ */
+ }
+
+
+ public int getSamplingFrequency() {
+ return samplingFrequencyIndex == 0xf ? samplingFrequency : samplingFrequencyIndexMap.get(samplingFrequencyIndex);
+ }
+
+ public int getChannelConfiguration() {
+ return channelConfiguration;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ AudioSpecificConfig that = (AudioSpecificConfig) o;
+
+ if (aacScalefactorDataResilienceFlag != that.aacScalefactorDataResilienceFlag) {
+ return false;
+ }
+ if (aacSectionDataResilienceFlag != that.aacSectionDataResilienceFlag) {
+ return false;
+ }
+ if (aacSpectralDataResilienceFlag != that.aacSpectralDataResilienceFlag) {
+ return false;
+ }
+ if (audioObjectType != that.audioObjectType) {
+ return false;
+ }
+ if (channelConfiguration != that.channelConfiguration) {
+ return false;
+ }
+ if (coreCoderDelay != that.coreCoderDelay) {
+ return false;
+ }
+ if (dependsOnCoreCoder != that.dependsOnCoreCoder) {
+ return false;
+ }
+ if (directMapping != that.directMapping) {
+ return false;
+ }
+ if (epConfig != that.epConfig) {
+ return false;
+ }
+ if (erHvxcExtensionFlag != that.erHvxcExtensionFlag) {
+ return false;
+ }
+ if (extensionAudioObjectType != that.extensionAudioObjectType) {
+ return false;
+ }
+ if (extensionChannelConfiguration != that.extensionChannelConfiguration) {
+ return false;
+ }
+ if (extensionFlag != that.extensionFlag) {
+ return false;
+ }
+ if (extensionFlag3 != that.extensionFlag3) {
+ return false;
+ }
+ if (extensionSamplingFrequency != that.extensionSamplingFrequency) {
+ return false;
+ }
+ if (extensionSamplingFrequencyIndex != that.extensionSamplingFrequencyIndex) {
+ return false;
+ }
+ if (fillBits != that.fillBits) {
+ return false;
+ }
+ if (frameLengthFlag != that.frameLengthFlag) {
+ return false;
+ }
+ if (gaSpecificConfig != that.gaSpecificConfig) {
+ return false;
+ }
+ if (hilnContMode != that.hilnContMode) {
+ return false;
+ }
+ if (hilnEnhaLayer != that.hilnEnhaLayer) {
+ return false;
+ }
+ if (hilnEnhaQuantMode != that.hilnEnhaQuantMode) {
+ return false;
+ }
+ if (hilnFrameLength != that.hilnFrameLength) {
+ return false;
+ }
+ if (hilnMaxNumLine != that.hilnMaxNumLine) {
+ return false;
+ }
+ if (hilnQuantMode != that.hilnQuantMode) {
+ return false;
+ }
+ if (hilnSampleRateCode != that.hilnSampleRateCode) {
+ return false;
+ }
+ if (hvxcRateMode != that.hvxcRateMode) {
+ return false;
+ }
+ if (hvxcVarMode != that.hvxcVarMode) {
+ return false;
+ }
+ if (isBaseLayer != that.isBaseLayer) {
+ return false;
+ }
+ if (layerNr != that.layerNr) {
+ return false;
+ }
+ if (layer_length != that.layer_length) {
+ return false;
+ }
+ if (numOfSubFrame != that.numOfSubFrame) {
+ return false;
+ }
+ if (paraExtensionFlag != that.paraExtensionFlag) {
+ return false;
+ }
+ if (paraMode != that.paraMode) {
+ return false;
+ }
+ if (parametricSpecificConfig != that.parametricSpecificConfig) {
+ return false;
+ }
+ if (psPresentFlag != that.psPresentFlag) {
+ return false;
+ }
+ if (sacPayloadEmbedding != that.sacPayloadEmbedding) {
+ return false;
+ }
+ if (samplingFrequency != that.samplingFrequency) {
+ return false;
+ }
+ if (samplingFrequencyIndex != that.samplingFrequencyIndex) {
+ return false;
+ }
+ if (sbrPresentFlag != that.sbrPresentFlag) {
+ return false;
+ }
+ if (syncExtensionType != that.syncExtensionType) {
+ return false;
+ }
+ if (var_ScalableFlag != that.var_ScalableFlag) {
+ return false;
+ }
+ if (!Arrays.equals(configBytes, that.configBytes)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = configBytes != null ? Arrays.hashCode(configBytes) : 0;
+ result = 31 * result + audioObjectType;
+ result = 31 * result + samplingFrequencyIndex;
+ result = 31 * result + samplingFrequency;
+ result = 31 * result + channelConfiguration;
+ result = 31 * result + extensionAudioObjectType;
+ result = 31 * result + sbrPresentFlag;
+ result = 31 * result + psPresentFlag;
+ result = 31 * result + extensionSamplingFrequencyIndex;
+ result = 31 * result + extensionSamplingFrequency;
+ result = 31 * result + extensionChannelConfiguration;
+ result = 31 * result + sacPayloadEmbedding;
+ result = 31 * result + fillBits;
+ result = 31 * result + epConfig;
+ result = 31 * result + directMapping;
+ result = 31 * result + syncExtensionType;
+ result = 31 * result + frameLengthFlag;
+ result = 31 * result + dependsOnCoreCoder;
+ result = 31 * result + coreCoderDelay;
+ result = 31 * result + extensionFlag;
+ result = 31 * result + layerNr;
+ result = 31 * result + numOfSubFrame;
+ result = 31 * result + layer_length;
+ result = 31 * result + aacSectionDataResilienceFlag;
+ result = 31 * result + aacScalefactorDataResilienceFlag;
+ result = 31 * result + aacSpectralDataResilienceFlag;
+ result = 31 * result + extensionFlag3;
+ result = 31 * result + (gaSpecificConfig ? 1 : 0);
+ result = 31 * result + isBaseLayer;
+ result = 31 * result + paraMode;
+ result = 31 * result + paraExtensionFlag;
+ result = 31 * result + hvxcVarMode;
+ result = 31 * result + hvxcRateMode;
+ result = 31 * result + erHvxcExtensionFlag;
+ result = 31 * result + var_ScalableFlag;
+ result = 31 * result + hilnQuantMode;
+ result = 31 * result + hilnMaxNumLine;
+ result = 31 * result + hilnSampleRateCode;
+ result = 31 * result + hilnFrameLength;
+ result = 31 * result + hilnContMode;
+ result = 31 * result + hilnEnhaLayer;
+ result = 31 * result + hilnEnhaQuantMode;
+ result = 31 * result + (parametricSpecificConfig ? 1 : 0);
+ return result;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BaseDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BaseDescriptor.java.svn-base
new file mode 100644
index 0000000..6d94680
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BaseDescriptor.java.svn-base
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.IsoTypeReader;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/*
+abstract aligned(8) expandable(228-1) class BaseDescriptor : bit(8) tag=0 {
+// empty. To be filled by classes extending this class.
+}
+
+int sizeOfInstance = 0;
+bit(1) nextByte;
+bit(7) sizeOfInstance;
+while(nextByte) {
+bit(1) nextByte;
+bit(7) sizeByte;
+sizeOfInstance = sizeOfInstance<<7 | sizeByte;
+}
+ */
+@Descriptor(tags = 0x00)
+public abstract class BaseDescriptor {
+ int tag;
+ int sizeOfInstance;
+ int sizeBytes;
+
+ public BaseDescriptor() {
+ }
+
+ public int getTag() {
+ return tag;
+ }
+
+ public int getSize() {
+ return sizeOfInstance
+ + 1//1 for the tag
+ + sizeBytes;
+ }
+
+ public int getSizeOfInstance() {
+ return sizeOfInstance;
+ }
+
+ public int getSizeBytes() {
+ return sizeBytes;
+ }
+
+ public final void parse(int tag, ByteBuffer bb) throws IOException {
+ this.tag = tag;
+
+ int i = 0;
+ int tmp = IsoTypeReader.readUInt8(bb);
+ i++;
+ sizeOfInstance = tmp & 0x7f;
+ while (tmp >>> 7 == 1) { //nextbyte indicator bit
+ tmp = IsoTypeReader.readUInt8(bb);
+ i++;
+ //sizeOfInstance = sizeOfInstance<<7 | sizeByte;
+ sizeOfInstance = sizeOfInstance << 7 | tmp & 0x7f;
+ }
+ sizeBytes = i;
+ ByteBuffer detailSource = bb.slice();
+ detailSource.limit(sizeOfInstance);
+ parseDetail(detailSource);
+ assert detailSource.remaining() == 0: this.getClass().getSimpleName() + " has not been fully parsed";
+ bb.position(bb.position() + sizeOfInstance);
+ }
+
+ public abstract void parseDetail(ByteBuffer bb) throws IOException;
+
+
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("BaseDescriptor");
+ sb.append("{tag=").append(tag);
+ sb.append(", sizeOfInstance=").append(sizeOfInstance);
+ sb.append('}');
+ return sb.toString();
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitReaderBuffer.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitReaderBuffer.java.svn-base
new file mode 100644
index 0000000..7221503
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitReaderBuffer.java.svn-base
@@ -0,0 +1,51 @@
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import java.nio.ByteBuffer;
+
+public class BitReaderBuffer {
+
+ private ByteBuffer buffer;
+ int initialPos;
+ int position;
+
+ public BitReaderBuffer(ByteBuffer buffer) {
+ this.buffer = buffer;
+ initialPos = buffer.position();
+ }
+
+ public int readBits(int i) {
+ byte b = buffer.get(initialPos + position / 8);
+ int v = b < 0 ? b + 256 : b;
+ int left = 8 - position % 8;
+ int rc;
+ if (i <= left) {
+ rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i));
+ position += i;
+ } else {
+ int now = left;
+ int then = i - left;
+ rc = readBits(now);
+ rc = rc << then;
+ rc += readBits(then);
+ }
+ buffer.position(initialPos + (int) Math.ceil((double) position / 8));
+ return rc;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public int byteSync() {
+ int left = 8 - position % 8;
+ if (left == 8) {
+ left = 0;
+ }
+ readBits(left);
+ return left;
+ }
+
+ public int remainingBits() {
+ return buffer.limit() * 8 - position;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitWriterBuffer.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitWriterBuffer.java.svn-base
new file mode 100644
index 0000000..e6ea67f
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/BitWriterBuffer.java.svn-base
@@ -0,0 +1,36 @@
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import java.nio.ByteBuffer;
+
+public class BitWriterBuffer {
+
+ private ByteBuffer buffer;
+ int initialPos;
+ int position = 0;
+
+ public BitWriterBuffer(ByteBuffer buffer) {
+ this.buffer = buffer;
+ this.initialPos = buffer.position();
+ }
+
+ public void writeBits(int i, int numBits) {
+ assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " +
+ "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1);
+
+ int left = 8 - position % 8;
+ if (numBits <= left) {
+ int current = (buffer.get(initialPos + position / 8));
+ current = current < 0 ? current + 256 : current;
+ current += i << (left - numBits);
+ buffer.put(initialPos + position / 8, (byte) (current > 127 ? current - 256 : current));
+ position += numBits;
+ } else {
+ int bitsSecondWrite = numBits - left;
+ writeBits(i >> bitsSecondWrite, left);
+ writeBits(i & (1 << bitsSecondWrite) - 1, bitsSecondWrite);
+ }
+ buffer.position(initialPos + position / 8 + ((position % 8 > 0) ? 1 : 0));
+ }
+
+
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderConfigDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderConfigDescriptor.java.svn-base
new file mode 100644
index 0000000..69d603a
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderConfigDescriptor.java.svn-base
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.Hex;
+import com.coremedia.iso.IsoTypeReader;
+import com.coremedia.iso.IsoTypeWriter;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * class DecoderConfigDescriptor extends BaseDescriptor : bit(8)
+ * tag=DecoderConfigDescrTag {
+ * bit(8) objectTypeIndication;
+ * bit(6) streamType;
+ * bit(1) upStream;
+ * const bit(1) reserved=1;
+ * bit(24) bufferSizeDB;
+ * bit(32) maxBitrate;
+ * bit(32) avgBitrate;
+ * DecoderSpecificInfo decSpecificInfo[0 .. 1];
+ * profileLevelIndicationIndexDescriptor profileLevelIndicationIndexDescr
+ * [0..255];
+ * }
+ */
+@Descriptor(tags = {0x04})
+public class DecoderConfigDescriptor extends BaseDescriptor {
+ private static Logger log = Logger.getLogger(DecoderConfigDescriptor.class.getName());
+
+
+ int objectTypeIndication;
+ int streamType;
+ int upStream;
+ int bufferSizeDB;
+ long maxBitRate;
+ long avgBitRate;
+
+ DecoderSpecificInfo decoderSpecificInfo;
+ AudioSpecificConfig audioSpecificInfo;
+ List<ProfileLevelIndicationDescriptor> profileLevelIndicationDescriptors = new ArrayList<ProfileLevelIndicationDescriptor>();
+ byte[] configDescriptorDeadBytes;
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ objectTypeIndication = IsoTypeReader.readUInt8(bb);
+
+ int data = IsoTypeReader.readUInt8(bb);
+ streamType = data >>> 2;
+ upStream = (data >> 1) & 0x1;
+
+ bufferSizeDB = IsoTypeReader.readUInt24(bb);
+ maxBitRate = IsoTypeReader.readUInt32(bb);
+ avgBitRate = IsoTypeReader.readUInt32(bb);
+
+
+
+ BaseDescriptor descriptor;
+ if (bb.remaining() > 2) { //1byte tag + at least 1byte size
+ final int begin = bb.position();
+ descriptor = ObjectDescriptorFactory.createFrom(objectTypeIndication, bb);
+ final int read = bb.position() - begin;
+ log.finer(descriptor + " - DecoderConfigDescr1 read: " + read + ", size: " + (descriptor != null ? descriptor.getSize() : null));
+ if (descriptor != null) {
+ final int size = descriptor.getSize();
+ if (read < size) {
+ //skip
+ configDescriptorDeadBytes = new byte[size - read];
+ bb.get(configDescriptorDeadBytes);
+ }
+ }
+ if (descriptor instanceof DecoderSpecificInfo) {
+ decoderSpecificInfo = (DecoderSpecificInfo) descriptor;
+ }
+ if (descriptor instanceof AudioSpecificConfig) {
+ audioSpecificInfo = (AudioSpecificConfig) descriptor;
+ }
+ }
+
+ while (bb.remaining() > 2) {
+ final long begin = bb.position();
+ descriptor = ObjectDescriptorFactory.createFrom(objectTypeIndication, bb);
+ final long read = bb.position() - begin;
+ log.finer(descriptor + " - DecoderConfigDescr2 read: " + read + ", size: " + (descriptor != null ? descriptor.getSize() : null));
+ if (descriptor instanceof ProfileLevelIndicationDescriptor) {
+ profileLevelIndicationDescriptors.add((ProfileLevelIndicationDescriptor) descriptor);
+ }
+ }
+ }
+ public int serializedSize() {
+ return 15 + audioSpecificInfo.serializedSize();
+ }
+
+ public ByteBuffer serialize() {
+ ByteBuffer out = ByteBuffer.allocate(serializedSize());
+ IsoTypeWriter.writeUInt8(out, 4);
+ IsoTypeWriter.writeUInt8(out, serializedSize() - 2);
+ IsoTypeWriter.writeUInt8(out, objectTypeIndication);
+ int flags = (streamType << 2) | (upStream << 1) | 1;
+ IsoTypeWriter.writeUInt8(out, flags);
+ IsoTypeWriter.writeUInt24(out, bufferSizeDB);
+ IsoTypeWriter.writeUInt32(out, maxBitRate);
+ IsoTypeWriter.writeUInt32(out, avgBitRate);
+ out.put(audioSpecificInfo.serialize().array());
+ return out;
+ }
+
+ public DecoderSpecificInfo getDecoderSpecificInfo() {
+ return decoderSpecificInfo;
+ }
+
+ public AudioSpecificConfig getAudioSpecificInfo() {
+ return audioSpecificInfo;
+ }
+
+ public void setAudioSpecificInfo(AudioSpecificConfig audioSpecificInfo) {
+ this.audioSpecificInfo = audioSpecificInfo;
+ }
+
+ public List<ProfileLevelIndicationDescriptor> getProfileLevelIndicationDescriptors() {
+ return profileLevelIndicationDescriptors;
+ }
+
+ public int getObjectTypeIndication() {
+ return objectTypeIndication;
+ }
+
+ public void setObjectTypeIndication(int objectTypeIndication) {
+ this.objectTypeIndication = objectTypeIndication;
+ }
+
+ public int getStreamType() {
+ return streamType;
+ }
+
+ public void setStreamType(int streamType) {
+ this.streamType = streamType;
+ }
+
+ public int getUpStream() {
+ return upStream;
+ }
+
+ public void setUpStream(int upStream) {
+ this.upStream = upStream;
+ }
+
+ public int getBufferSizeDB() {
+ return bufferSizeDB;
+ }
+
+ public void setBufferSizeDB(int bufferSizeDB) {
+ this.bufferSizeDB = bufferSizeDB;
+ }
+
+ public long getMaxBitRate() {
+ return maxBitRate;
+ }
+
+ public void setMaxBitRate(long maxBitRate) {
+ this.maxBitRate = maxBitRate;
+ }
+
+ public long getAvgBitRate() {
+ return avgBitRate;
+ }
+
+ public void setAvgBitRate(long avgBitRate) {
+ this.avgBitRate = avgBitRate;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DecoderConfigDescriptor");
+ sb.append("{objectTypeIndication=").append(objectTypeIndication);
+ sb.append(", streamType=").append(streamType);
+ sb.append(", upStream=").append(upStream);
+ sb.append(", bufferSizeDB=").append(bufferSizeDB);
+ sb.append(", maxBitRate=").append(maxBitRate);
+ sb.append(", avgBitRate=").append(avgBitRate);
+ sb.append(", decoderSpecificInfo=").append(decoderSpecificInfo);
+ sb.append(", audioSpecificInfo=").append(audioSpecificInfo);
+ sb.append(", configDescriptorDeadBytes=").append(Hex.encodeHex(configDescriptorDeadBytes != null ? configDescriptorDeadBytes : new byte[]{}));
+ sb.append(", profileLevelIndicationDescriptors=").append(profileLevelIndicationDescriptors == null ? "null" : Arrays.asList(profileLevelIndicationDescriptors).toString());
+ sb.append('}');
+ return sb.toString();
+ }
+ /*objectTypeIndication values
+ 0x00 Forbidden
+ 0x01 Systems ISO/IEC 14496-1 a
+ 0x02 Systems ISO/IEC 14496-1 b
+ 0x03 Interaction Stream
+ 0x04 Systems ISO/IEC 14496-1 Extended BIFS Configuration c
+ 0x05 Systems ISO/IEC 14496-1 AFX d
+ 0x06 Font Data Stream
+ 0x07 Synthesized Texture Stream
+ 0x08 Streaming Text Stream
+ 0x09-0x1F reserved for ISO use
+ 0x20 Visual ISO/IEC 14496-2 e
+ 0x21 Visual ITU-T Recommendation H.264 | ISO/IEC 14496-10 f
+ 0x22 Parameter Sets for ITU-T Recommendation H.264 | ISO/IEC 14496-10 f
+ 0x23-0x3F reserved for ISO use
+ 0x40 Audio ISO/IEC 14496-3 g
+ 0x41-0x5F reserved for ISO use
+ 0x60 Visual ISO/IEC 13818-2 Simple Profile
+ 0x61 Visual ISO/IEC 13818-2 Main Profile
+ 0x62 Visual ISO/IEC 13818-2 SNR Profile
+ 0x63 Visual ISO/IEC 13818-2 Spatial Profile
+ 0x64 Visual ISO/IEC 13818-2 High Profile
+ 0x65 Visual ISO/IEC 13818-2 422 Profile
+ 0x66 Audio ISO/IEC 13818-7 Main Profile
+ 0x67 Audio ISO/IEC 13818-7 LowComplexity Profile
+ 0x68 Audio ISO/IEC 13818-7 Scaleable Sampling Rate Profile
+ 0x69 Audio ISO/IEC 13818-3
+ 0x6A Visual ISO/IEC 11172-2
+ 0x6B Audio ISO/IEC 11172-3
+ 0x6C Visual ISO/IEC 10918-1
+ 0x6D reserved for registration authority i
+ 0x6E Visual ISO/IEC 15444-1
+ 0x6F - 0x9F reserved for ISO use
+ 0xA0 - 0xBF reserved for registration authority i
+ 0xC0 - 0xE0 user private
+ 0xE1 reserved for registration authority i
+ 0xE2 - 0xFE user private
+ 0xFF no object type specified h
+ */
+ /* streamType values
+ 0x00 Forbidden
+ 0x01 ObjectDescriptorStream (see 7.2.5)
+ 0x02 ClockReferenceStream (see 7.3.2.5)
+ 0x03 SceneDescriptionStream (see ISO/IEC 14496-11)
+ 0x04 VisualStream
+ 0x05 AudioStream
+ 0x06 MPEG7Stream
+ 0x07 IPMPStream (see 7.2.3.2)
+ 0x08 ObjectContentInfoStream (see 7.2.4.2)
+ 0x09 MPEGJStream
+ 0x0A Interaction Stream
+ 0x0B IPMPToolStream (see [ISO/IEC 14496-13])
+ 0x0C - 0x1F reserved for ISO use
+ 0x20 - 0x3F user private
+ */
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderSpecificInfo.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderSpecificInfo.java.svn-base
new file mode 100644
index 0000000..574943c
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/DecoderSpecificInfo.java.svn-base
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.Hex;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+/**
+ * abstract class DecoderSpecificInfo extends BaseDescriptor : bit(8)
+ * tag=DecSpecificInfoTag
+ * {
+ * // empty. To be filled by classes extending this class.
+ * }
+ */
+@Descriptor(tags = 0x05)
+public class DecoderSpecificInfo extends BaseDescriptor {
+ byte[] bytes;
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ if (sizeOfInstance > 0) {
+ bytes = new byte[sizeOfInstance];
+ bb.get(bytes);
+ }
+ }
+
+ public int serializedSize() {
+ return bytes.length;
+ }
+
+ public ByteBuffer serialize() {
+ ByteBuffer out = ByteBuffer.wrap(bytes);
+
+ return out;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DecoderSpecificInfo");
+ sb.append("{bytes=").append(bytes == null ? "null" : Hex.encodeHex(bytes));
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ DecoderSpecificInfo that = (DecoderSpecificInfo) o;
+
+ if (!Arrays.equals(bytes, that.bytes)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return bytes != null ? Arrays.hashCode(bytes) : 0;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/Descriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/Descriptor.java.svn-base
new file mode 100644
index 0000000..11020c7
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/Descriptor.java.svn-base
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: mstattma
+ * Date: 06.08.2010
+ * Time: 06:54:58
+ * To change this template use File | Settings | File Templates.
+ */
+@Documented
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Descriptor {
+ int[] tags();
+
+ int objectTypeIndication() default -1;
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ESDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ESDescriptor.java.svn-base
new file mode 100644
index 0000000..3bb4821
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ESDescriptor.java.svn-base
@@ -0,0 +1,376 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.IsoTypeReader;
+import com.coremedia.iso.IsoTypeWriter;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+/*
+class ES_Descriptor extends BaseDescriptor : bit(8) tag=ES_DescrTag {
+bit(16) ES_ID;
+bit(1) streamDependenceFlag;
+bit(1) URL_Flag;
+bit(1) OCRstreamFlag;
+bit(5) streamPriority;
+if (streamDependenceFlag)
+bit(16) dependsOn_ES_ID;
+if (URL_Flag) {
+bit(8) URLlength;
+bit(8) URLstring[URLlength];
+}
+if (OCRstreamFlag)
+bit(16) OCR_ES_Id;
+DecoderConfigDescriptor decConfigDescr;
+if (ODProfileLevelIndication==0x01) //no SL extension.
+{
+SLConfigDescriptor slConfigDescr;
+}
+else // SL extension is possible.
+{
+SLConfigDescriptor slConfigDescr;
+}
+IPI_DescrPointer ipiPtr[0 .. 1];
+IP_IdentificationDataSet ipIDS[0 .. 255];
+IPMP_DescriptorPointer ipmpDescrPtr[0 .. 255];
+LanguageDescriptor langDescr[0 .. 255];
+QoS_Descriptor qosDescr[0 .. 1];
+RegistrationDescriptor regDescr[0 .. 1];
+ExtensionDescriptor extDescr[0 .. 255];
+}
+ */
+@Descriptor(tags = {0x03})
+public class ESDescriptor extends BaseDescriptor {
+ private static Logger log = Logger.getLogger(ESDescriptor.class.getName());
+
+ int esId;
+ int streamDependenceFlag;
+ int URLFlag;
+ int oCRstreamFlag;
+ int streamPriority;
+
+
+ int URLLength = 0;
+ String URLString;
+ int remoteODFlag;
+
+ int dependsOnEsId;
+ int oCREsId;
+
+ DecoderConfigDescriptor decoderConfigDescriptor;
+ SLConfigDescriptor slConfigDescriptor;
+ List<BaseDescriptor> otherDescriptors = new ArrayList<BaseDescriptor>();
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ esId = IsoTypeReader.readUInt16(bb);
+
+ int data = IsoTypeReader.readUInt8(bb);
+ streamDependenceFlag = data >>> 7;
+ URLFlag = (data >>> 6) & 0x1;
+ oCRstreamFlag = (data >>> 5) & 0x1;
+ streamPriority = data & 0x1f;
+
+ if (streamDependenceFlag == 1) {
+ dependsOnEsId = IsoTypeReader.readUInt16(bb);
+ }
+ if (URLFlag == 1) {
+ URLLength = IsoTypeReader.readUInt8(bb);
+ URLString = IsoTypeReader.readString(bb, URLLength);
+ }
+ if (oCRstreamFlag == 1) {
+ oCREsId = IsoTypeReader.readUInt16(bb);
+ }
+
+ int baseSize = 1 /*tag*/ + getSizeBytes() + 2 + 1 + (streamDependenceFlag == 1 ? 2 : 0) + (URLFlag == 1 ? 1 + URLLength : 0) + (oCRstreamFlag == 1 ? 2 : 0);
+
+ int begin = bb.position();
+ if (getSize() > baseSize + 2) {
+ BaseDescriptor descriptor = ObjectDescriptorFactory.createFrom(-1, bb);
+ final long read = bb.position() - begin;
+ log.finer(descriptor + " - ESDescriptor1 read: " + read + ", size: " + (descriptor != null ? descriptor.getSize() : null));
+ if (descriptor != null) {
+ final int size = descriptor.getSize();
+ bb.position(begin + size);
+ baseSize += size;
+ } else {
+ baseSize += read;
+ }
+ if (descriptor instanceof DecoderConfigDescriptor) {
+ decoderConfigDescriptor = (DecoderConfigDescriptor) descriptor;
+ }
+ }
+
+ begin = bb.position();
+ if (getSize() > baseSize + 2) {
+ BaseDescriptor descriptor = ObjectDescriptorFactory.createFrom(-1, bb);
+ final long read = bb.position() - begin;
+ log.finer(descriptor + " - ESDescriptor2 read: " + read + ", size: " + (descriptor != null ? descriptor.getSize() : null));
+ if (descriptor != null) {
+ final int size = descriptor.getSize();
+ bb.position(begin + size);
+ baseSize += size;
+ } else {
+ baseSize += read;
+ }
+ if (descriptor instanceof SLConfigDescriptor) {
+ slConfigDescriptor = (SLConfigDescriptor) descriptor;
+ }
+ } else {
+ log.warning("SLConfigDescriptor is missing!");
+ }
+
+ while (getSize() - baseSize > 2) {
+ begin = bb.position();
+ BaseDescriptor descriptor = ObjectDescriptorFactory.createFrom(-1, bb);
+ final long read = bb.position() - begin;
+ log.finer(descriptor + " - ESDescriptor3 read: " + read + ", size: " + (descriptor != null ? descriptor.getSize() : null));
+ if (descriptor != null) {
+ final int size = descriptor.getSize();
+ bb.position(begin + size);
+ baseSize += size;
+ } else {
+ baseSize += read;
+ }
+ otherDescriptors.add(descriptor);
+ }
+ }
+ public int serializedSize() {
+ int out = 5;
+ if (streamDependenceFlag > 0) {
+ out += 2;
+ }
+ if (URLFlag > 0) {
+ out += 1 + URLLength;
+ }
+ if (oCRstreamFlag > 0) {
+ out += 2;
+ }
+
+ out += decoderConfigDescriptor.serializedSize();
+ out += slConfigDescriptor.serializedSize();
+
+ // Doesn't handle other descriptors yet
+
+ return out;
+ }
+
+ public ByteBuffer serialize() {
+ ByteBuffer out = ByteBuffer.allocate(serializedSize()); // Usually is around 30 bytes, so 200 should be enough...
+ IsoTypeWriter.writeUInt8(out, 3);
+ IsoTypeWriter.writeUInt8(out, serializedSize() - 2); // Not OK for longer sizes!
+ IsoTypeWriter.writeUInt16(out, esId);
+ int flags = (streamDependenceFlag << 7) | (URLFlag << 6) | (oCRstreamFlag << 5) | (streamPriority & 0x1f);
+ IsoTypeWriter.writeUInt8(out, flags);
+ if (streamDependenceFlag > 0) {
+ IsoTypeWriter.writeUInt16(out, dependsOnEsId);
+ }
+ if (URLFlag > 0) {
+ IsoTypeWriter.writeUInt8(out, URLLength);
+ IsoTypeWriter.writeUtf8String(out, URLString);
+ }
+ if (oCRstreamFlag > 0) {
+ IsoTypeWriter.writeUInt16(out, oCREsId);
+ }
+
+ ByteBuffer dec = decoderConfigDescriptor.serialize();
+ ByteBuffer sl = slConfigDescriptor.serialize();
+ out.put(dec.array());
+ out.put(sl.array());
+
+ // Doesn't handle other descriptors yet
+
+ return out;
+ }
+
+// @Override
+// public int getSize() {
+// return 3 + (streamDependenceFlag == 1 ? 2 : 0) +
+// (URLFlag == 1 ? 1 + 8 * URLLength : 0) +
+// (oCRstreamFlag == 1 ? 2 : 0);
+// }
+
+ public DecoderConfigDescriptor getDecoderConfigDescriptor() {
+ return decoderConfigDescriptor;
+ }
+
+ public SLConfigDescriptor getSlConfigDescriptor() {
+ return slConfigDescriptor;
+ }
+
+ public void setDecoderConfigDescriptor(DecoderConfigDescriptor decoderConfigDescriptor) {
+ this.decoderConfigDescriptor = decoderConfigDescriptor;
+ }
+
+ public void setSlConfigDescriptor(SLConfigDescriptor slConfigDescriptor) {
+ this.slConfigDescriptor = slConfigDescriptor;
+ }
+
+ public List<BaseDescriptor> getOtherDescriptors() {
+ return otherDescriptors;
+ }
+
+ public int getoCREsId() {
+ return oCREsId;
+ }
+
+ public void setoCREsId(int oCREsId) {
+ this.oCREsId = oCREsId;
+ }
+
+ public int getEsId() {
+ return esId;
+ }
+
+ public void setEsId(int esId) {
+ this.esId = esId;
+ }
+
+ public int getStreamDependenceFlag() {
+ return streamDependenceFlag;
+ }
+
+ public void setStreamDependenceFlag(int streamDependenceFlag) {
+ this.streamDependenceFlag = streamDependenceFlag;
+ }
+
+ public int getURLFlag() {
+ return URLFlag;
+ }
+
+ public void setURLFlag(int URLFlag) {
+ this.URLFlag = URLFlag;
+ }
+
+ public int getoCRstreamFlag() {
+ return oCRstreamFlag;
+ }
+
+ public void setoCRstreamFlag(int oCRstreamFlag) {
+ this.oCRstreamFlag = oCRstreamFlag;
+ }
+
+ public int getStreamPriority() {
+ return streamPriority;
+ }
+
+ public void setStreamPriority(int streamPriority) {
+ this.streamPriority = streamPriority;
+ }
+
+ public int getURLLength() {
+ return URLLength;
+ }
+
+ public void setURLLength(int URLLength) {
+ this.URLLength = URLLength;
+ }
+
+ public String getURLString() {
+ return URLString;
+ }
+
+ public void setURLString(String URLString) {
+ this.URLString = URLString;
+ }
+
+ public int getRemoteODFlag() {
+ return remoteODFlag;
+ }
+
+ public void setRemoteODFlag(int remoteODFlag) {
+ this.remoteODFlag = remoteODFlag;
+ }
+
+ public int getDependsOnEsId() {
+ return dependsOnEsId;
+ }
+
+ public void setDependsOnEsId(int dependsOnEsId) {
+ this.dependsOnEsId = dependsOnEsId;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("ESDescriptor");
+ sb.append("{esId=").append(esId);
+ sb.append(", streamDependenceFlag=").append(streamDependenceFlag);
+ sb.append(", URLFlag=").append(URLFlag);
+ sb.append(", oCRstreamFlag=").append(oCRstreamFlag);
+ sb.append(", streamPriority=").append(streamPriority);
+ sb.append(", URLLength=").append(URLLength);
+ sb.append(", URLString='").append(URLString).append('\'');
+ sb.append(", remoteODFlag=").append(remoteODFlag);
+ sb.append(", dependsOnEsId=").append(dependsOnEsId);
+ sb.append(", oCREsId=").append(oCREsId);
+ sb.append(", decoderConfigDescriptor=").append(decoderConfigDescriptor);
+ sb.append(", slConfigDescriptor=").append(slConfigDescriptor);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ESDescriptor that = (ESDescriptor) o;
+
+ if (URLFlag != that.URLFlag) return false;
+ if (URLLength != that.URLLength) return false;
+ if (dependsOnEsId != that.dependsOnEsId) return false;
+ if (esId != that.esId) return false;
+ if (oCREsId != that.oCREsId) return false;
+ if (oCRstreamFlag != that.oCRstreamFlag) return false;
+ if (remoteODFlag != that.remoteODFlag) return false;
+ if (streamDependenceFlag != that.streamDependenceFlag) return false;
+ if (streamPriority != that.streamPriority) return false;
+ if (URLString != null ? !URLString.equals(that.URLString) : that.URLString != null) return false;
+ if (decoderConfigDescriptor != null ? !decoderConfigDescriptor.equals(that.decoderConfigDescriptor) : that.decoderConfigDescriptor != null)
+ return false;
+ if (otherDescriptors != null ? !otherDescriptors.equals(that.otherDescriptors) : that.otherDescriptors != null)
+ return false;
+ if (slConfigDescriptor != null ? !slConfigDescriptor.equals(that.slConfigDescriptor) : that.slConfigDescriptor != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = esId;
+ result = 31 * result + streamDependenceFlag;
+ result = 31 * result + URLFlag;
+ result = 31 * result + oCRstreamFlag;
+ result = 31 * result + streamPriority;
+ result = 31 * result + URLLength;
+ result = 31 * result + (URLString != null ? URLString.hashCode() : 0);
+ result = 31 * result + remoteODFlag;
+ result = 31 * result + dependsOnEsId;
+ result = 31 * result + oCREsId;
+ result = 31 * result + (decoderConfigDescriptor != null ? decoderConfigDescriptor.hashCode() : 0);
+ result = 31 * result + (slConfigDescriptor != null ? slConfigDescriptor.hashCode() : 0);
+ result = 31 * result + (otherDescriptors != null ? otherDescriptors.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionDescriptor.java.svn-base
new file mode 100644
index 0000000..7933f5a
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionDescriptor.java.svn-base
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.Hex;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.logging.Logger;
+
+/**
+ * abstract class ExtensionDescriptor extends BaseDescriptor
+ * : bit(8) tag = ExtensionProfileLevelDescrTag, ExtDescrTagStartRange ..
+ * ExtDescrTagEndRange {
+ * // empty. To be filled by classes extending this class.
+ * }
+ */
+@Descriptor(tags = {0x13, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253})
+public class ExtensionDescriptor extends BaseDescriptor {
+ private static Logger log = Logger.getLogger(ExtensionDescriptor.class.getName());
+
+ byte[] bytes;
+
+
+ //todo: add this better to the tags list?
+ //14496-1:2010 p.20:
+ //0x6A-0xBF Reserved for ISO use
+ //0xC0-0xFE User private
+ //
+ //ExtDescrTagStartRange = 0x6A
+ //ExtDescrTagEndRange = 0xFE
+ static int[] allTags() {
+ int[] ints = new int[0xFE - 0x6A];
+
+ for (int i = 0x6A; i < 0xFE; i++) {
+ final int pos = i - 0x6A;
+ log.finest("pos:" + pos);
+ ints[pos] = i;
+ }
+ return ints;
+ }
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ if (getSize() > 0) {
+ bytes = new byte[sizeOfInstance];
+ bb.get(bytes);
+ }
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("ExtensionDescriptor");
+ sb.append("{bytes=").append(bytes == null ? "null" : Hex.encodeHex(bytes));
+ sb.append('}');
+ return sb.toString();
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionProfileLevelDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionProfileLevelDescriptor.java.svn-base
new file mode 100644
index 0000000..0cf4915
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ExtensionProfileLevelDescriptor.java.svn-base
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.Hex;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * abstract class ExtensionDescriptor extends BaseDescriptor
+ * : bit(8) tag = ExtensionProfileLevelDescrTag, ExtDescrTagStartRange ..
+ * ExtDescrTagEndRange {
+ * // empty. To be filled by classes extending this class.
+ * }
+ */
+@Descriptor(tags = {0x13})
+public class ExtensionProfileLevelDescriptor extends BaseDescriptor {
+ byte[] bytes;
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ if (getSize() > 0) {
+ bytes = new byte[getSize()];
+ bb.get(bytes);
+ }
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("ExtensionDescriptor");
+ sb.append("{bytes=").append(bytes == null ? "null" : Hex.encodeHex(bytes));
+ sb.append('}');
+ return sb.toString();
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/InitialObjectDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/InitialObjectDescriptor.java.svn-base
new file mode 100644
index 0000000..7a1f094
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/InitialObjectDescriptor.java.svn-base
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+
+import com.coremedia.iso.IsoTypeReader;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+class InitialObjectDescriptor extends ObjectDescriptorBase : bit(8)
+tag=InitialObjectDescrTag {
+bit(10) ObjectDescriptorID;
+bit(1) URL_Flag;
+bit(1) includeInlineProfileLevelFlag;
+const bit(4) reserved=0b1111;
+if (URL_Flag) {
+bit(8) URLlength;
+bit(8) URLstring[URLlength];
+} else {
+bit(8) ODProfileLevelIndication;
+bit(8) sceneProfileLevelIndication;
+bit(8) audioProfileLevelIndication;
+bit(8) visualProfileLevelIndication;
+bit(8) graphicsProfileLevelIndication;
+ES_Descriptor esDescr[1 .. 255];
+OCI_Descriptor ociDescr[0 .. 255];
+IPMP_DescriptorPointer ipmpDescrPtr[0 .. 255];
+IPMP_Descriptor ipmpDescr [0 .. 255];
+IPMP_ToolListDescriptor toolListDescr[0 .. 1];
+}
+ExtensionDescriptor extDescr[0 .. 255];
+}
+*/
+//@Descriptor(tags = {0x02, 0x10})
+public class InitialObjectDescriptor extends ObjectDescriptorBase {
+ private int objectDescriptorId;
+ int urlFlag;
+ int includeInlineProfileLevelFlag;
+
+ int urlLength;
+ String urlString;
+
+ int oDProfileLevelIndication;
+ int sceneProfileLevelIndication;
+ int audioProfileLevelIndication;
+ int visualProfileLevelIndication;
+ int graphicsProfileLevelIndication;
+
+ List<ESDescriptor> esDescriptors = new ArrayList<ESDescriptor>();
+
+ List<ExtensionDescriptor> extensionDescriptors = new ArrayList<ExtensionDescriptor>();
+
+ List<BaseDescriptor> unknownDescriptors = new ArrayList<BaseDescriptor>();
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ int data = IsoTypeReader.readUInt16(bb);
+ objectDescriptorId = (data & 0xFFC0) >> 6;
+
+ urlFlag = (data & 0x3F) >> 5;
+ includeInlineProfileLevelFlag = (data & 0x1F) >> 4;
+
+ int sizeLeft = getSize() - 2;
+ if (urlFlag == 1) {
+ urlLength = IsoTypeReader.readUInt8(bb);
+ urlString = IsoTypeReader.readString(bb, urlLength);
+ sizeLeft = sizeLeft - (1 + urlLength);
+ } else {
+ oDProfileLevelIndication = IsoTypeReader.readUInt8(bb);
+ sceneProfileLevelIndication = IsoTypeReader.readUInt8(bb);
+ audioProfileLevelIndication = IsoTypeReader.readUInt8(bb);
+ visualProfileLevelIndication = IsoTypeReader.readUInt8(bb);
+ graphicsProfileLevelIndication = IsoTypeReader.readUInt8(bb);
+
+ sizeLeft = sizeLeft - 5;
+
+ if (sizeLeft > 2) {
+ final BaseDescriptor descriptor = ObjectDescriptorFactory.createFrom(-1, bb);
+ sizeLeft = sizeLeft - descriptor.getSize();
+ if (descriptor instanceof ESDescriptor) {
+ esDescriptors.add((ESDescriptor) descriptor);
+ } else {
+ unknownDescriptors.add(descriptor);
+ }
+ }
+ }
+
+ if (sizeLeft > 2) {
+ final BaseDescriptor descriptor = ObjectDescriptorFactory.createFrom(-1, bb);
+ if (descriptor instanceof ExtensionDescriptor) {
+ extensionDescriptors.add((ExtensionDescriptor) descriptor);
+ } else {
+ unknownDescriptors.add(descriptor);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("InitialObjectDescriptor");
+ sb.append("{objectDescriptorId=").append(objectDescriptorId);
+ sb.append(", urlFlag=").append(urlFlag);
+ sb.append(", includeInlineProfileLevelFlag=").append(includeInlineProfileLevelFlag);
+ sb.append(", urlLength=").append(urlLength);
+ sb.append(", urlString='").append(urlString).append('\'');
+ sb.append(", oDProfileLevelIndication=").append(oDProfileLevelIndication);
+ sb.append(", sceneProfileLevelIndication=").append(sceneProfileLevelIndication);
+ sb.append(", audioProfileLevelIndication=").append(audioProfileLevelIndication);
+ sb.append(", visualProfileLevelIndication=").append(visualProfileLevelIndication);
+ sb.append(", graphicsProfileLevelIndication=").append(graphicsProfileLevelIndication);
+ sb.append(", esDescriptors=").append(esDescriptors);
+ sb.append(", extensionDescriptors=").append(extensionDescriptors);
+ sb.append(", unknownDescriptors=").append(unknownDescriptors);
+ sb.append('}');
+ return sb.toString();
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptor.java_bak.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptor.java_bak.svn-base
new file mode 100644
index 0000000..c5cb586
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptor.java_bak.svn-base
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.IsoTypeReader;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+class ObjectDescriptor extends ObjectDescriptorBase : bit(8) tag=ObjectDescrTag {
+bit(10) ObjectDescriptorID;
+bit(1) URL_Flag;
+const bit(5) reserved=0b1111.1;
+if (URL_Flag) {
+bit(8) URLlength;
+bit(8) URLstring[URLlength];
+} else {
+ES_Descriptor esDescr[1 .. 255];
+OCI_Descriptor ociDescr[0 .. 255];
+IPMP_DescriptorPointer ipmpDescrPtr[0 .. 255];
+IPMP_Descriptor ipmpDescr [0 .. 255];
+}
+ExtensionDescriptor extDescr[0 .. 255];
+}
+*/
+@Descriptor(tags = {0x01, 0x11})
+public class ObjectDescriptor extends ObjectDescriptorBase {
+ private int objectDescriptorId;
+ int objectDescriptorUrlFlag;
+ int objectDescriptorUrlLength;
+ String objectDescriptorUrlString;
+
+
+ private int streamCount;
+ private int extensionFlag;
+ private List<ESDescriptor> esDescriptors = new ArrayList<ESDescriptor>();
+
+ private int descriptorLength;
+ private List<ExtensionDescriptor> extensionDescriptors = new ArrayList<ExtensionDescriptor>();
+
+ public static ObjectDescriptor createFrom(ByteBuffer in) throws IOException {
+/*
+ tmp = in.readUInt16();
+ esDescriptor.objectDescriptorId = tmp & 0x3f;
+ esDescriptor.objectDescriptorUrlFlag = (tmp >> 5) & 0x1;
+ if (esDescriptor.objectDescriptorUrlFlag == 1) {
+ esDescriptor.objectDescriptorUrlLength = in.readUInt8();
+ esDescriptor.objectDescriptorUrlString = new String(in.read(esDescriptor.objectDescriptorUrlLength));
+ }
+ */
+
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor();
+
+ int data = IsoTypeReader.readUInt16(in);
+
+ objectDescriptor.objectDescriptorId = data & 0xFFC0;
+ objectDescriptor.streamCount = data & 0x3E;
+ objectDescriptor.extensionFlag = data & 0x1;
+
+// for (int i = 0; i < objectDescriptor.streamCount; i++) {
+// objectDescriptor.esDescriptors.add(ESDescriptor.createFrom(in));
+// }
+//
+// if (objectDescriptor.extensionFlag == 1) {
+// objectDescriptor.descriptorLength = in.readUInt8();
+// for (int i = 0; i < objectDescriptor.descriptorLength;) {
+// ExtensionDescriptor extensionDescriptor = ExtensionDescriptor.createFrom(in);
+// objectDescriptor.extensionDescriptors.add(extensionDescriptor);
+// i = i + extensionDescriptor.descriptorDataLength + 1;
+// }
+// }
+
+ return objectDescriptor;
+ }
+
+ @Override
+ public String toString() {
+ return "ObjectDescriptor{" +
+ "objectDescriptorId=" + objectDescriptorId +
+ ", streamCount=" + streamCount +
+ ", extensionFlag=" + extensionFlag +
+ ", esDescriptors=" + esDescriptors +
+ ", descriptorLength=" + descriptorLength +
+ ", extensionDescriptors=" + extensionDescriptors +
+ '}';
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorBase.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorBase.java.svn-base
new file mode 100644
index 0000000..69a8684
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorBase.java.svn-base
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+/*
+abstract class ObjectDescriptorBase extends BaseDescriptor : bit(8)
+tag=[ObjectDescrTag..InitialObjectDescrTag] {
+// empty. To be filled by classes extending this class.
+}
+ */
+@Descriptor(tags = 0x00)
+public abstract class ObjectDescriptorBase extends BaseDescriptor {
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorFactory.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorFactory.java.svn-base
new file mode 100644
index 0000000..6afba55
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ObjectDescriptorFactory.java.svn-base
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.IsoTypeReader;
+
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/* class tag values of 14496-1
+0x00 Forbidden
+0x01 ObjectDescrTag
+0x02 InitialObjectDescrTag
+0x03 ES_DescrTag
+0x04 DecoderConfigDescrTag
+0x05 DecSpecificInfoTag
+0x06 SLConfigDescrTag
+0x07 ContentIdentDescrTag
+0x08 SupplContentIdentDescrTag
+0x09 IPI_DescrPointerTag
+0x0A IPMP_DescrPointerTag
+0x0B IPMP_DescrTag
+0x0C QoS_DescrTag
+0x0D RegistrationDescrTag
+0x0E ES_ID_IncTag
+0x0F ES_ID_RefTag
+0x10 MP4_IOD_Tag
+0x11 MP4_OD_Tag
+0x12 IPL_DescrPointerRefTag
+0x13 ExtensionProfileLevelDescrTag
+0x14 profileLevelIndicationIndexDescrTag
+0x15-0x3F Reserved for ISO use
+0x40 ContentClassificationDescrTag
+0x41 KeyWordDescrTag
+0x42 RatingDescrTag
+0x43 LanguageDescrTag
+0x44 ShortTextualDescrTag
+0x45 ExpandedTextualDescrTag
+0x46 ContentCreatorNameDescrTag
+0x47 ContentCreationDateDescrTag
+0x48 OCICreatorNameDescrTag
+0x49 OCICreationDateDescrTag
+0x4A SmpteCameraPositionDescrTag
+0x4B SegmentDescrTag
+0x4C MediaTimeDescrTag
+0x4D-0x5F Reserved for ISO use (OCI extensions)
+0x60 IPMP_ToolsListDescrTag
+0x61 IPMP_ToolTag
+0x62 M4MuxTimingDescrTag
+0x63 M4MuxCodeTableDescrTag
+0x64 ExtSLConfigDescrTag
+0x65 M4MuxBufferSizeDescrTag
+0x66 M4MuxIdentDescrTag
+0x67 DependencyPointerTag
+0x68 DependencyMarkerTag
+0x69 M4MuxChannelDescrTag
+0x6A-0xBF Reserved for ISO use
+0xC0-0xFE User private
+0xFF Forbidden
+ */
+
+/* objectTypeIndication as of 14496-1
+0x00 Forbidden
+0x01 Systems ISO/IEC 14496-1 a
+0x02 Systems ISO/IEC 14496-1 b
+0x03 Interaction Stream
+0x04 Systems ISO/IEC 14496-1 Extended BIFS Configuration c
+0x05 Systems ISO/IEC 14496-1 AFX d
+0x06 Font Data Stream
+0x07 Synthesized Texture Stream
+0x08 Streaming Text Stream
+0x09-0x1F reserved for ISO use
+0x20 Visual ISO/IEC 14496-2 e
+0x21 Visual ITU-T Recommendation H.264 | ISO/IEC 14496-10 f
+0x22 Parameter Sets for ITU-T Recommendation H.264 | ISO/IEC 14496-10 f
+0x23-0x3F reserved for ISO use
+0x40 Audio ISO/IEC 14496-3 g
+0x41-0x5F reserved for ISO use
+0x60 Visual ISO/IEC 13818-2 Simple Profile
+0x61 Visual ISO/IEC 13818-2 Main Profile
+0x62 Visual ISO/IEC 13818-2 SNR Profile
+0x63 Visual ISO/IEC 13818-2 Spatial Profile
+0x64 Visual ISO/IEC 13818-2 High Profile
+0x65 Visual ISO/IEC 13818-2 422 Profile
+0x66 Audio ISO/IEC 13818-7 Main Profile
+0x67 Audio ISO/IEC 13818-7 LowComplexity Profile
+0x68 Audio ISO/IEC 13818-7 Scaleable Sampling Rate Profile
+0x69 Audio ISO/IEC 13818-3
+0x6A Visual ISO/IEC 11172-2
+0x6B Audio ISO/IEC 11172-3
+0x6C Visual ISO/IEC 10918-1
+0x6D reserved for registration authority
+0x6E Visual ISO/IEC 15444-1
+0x6F - 0x9F reserved for ISO use
+0xA0 - 0xBF reserved for registration authority i
+0xC0 - 0xE0 user private
+0xE1 reserved for registration authority i
+0xE2 - 0xFE user private
+0xFF no object type specified h
+ */
+public class ObjectDescriptorFactory {
+ protected static Logger log = Logger.getLogger(ObjectDescriptorFactory.class.getName());
+
+ protected static Map<Integer, Map<Integer, Class<? extends BaseDescriptor>>> descriptorRegistry = new HashMap<Integer, Map<Integer, Class<? extends BaseDescriptor>>>();
+
+ static {
+ Set<Class<? extends BaseDescriptor>> annotated = new HashSet<Class<? extends BaseDescriptor>>();
+
+ annotated.add(DecoderSpecificInfo.class);
+ annotated.add(SLConfigDescriptor.class);
+ annotated.add(BaseDescriptor.class);
+ annotated.add(ExtensionDescriptor.class);
+ annotated.add(ObjectDescriptorBase.class);
+ annotated.add(ProfileLevelIndicationDescriptor.class);
+ annotated.add(AudioSpecificConfig.class);
+ annotated.add(ExtensionProfileLevelDescriptor.class);
+ annotated.add(ESDescriptor.class);
+ annotated.add(DecoderConfigDescriptor.class);
+ //annotated.add(ObjectDescriptor.class);
+
+ for (Class<? extends BaseDescriptor> clazz : annotated) {
+ final Descriptor descriptor = clazz.getAnnotation(Descriptor.class);
+ final int[] tags = descriptor.tags();
+ final int objectTypeInd = descriptor.objectTypeIndication();
+
+ Map<Integer, Class<? extends BaseDescriptor>> tagMap = descriptorRegistry.get(objectTypeInd);
+ if (tagMap == null) {
+ tagMap = new HashMap<Integer, Class<? extends BaseDescriptor>>();
+ }
+ for (int tag : tags) {
+ tagMap.put(tag, clazz);
+ }
+ descriptorRegistry.put(objectTypeInd, tagMap);
+ }
+ }
+
+ public static BaseDescriptor createFrom(int objectTypeIndication, ByteBuffer bb) throws IOException {
+ int tag = IsoTypeReader.readUInt8(bb);
+
+ Map<Integer, Class<? extends BaseDescriptor>> tagMap = descriptorRegistry.get(objectTypeIndication);
+ if (tagMap == null) {
+ tagMap = descriptorRegistry.get(-1);
+ }
+ Class<? extends BaseDescriptor> aClass = tagMap.get(tag);
+
+// if (tag == 0x00) {
+// log.warning("Found illegal tag 0x00! objectTypeIndication " + Integer.toHexString(objectTypeIndication) +
+// " and tag " + Integer.toHexString(tag) + " using: " + aClass);
+// aClass = BaseDescriptor.class;
+// }
+
+ BaseDescriptor baseDescriptor;
+ if (aClass == null || aClass.isInterface() || Modifier.isAbstract(aClass.getModifiers())) {
+ log.warning("No ObjectDescriptor found for objectTypeIndication " + Integer.toHexString(objectTypeIndication) +
+ " and tag " + Integer.toHexString(tag) + " found: " + aClass);
+ baseDescriptor = new UnknownDescriptor();
+ } else {
+ try {
+ baseDescriptor = aClass.newInstance();
+ } catch (Exception e) {
+ log.log(Level.SEVERE, "Couldn't instantiate BaseDescriptor class " + aClass + " for objectTypeIndication " + objectTypeIndication + " and tag " + tag, e);
+ throw new RuntimeException(e);
+ }
+ }
+ baseDescriptor.parse(tag, bb);
+ return baseDescriptor;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ProfileLevelIndicationDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ProfileLevelIndicationDescriptor.java.svn-base
new file mode 100644
index 0000000..625277e
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/ProfileLevelIndicationDescriptor.java.svn-base
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.IsoTypeReader;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * class ProfileLevelIndicationIndexDescriptor () extends BaseDescriptor
+ * : bit(8) ProfileLevelIndicationIndexDescrTag {
+ * bit(8) profileLevelIndicationIndex;
+ * }
+ */
+@Descriptor(tags = 0x14)
+public class ProfileLevelIndicationDescriptor extends BaseDescriptor {
+ int profileLevelIndicationIndex;
+
+ @Override
+ public void parseDetail( ByteBuffer bb) throws IOException {
+ profileLevelIndicationIndex = IsoTypeReader.readUInt8(bb);
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("ProfileLevelIndicationDescriptor");
+ sb.append("{profileLevelIndicationIndex=").append(Integer.toHexString(profileLevelIndicationIndex));
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ProfileLevelIndicationDescriptor that = (ProfileLevelIndicationDescriptor) o;
+
+ if (profileLevelIndicationIndex != that.profileLevelIndicationIndex) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return profileLevelIndicationIndex;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/SLConfigDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/SLConfigDescriptor.java.svn-base
new file mode 100644
index 0000000..70a58e6
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/SLConfigDescriptor.java.svn-base
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import com.coremedia.iso.IsoTypeReader;
+import com.coremedia.iso.IsoTypeWriter;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * class SLConfigDescriptor extends BaseDescriptor : bit(8) tag=SLConfigDescrTag {
+ * bit(8) predefined;
+ * if (predefined==0) {
+ * bit(1) useAccessUnitStartFlag;
+ * bit(1) useAccessUnitEndFlag;
+ * bit(1) useRandomAccessPointFlag;
+ * bit(1) hasRandomAccessUnitsOnlyFlag;
+ * bit(1) usePaddingFlag;
+ * bit(1) useTimeStampsFlag;
+ * bit(1) useIdleFlag;
+ * bit(1) durationFlag;
+ * bit(32) timeStampResolution;
+ * bit(32) OCRResolution;
+ * bit(8) timeStampLength; // must be ≤ 64
+ * bit(8) OCRLength; // must be ≤ 64
+ * bit(8) AU_Length; // must be ≤ 32
+ * bit(8) instantBitrateLength;
+ * bit(4) degradationPriorityLength;
+ * bit(5) AU_seqNumLength; // must be ≤ 16
+ * bit(5) packetSeqNumLength; // must be ≤ 16
+ * bit(2) reserved=0b11;
+ * }
+ * if (durationFlag) {
+ * bit(32) timeScale;
+ * bit(16) accessUnitDuration;
+ * bit(16) compositionUnitDuration;
+ * }
+ * if (!useTimeStampsFlag) {
+ * bit(timeStampLength) startDecodingTimeStamp;
+ * bit(timeStampLength) startCompositionTimeStamp;
+ * }
+ * }
+ */
+@Descriptor(tags = {0x06})
+public class SLConfigDescriptor extends BaseDescriptor {
+ int predefined;
+
+ public int getPredefined() {
+ return predefined;
+ }
+
+ public void setPredefined(int predefined) {
+ this.predefined = predefined;
+ }
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ predefined = IsoTypeReader.readUInt8(bb);
+ }
+
+ public int serializedSize() {
+ return 3;
+ }
+
+ public ByteBuffer serialize() {
+ ByteBuffer out = ByteBuffer.allocate(3);
+ IsoTypeWriter.writeUInt8(out, 6);
+ IsoTypeWriter.writeUInt8(out, 1);
+ IsoTypeWriter.writeUInt8(out, predefined);
+ return out;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("SLConfigDescriptor");
+ sb.append("{predefined=").append(predefined);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ SLConfigDescriptor that = (SLConfigDescriptor) o;
+
+ if (predefined != that.predefined) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return predefined;
+ }
+}
diff --git a/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/UnknownDescriptor.java.svn-base b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/UnknownDescriptor.java.svn-base
new file mode 100644
index 0000000..dd75a0f
--- /dev/null
+++ b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/.svn/text-base/UnknownDescriptor.java.svn-base
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2011 castLabs, Berlin
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.logging.Logger;
+
+public class UnknownDescriptor extends BaseDescriptor {
+ private ByteBuffer data;
+ private static Logger log = Logger.getLogger(UnknownDescriptor.class.getName());
+
+ @Override
+ public void parseDetail(ByteBuffer bb) throws IOException {
+ data = (ByteBuffer) bb.slice().limit(this.getSizeOfInstance());
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("UnknownDescriptor");
+ sb.append("{tag=").append(tag);
+ sb.append(", sizeOfInstance=").append(sizeOfInstance);
+ sb.append(", data=").append(data);
+ sb.append('}');
+ return sb.toString();
+ }
+}