Beispiel #1
0
        public override void decode(MP4InputStream inStream)
        {
            // 10 bits objectDescriptorID, 1 bit url flag, 1 bit
            // includeInlineProfiles flag, 4 bits reserved
            int x = (int)inStream.readBytes(2);

            objectDescriptorID    = (x >> 6) & 0x3FF;
            urlPresent            = ((x >> 5) & 1) == 1;
            includeInlineProfiles = ((x >> 4) & 1) == 1;

            if (urlPresent)
            {
                url = inStream.readString(size - 2);
            }
            else
            {
                odProfile       = inStream.read();
                sceneProfile    = inStream.read();
                audioProfile    = inStream.read();
                visualProfile   = inStream.read();
                graphicsProfile = inStream.read();
            }

            readChildren(inStream);
        }
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            bool compact = type == BoxType.COMPACT_SAMPLE_SIZE_BOX;

            int sampleSize;

            if (compact)
            {
                inStream.skipBytes(3);
                sampleSize = inStream.read();
            }
            else
            {
                sampleSize = (int)inStream.readBytes(4);
            }

            int sampleCount = (int)inStream.readBytes(4);

            sampleSizes = new long[sampleCount];

            if (compact)
            {
                // compact: sampleSize can be 4, 8 or 16 bits
                if (sampleSize == 4)
                {
                    for (int i = 0; i < sampleCount; i += 2)
                    {
                        int x = inStream.read();
                        sampleSizes[i]     = (x >> 4) & 0xF;
                        sampleSizes[i + 1] = x & 0xF;
                    }
                }
                else
                {
                    readSizes(inStream, sampleSize / 8);
                }
            }
            else if (sampleSize == 0)
            {
                readSizes(inStream, 4);
            }
            else
            {
                for (int i = 0; i < sampleSizes.Length; i++)
                {
                    sampleSizes[i] = sampleSize;
                }
            }
        }
        public override void decode(MP4InputStream inStream)
        {
            objectProfile = inStream.read();
            //6 bits stream type, 1 bit upstream flag, 1 bit reserved
            int x = inStream.read();

            streamType = (x >> 2) & 0x3F;
            upstream   = ((x >> 1) & 1) == 1;

            decodingBufferSize = (int)inStream.readBytes(3);
            maxBitRate         = inStream.readBytes(4);
            averageBitRate     = inStream.readBytes(4);

            readChildren(inStream);
        }
Beispiel #4
0
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            inStream.skipBytes(2); //pre-defined: 0
            inStream.skipBytes(2); //reserved
            // 3x32 pre_defined
            inStream.skipBytes(4); //pre-defined: 0
            inStream.skipBytes(4); //pre-defined: 0
            inStream.skipBytes(4); //pre-defined: 0

            width  = (int)inStream.readBytes(2);
            height = (int)inStream.readBytes(2);
            horizontalResolution = inStream.readFixedPoint(16, 16);
            verticalResolution   = inStream.readFixedPoint(16, 16);
            inStream.skipBytes(4); //reserved
            frameCount = (int)inStream.readBytes(2);

            int len = inStream.read();

            compressorName = inStream.readString(len);
            inStream.skipBytes(31 - len);

            depth = (int)inStream.readBytes(2);
            inStream.skipBytes(2); //pre-defined: -1

            readChildren(inStream);
        }
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            data = new byte[(int)getLeft(inStream)];
            inStream.read(data, 0, data.Length);
        }
        public override void decode(MP4InputStream inStream)
        {
            configurationVersion = inStream.read();
            profile = inStream.read();
            profileCompatibility = (byte)inStream.read();
            level = inStream.read();
            //6 bits reserved, 2 bits 'length size minus one'
            lengthSize = (inStream.read() & 3) + 1;

            int len;
            //3 bits reserved, 5 bits number of sequence parameter sets
            int sequenceParameterSets = inStream.read() & 31;

            sequenceParameterSetNALUnit = new byte[sequenceParameterSets][];
            for (int i = 0; i < sequenceParameterSets; i++)
            {
                len = (int)inStream.readBytes(2);
                sequenceParameterSetNALUnit[i] = inStream.readByteArray(len);
            }

            int pictureParameterSets = inStream.read();

            pictureParameterSetNALUnit = new byte[pictureParameterSets][];
            for (int i = 0; i < pictureParameterSets; i++)
            {
                len = (int)inStream.readBytes(2);
                pictureParameterSetNALUnit[i] = inStream.readByteArray(len);
            }
        }
Beispiel #7
0
 protected void decodeCommon(MP4InputStream inStream)
 {
     vendor         = inStream.readBytes(4);
     decoderVersion = inStream.read();
 }
 public override void decode(MP4InputStream inStream)
 {
     data = new byte[size];
     inStream.read(data, 0, data.Length);
 }
Beispiel #9
0
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            trackNumber = getLeft(inStream) > 0 ? inStream.read() : -1;
        }
 /// <summary>
 /// Decodes the given input stream by reading this box and all of its children (if any).
 /// </summary>
 /// <param name="inStream">an input stream</param>
 public override void decode(MP4InputStream inStream)
 {
     version = inStream.read();
     flags   = (int)inStream.readBytes(3);
 }