Пример #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 0x6103: ReadKeyList(reader, "TrackIDs", "TrackID"); return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
 /// <summary>
 /// Overridden method to process local tags
 /// </summary>
 /// <param name="localTag"></param>
 protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
 {
     switch (localTag.Tag)
     {
     case 0x3F01: ReadKeyList(reader, "Subdescriptor UIDs", "Subdescriptor UID"); return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #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 0x1001: this.AddChild(reader.ReadReferenceSet <MXFStructuralComponent>("StructuralComponents", "StructuralComponent")); return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #4
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 0x1001: ReadKeyList(reader, "Structural components", "Structural component"); return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #5
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 0x2F01: ReadKeyList(reader, "Locators", "Locator"); return true;
     }
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #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 0x0901: this.AddChild(reader.ReadReference <MXFSourceReference>("AnnotationSource")); return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #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 0x0C01: this.AddChild(reader.ReadReferenceSet <MXFSegment>("NestedScopeTracks", "NestedScopeTrack")); return(true);
            }

            return(base.ParseLocalTag(reader, localTag));
        }
Пример #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 0x3F01:
         this.AddChild(reader.ReadReferenceSet <MXFFileDescriptor>("Subdescriptor UIDs", "Subdescriptor UID"));
         return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #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 0x1901: ReadKeyList(reader, "Packages", "Package"); return(true);

            case 0x1902: ReadKeyList(reader, "EssenceContainer data", "Essencecontainer data"); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Пример #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 0x1901: this.AddChild(reader.ReadReferenceSet <MXFGenericPackage>("Packages", "Package")); return(true);

            case 0x1902: this.AddChild(reader.ReadReferenceSet <MXFEssenceContainerData>("EssenceContainer data", "Essencecontainer data")); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Пример #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 0x0F01: this.AddChild(reader.ReadReference <MXFSegment>("SelectedSegment")); return(true);

            case 0x0F02: this.AddChild(reader.ReadReferenceSet <MXFSegment>("AlternateSegments", "AlternateSegment")); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Пример #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 0x1901: ReadKeyList(reader, "Packages", "Package"); return(true);

            case 0x1902: ReadKeyList(reader, "EssenceContainer data", "Essencecontainer data"); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #13
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 0x0502: this.AddChild(reader.ReadReference <MXFSourceReference>("StillFrame")); return(true);

            case 0x0501: this.AddChild(reader.ReadReferenceSet <MXFSourceReference>("Choices", "Choice")); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Пример #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 0x2701: this.LinkedPackageUID = reader.ReadRefKey(); return(true);

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

            case 0x3F07: this.BodySID = reader.ReadD(); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #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 0x0202: this.Duration = reader.ReadL(); return(true);

            case 0x0201: this.DataDefinitionUID = new MXFRefKey(reader); return(true);

            case 0x1001: this.StructuralComponentsCount = ReadKeyList(reader, "Structural components", "Structural component"); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        private void Initialize(MXFReader reader)
        {
            // Make sure we read at the data position
            reader.Seek(this.DataOffset);

            // Read all local tags
            long klvEnd = this.DataOffset + this.Length;

            while (reader.Position + 4 < klvEnd)
            {
                MXFLocalTag tag  = new MXFLocalTag(reader);
                long        next = tag.DataOffset + tag.Size;

                // Parse UID tag (if present)
                if (tag.Tag > 0x7FFF)
                {
                    // dynamic tag
                    // TODO
                    Log(LogType.Warning, "TODO Implement dynamic tags!");
                    //int i;
                    //for (i = 0; i < mxf->local_tags_count; i++)
                    //{
                    //	int local_tag = AV_RB16(mxf->local_tags + i * 18);
                    //	if (local_tag == tag)
                    //	{
                    //		memcpy(uid, mxf->local_tags + i * 18 + 2, 16);
                    //		av_dlog(mxf->fc, "local tag %#04x\n", local_tag);
                    //		PRINT_KEY(mxf->fc, "uid", uid);
                    //	}
                    //}
                }
                if (tag.Tag == 0x3C0A)
                {
                    this.UID = new MXFKey(reader, 16);
                }
                else
                {
                    // Allow derived classes to handle the data
                    if (!ParseLocalTag(reader, tag))
                    {
                        // Not processed, use default
                        tag.Parse(reader);

                        // Add to the collection
                        AddChild(tag);
                    }
                }

                reader.Seek(next);
            }
        }
Пример #17
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 0x2F01:
                this.AddChild(reader.ReadReferenceSet <MXFLocator>("Locators", "Locator"));
                return(true);

            case var _ when localTag.Key == subDescriptorKey:
                this.AddChild(reader.ReadReferenceSet <MXFSubDescriptor>("SubDescriptors", "SubDescriptor"));
                return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
