public override bool Parse(QtParser parser)
        {
            if (!base.Parse(parser))
            {
                return(false);
            }

            if (!CheckComponentSubType(ComponentSubType.vide))
            {
                Valid = false;
                return(Valid);
            }

            // Video specific
            parser.GetUShort(Attribute.Version);
            ushort revisionLevel = parser.GetUShort(Attribute.RevisionLevel);

            parser.CheckAttribute(Attribute.RevisionLevel, revisionLevel == 0, false);
            parser.GetFourCC(Attribute.Vendor);
            int temporalQuality = parser.GetInt(Attribute.TemporalQuality);

            parser.CheckAttribute(Attribute.TemporalQuality, (temporalQuality >= 0 && temporalQuality <= 1023), false);
            int spatialQuality = parser.GetInt(Attribute.SpatialQuality);

            parser.CheckAttribute(Attribute.SpatialQuality, (spatialQuality >= 0 && spatialQuality <= 1024), false);
            parser.GetUShort(Attribute.Width);
            parser.GetUShort(Attribute.Height);
            parser.GetFixed16_16(Attribute.HorizontalResolution);
            parser.GetFixed16_16(Attribute.VerticalResolution);
            int dataSize = parser.GetInt(Attribute.DataSize);

            parser.CheckAttribute(Attribute.DataSize, dataSize == 0, false);
            parser.GetUShort(Attribute.FrameCount);
            parser.GetFixedLengthString(Attribute.CompressorName, 32);

            parser.GetShort(Attribute.Depth);
            short colorTableId = parser.GetShort(Attribute.ColorTableId);

            // If the color table ID is set to 0, a color table is contained within the sample description itself.
            // The color table immediately follows the color table ID field in the sample description.
            if (colorTableId == 0)
            {
                // TODO
            }
            return(Valid);
        }
Exemple #2
0
        public override bool Parse(QtParser parser)
        {
            if (!base.Parse(parser))
            {
                return(false);
            }

            // This atom is not flagged a full atom to be able to parse the
            // version byte over here. To preserve memory,
            // the version byte is not made available in QtAtom.
            byte version = parser.GetByte(QtAtom.Attribute.Version);

            ParseFlags(parser);

            if (version == 1)
            {
                parser.GetLongDateTime(Attribute.CreationTime, "{0:F}");
                parser.GetLongDateTime(Attribute.ModificationTime, "{0:F}");
                parser.GetUInt(Attribute.TimeScale);
                parser.GetULong(Attribute.Duration);
            }
            else             // version == 0
            {
                parser.GetDateTime(Attribute.CreationTime, "{0:F}");
                parser.GetDateTime(Attribute.ModificationTime, "{0:F}");
                parser.GetUInt(Attribute.TimeScale);
                parser.GetUInt(Attribute.Duration);
            }

            parser.GetFixed16_16(Attribute.PreferredRate);
            parser.GetFixed8_8(Attribute.PreferredVolume);
            parser.GetUShort(Attribute.Reserved);
            parser.GetUInt(Attribute.Reserved);
            parser.GetUInt(Attribute.Reserved);
            Matrix matrix = parser.GetMatrix(Attribute.MatrixStructure);

            // Matrix check from From ISO_IEC_15444-12_2005 Base Media File Format
            parser.CheckAttribute(Attribute.MatrixStructure, matrix.U == 0.0, false);
            parser.CheckAttribute(Attribute.MatrixStructure, matrix.V == 0.0, false);
            parser.CheckAttribute(Attribute.MatrixStructure, matrix.W == 1.0, false);
            parser.GetUInt(Attribute.PreviewTime);
            parser.GetUInt(Attribute.PreviewDuration);
            parser.GetUInt(Attribute.PosterTime);
            parser.GetUInt(Attribute.SelectionTime);
            parser.GetUInt(Attribute.SelectionDuration);
            parser.GetUInt(Attribute.CurrentTime);
            uint nextTrackID = parser.GetUInt(Attribute.NextTrackID);

            parser.CheckAttribute(Attribute.NextTrackID, nextTrackID != 0, false);

            return(this.Valid);
        }
 internal void Parse(QtParser parser)
 {
     A = parser.GetFixed16_16(LAttribute.A);
     B = parser.GetFixed16_16(LAttribute.B);
     U = parser.GetFixed2_30(LAttribute.U);
     C = parser.GetFixed16_16(LAttribute.C);
     D = parser.GetFixed16_16(LAttribute.D);
     V = parser.GetFixed2_30(LAttribute.V);
     X = parser.GetFixed16_16(LAttribute.X);
     Y = parser.GetFixed16_16(LAttribute.Y);
     W = parser.GetFixed2_30(LAttribute.W);
 }
        public override bool Parse(QtParser parser)
        {
            if (!base.Parse(parser))
            {
                return(false);
            }

            if (!CheckComponentSubType(ComponentSubType.soun))
            {
                this.Valid = false;
                return(this.Valid);
            }

            // Audio specific
            ushort version       = parser.GetUShort(Attribute.CompressedDataVersion);
            ushort revisionLevel = parser.GetUShort(Attribute.RevisionLevel);

            parser.CheckAttribute(Attribute.RevisionLevel, revisionLevel == 0);
            uint vendor = parser.GetFourCC(Attribute.Vendor);

            parser.CheckAttribute(Attribute.Vendor, vendor == 0, false);                // Not always true
            ushort numberOfChannels = parser.GetUShort(Attribute.NumberOfChannels);

            parser.CheckAttribute(Attribute.NumberOfChannels, numberOfChannels == 1 || numberOfChannels == 2, false);             // Example with value 6 found
            ushort sampleSize = parser.GetUShort(Attribute.SampleSize);

            parser.CheckAttribute(Attribute.SampleSize, sampleSize == 8 || sampleSize == 16, false);
            short compressionID = parser.GetShort(Attribute.CompressionID);

            parser.CheckAttribute(Attribute.CompressionID, compressionID == 0 || compressionID == -1 || compressionID == -2);
            ushort packetSize = parser.GetUShort(Attribute.PacketSize);

            parser.CheckAttribute(Attribute.PacketSize, packetSize == 0);
            parser.GetFixed16_16(Attribute.SampleRate);

            if (version == 1)
            {
                parser.GetUInt(Attribute.SamplePerPacket);
                parser.GetUInt(Attribute.BytesPerPacket);
                parser.GetUInt(Attribute.BytesPerFrame);
                parser.GetUInt(Attribute.BytesPerSample);
            }
            return(this.Valid);
        }