public override void decode(MP4InputStream inStream)
        {
            if (getLeft(inStream) < 8)
            {
                inStream.skipBytes(getLeft(inStream));
                return;
            }

            base.decode(inStream);

            inStream.skipBytes(8); //reserved
            channelCount = (int)inStream.readBytes(2);
            sampleSize   = (int)inStream.readBytes(2);
            inStream.skipBytes(2); //pre-defined: 0
            inStream.skipBytes(2); //reserved
            sampleRate = (int)inStream.readBytes(2);
            inStream.skipBytes(2); //not used by samplerate

            if (channelCount == 6)
            {
                inStream.skipBytes(16);
            }

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

            int len = (version == 1) ? 8 : 4;

            creationTime     = inStream.readBytes(len);
            modificationTime = inStream.readBytes(len);
            timeScale        = inStream.readBytes(4);
            duration         = BoxUtils.detectUndetermined(inStream.readBytes(len));

            rate   = inStream.readFixedPoint(16, 16);
            volume = inStream.readFixedPoint(8, 8);

            inStream.skipBytes(10); //reserved

            for (int i = 0; i < 9; i++)
            {
                if (i < 6)
                {
                    matrix[i] = inStream.readFixedPoint(16, 16);
                }
                else
                {
                    matrix[i] = inStream.readFixedPoint(2, 30);
                }
            }

            inStream.skipBytes(24); //reserved

            nextTrackID = inStream.readBytes(4);
        }
Beispiel #3
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)
        {
            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 #5
0
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            schemeType    = (int)inStream.readBytes(4);
            schemeVersion = (int)inStream.readBytes(4);
            schemeURI     = (flags & 1) == 1 ? inStream.readUTFString((int)getLeft(inStream)) : null;
        }
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

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

            sampleNumbers = new long[entryCount];
            for (int i = 0; i < entryCount; i++)
            {
                sampleNumbers[i] = inStream.readBytes(4);
            }
        }
        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)
        {
            base.decode(inStream);

            int len        = (type == BoxType.CHUNK_LARGE_OFFSET_BOX) ? 8 : 4;
            int entryCount = (int)inStream.readBytes(4);

            chunks = new long[entryCount];

            for (int i = 0; i < entryCount; i++)
            {
                chunks[i] = inStream.readBytes(len);
            }
        }
Beispiel #9
0
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            int len = (version == 1) ? 8 : 4;

            creationTime     = inStream.readBytes(len);
            modificationTime = inStream.readBytes(len);
            timeScale        = inStream.readBytes(4);
            duration         = BoxUtils.detectUndetermined(inStream.readBytes(len));

            language = BoxUtils.getLanguageCode(inStream.readBytes(2));

            inStream.skipBytes(2); //pre-defined: 0
        }
        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);
        }
 private void readSizes(MP4InputStream inStream, int len)
 {
     for (int i = 0; i < sampleSizes.Length; i++)
     {
         sampleSizes[i] = inStream.readBytes(len);
     }
 }
Beispiel #12
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);
        }
Beispiel #13
0
        public override void decode(MP4InputStream inStream)
        {
            if (parent.getType() == BoxType.UNKNOWN_HNTI_BOX)
            {
                // mpeg4 iod
                string content = inStream.readString((int)getLeft(inStream));
            }
            else
            {
                base.decode(inStream);

                hintTrackVersion         = (int)inStream.readBytes(2);
                highestCompatibleVersion = (int)inStream.readBytes(2);
                maxPacketSize            = inStream.readBytes(4);
            }
        }
Beispiel #14
0
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

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

            firstChunks            = new long[entryCount];
            samplesPerChunk        = new long[entryCount];
            sampleDescriptionIndex = new long[entryCount];

            for (int i = 0; i < entryCount; i++)
            {
                firstChunks[i]            = inStream.readBytes(4);
                samplesPerChunk[i]        = inStream.readBytes(4);
                sampleDescriptionIndex[i] = inStream.readBytes(4);
            }
        }
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

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

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

            int entryCount = (int)inStream.readBytes(4);
            int len        = (version == 1) ? 8 : 4;

            segmentDuration = new long[entryCount];
            mediaTime       = new long[entryCount];
            mediaRate       = new double[entryCount];

            for (int i = 0; i < entryCount; i++)
            {
                segmentDuration[i] = inStream.readBytes(len);
                mediaTime[i]       = inStream.readBytes(len);

                //int(16) mediaRate_integer;
                //int(16) media_rate_fraction = 0;
                mediaRate[i] = inStream.readFixedPoint(16, 16);
            }
        }
        public override void decode(MP4InputStream inStream)
        {
            if (parent.getType() == BoxType.USER_DATA_BOX)
            {
                base.decode(inStream);
                //1 bit padding, 5*3 bits language code (ISO-639-2/T)
                languageCode = BoxUtils.getLanguageCode(inStream.readBytes(2));

                notice = inStream.readUTFString((int)getLeft(inStream));
            }
            else if (parent.getType() == BoxType.ITUNES_META_LIST_BOX)
            {
                readChildren(inStream);
            }
        }
Beispiel #18
0
        public override void decode(MP4InputStream inStream)
        {
            // 10 bits objectDescriptorID, 1 bit url flag, 5 bits reserved
            int x = (int)inStream.readBytes(2);

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

            if (urlPresent)
            {
                url = inStream.readString(size - 2);
            }

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

            enabled   = (flags & 1) == 1;
            inMovie   = (flags & 2) == 2;
            inPreview = (flags & 4) == 4;

            int len = (version == 1) ? 8 : 4;

            creationTime     = inStream.readBytes(len);
            modificationTime = inStream.readBytes(len);
            trackID          = (int)inStream.readBytes(4);
            inStream.skipBytes(4); //reserved
            duration = BoxUtils.detectUndetermined(inStream.readBytes(len));

            inStream.skipBytes(8); //reserved

            layer          = (int)inStream.readBytes(2);
            alternateGroup = (int)inStream.readBytes(2);
            volume         = inStream.readFixedPoint(8, 8);

            inStream.skipBytes(2); //reserved

            for (int i = 0; i < 9; i++)
            {
                if (i < 6)
                {
                    matrix[i] = inStream.readFixedPoint(16, 16);
                }
                else
                {
                    matrix[i] = inStream.readFixedPoint(2, 30);
                }
            }

            width  = inStream.readFixedPoint(16, 16);
            height = inStream.readFixedPoint(16, 16);
        }
 /// <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);
 }
 public override void decode(MP4InputStream inStream)
 {
     inStream.skipBytes(6); // reserved
     dataReferenceIndex = inStream.readBytes(2);
 }
Beispiel #22
0
 protected void decodeCommon(MP4InputStream inStream)
 {
     vendor         = inStream.readBytes(4);
     decoderVersion = inStream.read();
 }
Beispiel #23
0
 public override void decode(MP4InputStream inStream)
 {
     esId = (int)inStream.readBytes(4);
 }
Beispiel #24
0
 /// <summary>
 /// called directly by subboxes that don't contain the 'data' string
 /// </summary>
 /// <param name="inStream"></param>
 private void decodeCommon(MP4InputStream inStream)
 {
     base.decode(inStream);
     languageCode = BoxUtils.getLanguageCode(inStream.readBytes(2));
 }
Beispiel #25
0
        public override void decode(MP4InputStream inStream)
        {
            base.decode(inStream);

            year = (int)inStream.readBytes(2);
        }