Пример #18
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 0x4401: this.PackageUID = reader.ReadRefKey(); return(true);

            case 0x4402: this.MaterialPackageName = reader.ReadS(localTag.Size); return(true);

            case 0x4403: this.TrackCount = ReadKeyList(reader, "Tracks", "Track"); return(true);

            case 0x4404: this.ModifiedDate = reader.ReadTimestamp(); return(true);

            case 0x4405: this.CreationDate = reader.ReadTimestamp(); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #19
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.ReadL(); return(true);

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

            case 0x1101:
                reader.Skip(16);                         // Only read last 16 bytes
                this.SourcePackageID = new MXFRefKey(reader);
                return(true);

            case 0x1102: this.SourceTrackId = reader.ReadD(); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #20
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 0x3F01: this.SubDescriptorCount = ReadKeyList(reader, "SubDescriptors", "SubDescriptor"); return(true);

            case 0x3004: this.EssenceContainerUL = new MXFRefKey(reader); return(true);

            case 0x3006: this.LinkedTrackId = reader.ReadD(); return(true);

            case 0x3201: this.EssenceCodecId = new MXFRefKey(reader); return(true);

            case 0x3202: this.Height = reader.ReadD(); return(true);

            case 0x3203: this.Width = reader.ReadD(); return(true);

            case 0x320C: this.FrameLayout = reader.ReadB(); return(true);

            case 0x320E:
                this.AspectRatioNum = reader.ReadD();
                this.AspectRatioDen = reader.ReadD();
                return(true);

            case 0x3212: this.FieldDominance = reader.ReadB(); return(true);

            case 0x3218: this.ActiveFormat = reader.ReadB(); return(true);

            case 0x3301: this.ComponentDepth = reader.ReadD(); return(true);

            case 0x3302: this.HorizontalSubSampling = reader.ReadD(); return(true);

            case 0x3308: this.VerticalSubSampling = reader.ReadD(); return(true);

            case 0x3D01: this.BitsPerSample = reader.ReadD(); return(true);

            case 0x3D03:
                this.SampleRateNum = reader.ReadD();
                this.SampleRateDen = reader.ReadD();
                return(true);

            case 0x3D06: this.EssenceCodecId = new MXFRefKey(reader); return(true);

            case 0x3D07: this.ChannelCount = reader.ReadD(); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #21
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 0x4403:
                this.TracksCount = ReadKeyList(reader, "Tracks", "Track");
                return(true);

            case 0x4401:                     // UMID
                this.ULUID      = new MXFRefKey(reader);
                this.PackageUID = new MXFRefKey(reader);
                return(true);

            case 0x4701:                     // Descriptor
                this.DescriptorUID = new MXFRefKey(reader);
                return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #22
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 0x4801: this.ID = reader.ReadD(); return(true);

            case 0x4802: this.TrackName = reader.ReadS(localTag.Size); return(true);

            case 0x4803: this.SequenceUID = reader.ReadRefKey(); return(true);

            case 0x4804: this.Number = reader.ReadD(); return(true);

            case 0x4B01:
                this.RateNum = reader.ReadD();
                this.RateDen = reader.ReadD();
                if (this.RateDen != 0)
                {
                    this.Rate = ((double)this.RateNum) / ((double)this.RateDen);
                }
                return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #23
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 0x3C09: this.GenerationUID = reader.ReadKey(); return(true);

            case 0x3C01: this.CompanyName = reader.ReadS(localTag.Size); return(true);

            case 0x3C02: this.ProductName = reader.ReadS(localTag.Size); return(true);

            case 0x3C03: this.ProductVersion = reader.ReadVersion(); return(true);

            case 0x3C04: this.ProductVersionString = reader.ReadS(localTag.Size); return(true);

            case 0x3C05: this.ProductUID = reader.ReadKey(); return(true);

            case 0x3C06: this.ModificationDate = reader.ReadTimestamp(); return(true);

            case 0x3C07: this.ToolkitVersion = reader.ReadVersion(); return(true);

            case 0x3C08: this.Platform = reader.ReadS(localTag.Size); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #24
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 0x3B02: this.LastModificationDate = reader.ReadTimestamp(); return(true);

            case 0x3B05: this.Version = reader.ReadW(); return(true);

            case 0x3B07: this.ObjectModelVersion = reader.ReadD(); return(true);

            case 0x3B03: this.ContentStorageUID = new MXFRefKey(reader, 16, "ContentStorageUID"); return(true);

            case 0x3B08: this.PrimaryPackageUID = new MXFRefKey(reader, 16, "PrimaryPackageUID"); return(true);

            case 0x3B09: this.OperationalPatternUL = new MXFKey(reader, 16); return(true);

            case 0x3B06: ReadKeyList(reader, "Identifications", "Identification"); return(true);

            case 0x3B0A: ReadKeyList(reader, "Essencecontainers", "Essencecontainer"); return(true);

            case 0x3B0B: ReadKeyList(reader, "Metadata Schemes", "Metadata scheme"); return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #25
