private void Read(ReadStyle propertiesStyle) { this.tag = new CombinedTag(); base.Mode = TagLib.File.AccessMode.Read; try { FileParser parser = new FileParser(this); if (propertiesStyle == ReadStyle.None) { parser.ParseTag(); } else { parser.ParseTagAndProperties(); } base.InvariantStartPosition = parser.MdatStartPosition; base.InvariantEndPosition = parser.MdatEndPosition; this.udta_box = parser.UserDataBox; if (((this.udta_box != null) && (this.udta_box.GetChild(BoxType.Meta) != null)) && (this.udta_box.GetChild(BoxType.Meta).GetChild(BoxType.Ilst) != null)) { base.TagTypesOnDisk |= TagTypes.Apple; } if (this.udta_box == null) { this.udta_box = new IsoUserDataBox(); } this.apple_tag = new AppleTag(this.udta_box); TagLib.Tag[] tags = new TagLib.Tag[] { this.apple_tag }; this.tag.SetTags(tags); if (propertiesStyle == ReadStyle.None) { base.Mode = TagLib.File.AccessMode.Closed; } else { IsoMovieHeaderBox movieHeaderBox = parser.MovieHeaderBox; if (movieHeaderBox == null) { base.Mode = TagLib.File.AccessMode.Closed; throw new CorruptFileException("mvhd box not found."); } IsoAudioSampleEntry audioSampleEntry = parser.AudioSampleEntry; IsoVisualSampleEntry visualSampleEntry = parser.VisualSampleEntry; ICodec[] codecs = new ICodec[] { audioSampleEntry, visualSampleEntry }; this.properties = new TagLib.Properties(movieHeaderBox.Duration, codecs); } } finally { base.Mode = TagLib.File.AccessMode.Closed; } }
public override TagLib.Tag GetTag(TagTypes type, bool create) { TagLib.Tag tag = null; switch (type) { case (TagTypes.None | TagTypes.Id3v2): if ((this.id32_tag == null) && create) { this.id32_tag = new TagLib.Id3v2.Tag(); this.id32_tag.Version = 4; this.id32_tag.Flags = (HeaderFlags) ((byte) (this.id32_tag.Flags | HeaderFlags.FooterPresent)); this.tag.CopyTo(this.id32_tag, true); } tag = this.id32_tag; break; case TagTypes.RiffInfo: if ((this.info_tag == null) && create) { this.info_tag = new InfoTag(); this.tag.CopyTo(this.info_tag, true); } tag = this.info_tag; break; case TagTypes.MovieId: if ((this.mid_tag == null) && create) { this.mid_tag = new MovieIdTag(); this.tag.CopyTo(this.mid_tag, true); } tag = this.mid_tag; break; case TagTypes.DivX: if ((this.divx_tag == null) && create) { this.divx_tag = new DivXTag(); this.tag.CopyTo(this.divx_tag, true); } tag = this.divx_tag; break; } TagLib.Tag[] tags = new TagLib.Tag[] { this.id32_tag, this.info_tag, this.mid_tag, this.divx_tag }; this.tag.SetTags(tags); return tag; }
public File(TagLib.File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { this.tag = new CombinedTag(); base.Mode = TagLib.File.AccessMode.Read; try { uint num; long num2; long num3; this.Read(true, propertiesStyle, out num, out num2, out num3); } finally { base.Mode = TagLib.File.AccessMode.Closed; } base.TagTypesOnDisk = base.TagTypes; this.GetTag(TagTypes.None | TagTypes.Id3v2, true); this.GetTag(TagTypes.RiffInfo, true); this.GetTag(TagTypes.MovieId, true); this.GetTag(TagTypes.DivX, true); }
protected override void ReadEnd(long end, ReadStyle propertiesStyle) { TagLib.Tag[] tags = new TagLib.Tag[] { this.metadata, base.Tag }; this.tag = new CombinedTag(tags); this.GetTag(TagTypes.Xiph, true); }