FileDocCategorySizeDatePackage
DecoderConfigDescriptor.javaAPI Docmp4parser 1.0-RC-179508Wed Dec 19 20:10:37 GMT 2012com.googlecode.mp4parser.boxes.mp4.objectdescriptors

DecoderConfigDescriptor

public class DecoderConfigDescriptor extends BaseDescriptor
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]; }

Fields Summary
private static Logger
log
int
objectTypeIndication
int
streamType
int
upStream
int
bufferSizeDB
long
maxBitRate
long
avgBitRate
DecoderSpecificInfo
decoderSpecificInfo
AudioSpecificConfig
audioSpecificInfo
List
profileLevelIndicationDescriptors
byte[]
configDescriptorDeadBytes
Constructors Summary
Methods Summary
public AudioSpecificConfiggetAudioSpecificInfo()

        return audioSpecificInfo;
    
public longgetAvgBitRate()

        return avgBitRate;
    
public intgetBufferSizeDB()

        return bufferSizeDB;
    
public DecoderSpecificInfogetDecoderSpecificInfo()

        return decoderSpecificInfo;
    
public longgetMaxBitRate()

        return maxBitRate;
    
public intgetObjectTypeIndication()

        return objectTypeIndication;
    
public java.util.ListgetProfileLevelIndicationDescriptors()

        return profileLevelIndicationDescriptors;
    
public intgetStreamType()

        return streamType;
    
public intgetUpStream()

        return upStream;
    
public voidparseDetail(java.nio.ByteBuffer bb)


    
          
        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 java.nio.ByteBufferserialize()

        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 intserializedSize()

        return 15 + audioSpecificInfo.serializedSize();
    
public voidsetAudioSpecificInfo(AudioSpecificConfig audioSpecificInfo)

        this.audioSpecificInfo = audioSpecificInfo;
    
public voidsetAvgBitRate(long avgBitRate)

        this.avgBitRate = avgBitRate;
    
public voidsetBufferSizeDB(int bufferSizeDB)

        this.bufferSizeDB = bufferSizeDB;
    
public voidsetMaxBitRate(long maxBitRate)

        this.maxBitRate = maxBitRate;
    
public voidsetObjectTypeIndication(int objectTypeIndication)

        this.objectTypeIndication = objectTypeIndication;
    
public voidsetStreamType(int streamType)

        this.streamType = streamType;
    
public voidsetUpStream(int upStream)

        this.upStream = upStream;
    
public java.lang.StringtoString()

        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();