/// <summary>
 /// Overridden method to process local tags
 /// </summary>
 /// <param name="localTag"></param>
 protected override bool ParseLocalTag(MXFReader reader, MXFLocalTag localTag)
 {
     switch (localTag.Tag)
     {
     case 0x4701: this.Descriptor = reader.ReadRefKey(); return(true);
     }
     return(base.ParseLocalTag(reader, localTag));
 }
示例#2
0
 public MXFEntryPrimer(MXFReader reader)
     : base(reader)
 {
     this.Offset   = reader.Position;
     this.LocalTag = reader.ReadW();
     this.AliasUID = new MXFRefKey(reader, 16, "AliasUID");
     this.Length   = 20;           // Fixed length
 }
示例#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 0x6102: ReadKeyList(reader, "TrackIDs", "TrackID"); return(true);

            case 0x6101: this.DMFramework = reader.ReadRefKey(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
示例#4
0
        /// <summary>
        /// Add all children (recusive)
        /// </summary>
        /// <param name="parent"></param>
        protected MXFLogicalObject LogicalAddChilds(MXFLogicalObject parent)
        {
            // Check properties for reference
            MXFObject reference = parent.Object;

            if (reference != null)
            {
                foreach (PropertyInfo propertyInfo in reference.GetType().GetProperties())
                {
                    if (propertyInfo.CanRead)
                    {
                        if (propertyInfo.PropertyType == typeof(MXFRefKey))
                        {
                            // Found one!
                            MXFRefKey refKey = (MXFRefKey)propertyInfo.GetValue(reference, null);
                            if (refKey != null && refKey.Reference != null)
                            {
                                // Add the child
                                MXFLogicalObject lo = new MXFLogicalObject(refKey.Reference, refKey.Reference.ToString());
                                parent.AddChild(lo);

                                // Add all sub stuff
                                LogicalAddChilds(lo);
                            }
                        }
                    }
                }

                if (reference.HasChildren)
                {
                    foreach (MXFObject child in reference.Children)
                    {
                        if (child.HasChildren)
                        {
                            foreach (MXFObject grandchild in child.Children)
                            {
                                MXFRefKey refKey = grandchild as MXFRefKey;
                                if (refKey != null && refKey.Reference != null)
                                {
                                    MXFLogicalObject lo = new MXFLogicalObject(refKey.Reference, refKey.Reference.ToString());

                                    // Add the child
                                    parent.AddChild(lo);

                                    // Add all sub stuff
                                    LogicalAddChilds(lo);
                                }
                            }
                        }
                    }
                }
            }
            return(parent);
        }
        /// <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.TrackID = reader.ReadD(); return(true);

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

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

            case 0x4804: this.TrackNumber = reader.ReadD(); return(true);
            }
            return(base.ParseLocalTag(reader, localTag));
        }
示例#6
0
        /// <summary>
        /// Loop through all items, when an item with a reference is found,
        /// </summary>
        /// <param name="parent"></param>
        protected void ResolveReferences(Dictionary <string, MXFObject> allKeys, MXFObject parent)
        {
            MXFRefKey refParent = parent as MXFRefKey;

            if ((object)refParent != null)
            {
                if (allKeys.ContainsKey(refParent.Key.ShortKey.ToString()))
                {
                    MXFObject referencedObject = allKeys[refParent.Key.ShortKey.ToString()];
                    Debug.WriteLine(string.Format("Found reference: {0} -> {1}", refParent.ToString(), referencedObject.ToString()));
                    refParent.Reference = referencedObject;
                }
            }


            // Loop through all properties of this object
            // This will only use public properties. Is that enough?
            foreach (PropertyInfo propertyInfo in parent.GetType().GetProperties())
            {
                if (propertyInfo.CanRead)
                {
                    if (propertyInfo.PropertyType == typeof(MXFRefKey))
                    {
                        // Found one!
                        MXFRefKey refKey = (MXFRefKey)propertyInfo.GetValue(parent, null);
                        if (refKey != null)
                        {
                            if (allKeys.ContainsKey(refKey.Key.ShortKey.ToString()))
                            {
                                MXFObject referencedObject = allKeys[refKey.Key.ShortKey.ToString()];
                                Debug.WriteLine(string.Format("Found reference: {0} -> {1}", propertyInfo.Name, referencedObject.ToString()));
                                refKey.Reference = referencedObject;
                            }
                        }
                    }
                }
            }

            if (parent.Children != null)
            {
                foreach (MXFObject child in parent.Children)
                {
                    ResolveReferences(allKeys, child);
                }
            }
        }
示例#7
0
        /// <summary>
        /// Reads a list of keys
        /// </summary>
        /// <param name="categoryName"></param>
        /// <param name="singleItem"></param>
        public MXFObject ReadKeyList(string categoryName, string singleItem)
        {
            UInt32 nofItems   = this.ReadD();
            UInt32 objectSize = this.ReadD();             // useless size of objects, always 16 according to specs

            MXFObject keylist = new MXFNamedObject(categoryName, this.Position, objectSize);

            if (nofItems < UInt32.MaxValue)
            {
                for (int n = 0; n < nofItems; n++)
                {
                    MXFRefKey key = new MXFRefKey(this, objectSize, singleItem);
                    keylist.AddChild(key);
                }
            }
            return(keylist);
        }