0
 /// <summary>
 /// Overridden method to process local tags
 /// </summary>
 /// <param name="localTag"></param>
 protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
 {
     return(base.ParseLocalTag(reader, localTag));
 }
Пример #26
0
        /// <summary>
        /// Read the data and display it in the hex window
        /// </summary>
        /// <param name="obj"></param>
        private void ReadData(MXFObject obj)
        {
            StringBuilder sb = new StringBuilder();

            // Cast to KLV
            long   readerOffset = obj.Offset;
            long   len          = (int)obj.Length;
            MXFKLV klv          = obj as MXFKLV;

            if (klv != null)
            {
                // Determine real length including BER + Key
                len = (klv.DataOffset - readerOffset) + klv.Length;
            }
            MXFLocalTag lt = obj as MXFLocalTag;

            if (lt != null)
            {
                len = (lt.DataOffset - readerOffset) + lt.Size;
            }

            const int dataLength = 16;

            if (len > 0)
            {
                byte[] data = new byte[len];
                using (MXFReader reader = new MXFReader(this.Filename))
                {
                    reader.Seek(readerOffset);
                    reader.Read(data, len);
                }

                long   lines      = (len + (dataLength - 1)) / dataLength;
                long   offset     = 0;
                byte[] dataString = new byte[dataLength + 1];
                for (int n = 0; n < lines; n++)
                {
                    long cnt = dataLength;
                    if (len - offset < dataLength)
                    {
                        cnt = len - offset;
                    }
                    string hex = BitConverter.ToString(data, (int)offset, (int)cnt).Replace('-', ' ');
                    hex = hex.PadRight(dataLength * 3);

                    for (int m = 0; m < cnt; m++)
                    {
                        dataString[m] = data[offset + m];
                    }
                    string ascii     = System.Text.Encoding.ASCII.GetString(dataString);
                    string asciisafe = "";
                    for (int m = 0; m < cnt && m < ascii.Length; m++)
                    {
                        if (ascii[m] < 0x20)
                        {
                            asciisafe += ' ';
                        }
                        else
                        {
                            asciisafe += ascii[m];
                        }
                    }

                    sb.AppendLine(string.Format("{0:0000000000}  {1}  {2}", readerOffset + (n * dataLength), hex, asciisafe));
                    offset += dataLength;
                }
            }
            this.txtHex.Text = sb.ToString();
        }
Пример #27
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.ReadD(); return(true);

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

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

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

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

            case 0x3F0B:
                this.IndexEditRateNum = reader.ReadD();
                this.IndexEditRateDen = reader.ReadD();
                return(true);

            case 0x3F0A:                      // Index entry array
            {
                this.NbIndexEntries = reader.ReadD();
                UInt32 entryLength = reader.ReadD();

                if (this.NbIndexEntries > 0)
                {
                    MXFObject indexCollection = this.AddChild("IndexEntries");

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

                        indexCollection.AddChild(new MXFIndexEntry(this.IndexStartPosition + i, reader));

                        reader.Seek(next);
                    }
                }
            }
                return(true);

            case 0x3F09:                      // Delta entry array
            {
                this.NbDeltaEntries = reader.ReadD();
                UInt32 entryLength = reader.ReadD();

                if (this.NbDeltaEntries > 0)
                {
                    MXFObject deltaCollection = this.AddChild("DeltaEntries");
                    for (int i = 0; i < this.NbDeltaEntries; i++)
                    {
                        long next = reader.Position + entryLength;

                        deltaCollection.AddChild(new MXFDeltaEntry(reader));

                        reader.Seek(next);
                    }
                }
            }
                return(true);
            }
            return(false);            // Not parsed, use default parsing
        }
Пример #28
0
 /// <summary>
 /// Allow derived classes to process the local tag
 /// </summary>
 /// <param name="localTag"></param>
 protected virtual bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
 {
     return(false);
 }
Пример #29
0
 /// <summary>
 /// Overridden method to process local tags
 /// </summary>
 /// <param name="localTag"></param>
 protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
 {
     // Filler does not have local tags
     return(true);
 }