/// <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); }
/// <summary> /// Reads a list of AUIDs and returns a MXFObject containing the AUIDs as children /// </summary> /// <param name="groupName">The name of the MXFObject acting as group container</param> /// <param name="singleItem">The name of the single items</param> public MXFObject ReadAUIDSet(string groupName, string singleItem) { UInt32 nofItems = this.ReadUInt32(); UInt32 objectSize = this.ReadUInt32(); // TODO useless size of objects, always 16 according to specs MXFObject auidGroup = new MXFNamedObject(groupName, this.Position, objectSize); if (nofItems < UInt32.MaxValue) { for (int n = 0; n < nofItems; n++) { MXFAUID auid = new MXFAUID(this, singleItem); auidGroup.AddChild(auid); } } return(auidGroup); }
public MXFObject ReadReferenceSet <T>(string referringSetName, string singleItemName) where T : MXFObject { UInt32 nofItems = this.ReadUInt32(); UInt32 objectSize = this.ReadUInt32(); // useless size of objects, always 16 according to specs MXFObject referenceSet = new MXFNamedObject(referringSetName, this.Position, objectSize); // TODO what if this condition is not met? should we throw an exception? if (nofItems < UInt32.MaxValue) { for (int n = 0; n < nofItems; n++) { var reference = new MXFReference <T>(this, singleItemName); referenceSet.AddChild(reference); } } return(referenceSet); }
/// <summary> /// Read partition tag list /// </summary> /// <param name="reader"></param> /// <param name="categoryName"></param> /// <returns></returns> protected UInt32 ReadTagList(MXFReader reader, string categoryName) { UInt32 nofItems = reader.ReadD(); UInt32 objectSize = reader.ReadD(); // useless size of objects, always 16 according to specs MXFObject keylist = new MXFNamedObject(categoryName, reader.Position); if (nofItems > 0 && nofItems < UInt32.MaxValue) { m_PrimerKeys = new Dictionary <UInt16, MXFEntryPrimer>(); for (int n = 0; n < nofItems; n++) { MXFEntryPrimer entry = new MXFEntryPrimer(reader); m_PrimerKeys.Add(entry.LocalTag, entry); // Add to our own internal list keylist.AddChild(entry); // And add the entry as one of our children } } this.AddChild(keylist); return(nofItems); }
/// <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)); }