Ejemplo n.º 1
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x3D0A: this.BlockAlign = reader.ReadUInt16(); return(true);

            case 0x3D0B: this.SequenceOffset = reader.ReadByte(); return(true);

            case 0x3D09: this.AverageBytesPerSecond = reader.ReadUInt32(); return(true);

            case 0x3D32: this.ChannelAssignment = reader.ReadULKey(); return(true);

            case 0x3D29: this.PeakEnvelopeVersion = reader.ReadUInt32(); return(true);

            case 0x3D2A: this.PeakEnvelopeFormat = reader.ReadUInt32(); return(true);

            case 0x3D2B: this.PointsPerPeakValue = reader.ReadUInt32(); return(true);

            case 0x3D2C: this.PeakEnvelopeBlockSize = reader.ReadUInt32(); return(true);

            case 0x3D2D: this.PeakChannels = reader.ReadUInt32(); return(true);

            case 0x3D2E: this.PeakFrames = reader.ReadUInt32(); return(true);

            case 0x3D2F: this.PeakOfPeaksPosition = reader.ReadUInt64(); return(true);

            case 0x3D30: this.PeakEnvelopeTimestamp = reader.ReadTimestamp(); return(true);

            case 0x3D31: this.PeakEnvelopeData = reader.ReadArray(reader.ReadByte, localTag.Size); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Parse this tag
 /// </summary>
 /// <param name="reader"></param>
 public void Parse(MXFReader reader)
 {
     if (this.Size == 1)
     {
         this.Value = reader.ReadByte();
     }
     else if (this.Size == 2)
     {
         this.Value = reader.ReadUInt16();
     }
     else if (this.Size == 4)
     {
         this.Value = reader.ReadUInt32();
     }
     else if (this.Size == 8)
     {
         this.Value = reader.ReadUInt64();
     }
     else
     {
         byte[] data = new byte[this.Size];
         for (int n = 0; n < this.Size; n++)
         {
             data[n] = reader.ReadByte();
         }
         this.Value = data;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x1201: this.StartPosition = reader.ReadUInt64(); return(true);

            case 0x1202: this.FadeInLength = reader.ReadUInt64(); return(true);

            case 0x1203: this.FadeInType = (MXFFadeType?)reader.ReadByte(); return(true);

            case 0x1204: this.FadeOutLength = reader.ReadUInt64(); return(true);

            case 0x1205: this.FadeOutType = (MXFFadeType?)reader.ReadByte(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 4
0
        public MXFEntryIndex(UInt64 index, MXFReader reader, byte?sliceCount, byte?posTableCount, UInt32 length)
            : base(reader)
        {
            this.m_eType = MXFObjectType.Index;

            this.Length         = length;
            this.Index          = index;
            this.TemporalOffset = reader.ReadSignedByte();
            this.KeyFrameOffset = reader.ReadSignedByte();
            this.Flags          = new IndexEntryFlags(reader.ReadByte());
            this.StreamOffset   = reader.ReadUInt64();

            if (sliceCount.HasValue && sliceCount.Value > 0)
            {
                this.SliceOffsets = new UInt32[sliceCount.Value];
                for (int n = 0; n < sliceCount; n++)
                {
                    this.SliceOffsets[n] = reader.ReadUInt32();
                }
            }

            if (posTableCount.HasValue && posTableCount.Value > 0)
            {
                this.PosTable = new MXFRational[posTableCount.Value];
                for (int n = 0; n < posTableCount; n++)
                {
                    this.PosTable[n] = reader.ReadRational();
                }
            }
        }
Ejemplo n.º 5
0
 public MXFEntryRIP(MXFReader reader)
     : base(reader)
 {
     this.m_eType         = MXFObjectType.RIP;
     this.BodySID         = reader.ReadUInt32();
     this.PartitionOffset = reader.ReadUInt64();
     this.Length          = 12;    // Fixed length
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x0601: this.EventPosition = reader.ReadUInt64(); return(true);

            case 0x0602: this.EventComment = reader.ReadUTF16String(localTag.Size); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x4901: this.EventTrackEditRate = reader.ReadRational(); return(true);

            case 0x4902: this.EventTrackOrigin = reader.ReadUInt64(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x1801: this.AddChild(reader.ReadReference <MXFOperationGroup>("TransitionOperation")); return(true);

            case 0x1802: this.CutPoint = reader.ReadUInt64(); return(true);
            }

            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x1501: this.StartTimecode = reader.ReadUInt64(); return(true);

            case 0x1502: this.FramesPerSecond = reader.ReadUInt16(); return(true);

            case 0x1503: this.DropFrame = (reader.ReadByte() != 0); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x0404: this.EdgeCodeHeader = reader.ReadArray(reader.ReadByte, localTag.Size); return(true);

            case 0x0401: this.EdgeCodeStart = reader.ReadUInt64(); return(true);

            case 0x0403: this.EdgeCodeFormat = (MXFEdgeType)reader.ReadUInt16(); return(true);

            case 0x0402: this.EdgeCodeFilmFormat = (MXFFilmType)reader.ReadUInt16(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x3006: this.LinkedTrackId = reader.ReadUInt32(); return(true);

            case 0x3001: this.SampleRate = reader.ReadRational(); return(true);

            case 0x3002: this.ContainerDuration = reader.ReadUInt64(); return(true);

            case 0x3004: this.EssenceContainer = reader.ReadULKey(); return(true);

            case 0x3005: this.Codec = reader.ReadULKey(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x0201: this.DataDefinition = reader.ReadULKey(); return(true);

            case 0x0202: this.Duration = reader.ReadUInt64(); return(true);

            // TODO replace generic MXFObject with class KLVData once implemented
            case 0x0203: this.AddChild(reader.ReadReferenceSet <MXFObject>("KLV Data", "KLV Data")); return(true);

            case 0x0204: this.AddChild(reader.ReadReferenceSet <MXFTaggedValue>("User Comments", "User Comment")); return(true);

            case 0x0205: this.AddChild(reader.ReadReferenceSet <MXFTaggedValue>("Attributes", "Attribute")); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 13
0
        public MXFPartition(MXFReader reader, MXFKLV headerKLV)
            : base(headerKLV, "Partition", KeyType.Partition)
        {
            this.m_eType  = MXFObjectType.Partition;
            this.IsLoaded = false;

            // Determine the partition type
            switch (this.Key[13])
            {
            case 2: this.PartitionType = PartitionType.Header; break;

            case 3: this.PartitionType = PartitionType.Body; break;

            case 4: this.PartitionType = PartitionType.Footer; break;

            default:
                this.PartitionType = PartitionType.Unknown;
                Log(MXFLogType.Error, "unknown partition type");
                break;
            }

            this.Closed   = (this.PartitionType == PartitionType.Footer) || (this.Key[14] & 0x01) == 0x00;
            this.Complete = (this.Key[14] > 2);

            // Make sure we read at the data position
            reader.Seek(this.DataOffset);

            this.MajorVersion = reader.ReadUInt16();
            this.MinorVersion = reader.ReadUInt16();

            this.KagSize           = reader.ReadUInt32();
            this.ThisPartition     = reader.ReadUInt64();
            this.PreviousPartition = reader.ReadUInt64();
            this.FooterPartition   = reader.ReadUInt64();
            this.HeaderByteCount   = reader.ReadUInt64();
            this.IndexByteCount    = reader.ReadUInt64();
            this.IndexSID          = reader.ReadUInt32();
            this.BodyOffset        = reader.ReadUInt64();
            this.BodySID           = reader.ReadUInt32();

            this.OP = reader.ReadULKey();

            MXFObject essenceContainers = reader.ReadAUIDSet("Essence Containers", "Essence Container");

            this.AddChild(essenceContainers);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x4B01: this.EditRate = reader.ReadRational(); return(true);

            case 0x4B02: this.Origin = reader.ReadUInt64(); return(true);

            case 0x4B03: this.MarkIn = reader.ReadUInt64(); return(true);

            case 0x4B05: this.UserPosition = reader.ReadUInt64(); return(true);

            case 0x4B06: this.PackageMarkInPosition = reader.ReadUInt64(); return(true);

            case 0x4B04: this.MarkOut = reader.ReadUInt64(); return(true);

            case 0x4B07: this.PackageMarkOutPosition = reader.ReadUInt64(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Overridden method to process local tags
        /// </summary>
        /// <param name="localTag"></param>
        protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
        {
            switch (localTag.Tag)
            {
            case 0x3F05: this.EditUnitByteCount = reader.ReadUInt32(); return(true);

            case 0x3F06: this.IndexSID = reader.ReadUInt32(); return(true);

            case 0x3F07: this.BodySID = reader.ReadUInt32(); return(true);

            case 0x3F08: this.SliceCount = reader.ReadByte(); return(true);

            case 0x3F0C: this.IndexStartPosition = reader.ReadUInt64(); return(true);

            case 0x3F0D: this.IndexDuration = reader.ReadUInt64(); return(true);

            case 0x3F0E: this.PosTableCount = reader.ReadByte(); return(true);

            case 0x3F0F: this.ExtStartOffset = reader.ReadUInt64(); return(true);

            case 0x3F10: this.VBEByteCount = reader.ReadUInt64(); return(true);

            case 0x3F11: this.SingleIndexLocation = reader.ReadBool(); return(true);

            case 0x3F12: this.SingleEssenceLocation = reader.ReadBool(); return(true);

            case 0x3F13: this.ForwardIndexDirection = reader.ReadBool(); return(true);

            case 0x3F0B: this.IndexEditRate = reader.ReadRational(); return(true);

            case 0x3F0A:                      // Index entry array
            {
                UInt32 NbIndexEntries = reader.ReadUInt32();
                UInt32 entryLength    = reader.ReadUInt32();
                if (NbIndexEntries > 0)
                {
                    this.IndexEntries = new List <MXFEntryIndex>();
                    MXFObject indexCollection = new MXFNamedObject("IndexEntries", reader.Position, MXFObjectType.Index);

                    for (UInt64 i = 0; i < NbIndexEntries; i++)
                    {
                        long next = reader.Position + entryLength;

                        MXFEntryIndex newEntry = new MXFEntryIndex((ulong)this.IndexStartPosition + i, reader, this.SliceCount, this.PosTableCount, entryLength);
                        this.IndexEntries.Add(newEntry);                                         // Also add this entry to the local list

                        // And to the child collection
                        indexCollection.AddChild(newEntry);

                        reader.Seek(next);
                    }
                    this.AddChild(indexCollection);
                }
            }
                return(true);

            case 0x3F09:                      // Delta entry array
            {
                UInt32 NbDeltaEntries = reader.ReadUInt32();
                UInt32 entryLength    = reader.ReadUInt32();
                if (NbDeltaEntries > 0)
                {
                    MXFObject deltaCollection = new MXFNamedObject("DeltaEntries", reader.Position, MXFObjectType.Index);
                    for (int i = 0; i < NbDeltaEntries; i++)
                    {
                        long next = reader.Position + entryLength;
                        deltaCollection.AddChild(new MXFEntryDelta(reader, entryLength));
                        reader.Seek(next);
                    }
                    this.AddChild(deltaCollection);
                }
            }
                return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }