void ExportMedia(XmlElement parent, Media media) { Type type = media.GetType(); XmlElement elt = AddChild(parent, type.Name); ChildString(elt, "FilePath", media.FilePath); ChildString(elt, "KeyString", media.KeyString); ChildInt32(elt, "UseCount", media.UseCount); ChildBoolean(elt, "UseCustomTimecode", media.UseCustomTimecode); ChildTimecode(elt, "TimecodeIn", media.TimecodeIn); ChildTimecode(elt, "TimecodeOut", media.TimecodeOut); ChildTimecode(elt, "Length", media.Length); ChildObject(elt, "RulerFormat", media.RulerFormat); ChildString(elt, "TapeName", media.TapeName); ChildInt64(elt, "AverageDataRate", media.AverageDataRate); ChildString(elt, "Comment", media.Comment); if (media.IsSubclip()) { Subclip subclip = (Subclip)media; ChildString(elt, "ParentMedia", subclip.ParentMedia.KeyString); ChildTimecode(elt, "Start", subclip.Start); ChildBoolean(elt, "IsReversed", subclip.IsReversed); } if (media.IsGenerated()) { ExportEffect(elt, media.Generator, true); } ExportMediaStreams(elt, media.Streams, media.IsOffline()); ExportEffects(elt, media.Effects, true); }
void ImportSubclip(XmlElement elt, MediaPool pool) { String parentMediaKey = ChildString(elt, "ParentMedia"); Media parentMedia = FindMedia(pool, parentMediaKey); if (null == parentMedia) { throw new ApplicationException("could not find subclip's parent media: " + parentMediaKey); } Timecode start = ChildTimecode(elt, "Start"); Timecode length = ChildTimecode(elt, "Length"); Boolean reverse = false; try { reverse = ChildBoolean(elt, "IsReversed"); } catch {} String displayName = null; try { displayName = ChildString(elt, "FilePath"); } catch {} Subclip subclip = new Subclip(parentMediaKey, start, length, reverse, displayName); ImportMediaInternal(elt, subclip); }