/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="File.IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File(File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { Magic = 85; // Panasonic uses 0x55 Read (propertiesStyle); }
public AsfProperties(AsfHeaderObject header, ReadStyle style) : base(style) { duration = TimeSpan.Zero; //codecId = 0; //channels = 0; //sampleRate = 0; //bytesPerSecond = 0; foreach (AsfObject obj in header.Children) { if (obj is AsfFilePropertiesObject) duration = ((AsfFilePropertiesObject)obj).PlayDuration; if (obj is AsfStreamPropertiesObject && bytesPerSecond == 0) { AsfStreamPropertiesObject stream = (AsfStreamPropertiesObject)obj; if (!stream.StreamType.Equals(AsfGuid.AsfAudioMedia)) continue; ByteVector data = stream.TypeSpecificData; codecId = data.Mid(0, 2).ToShort(false); channels = data.Mid(2, 2).ToShort(false); sampleRate = data.Mid(4, 4).ToUInt(false); bytesPerSecond = data.Mid(8, 4).ToUInt(false); } } }
protected override void ReadStart(long start, ReadStyle propertiesStyle) { if ((propertiesStyle != ReadStyle.None) && !AudioHeader.Find(out this.first_header, this, start, 0x4000)) { throw new CorruptFileException("MPEG audio header not found."); } }
protected OggFlacFile(string file, ReadStyle propertiesStyle) : base(file) { //comment = null; //properties = null; //stream_info_data = null; //xiph_comment_data = null; //stream_start = 0; //stream_length = 0; //scanned = false; //has_xiph_comment = false; //comment_packet = 0; try { Mode = FileAccessMode.Read; } catch (TagLibException) { scanned = true; return; } Read(propertiesStyle); Mode = FileAccessMode.Closed; }
public FlacFile(string file, ReadStyle propertiesStyle) : base (file) { //id3v2Tag = null; //id3v1Tag = null; //comment = null; //properties = null; //flac_start = 0; //stream_start = 0; //stream_length = 0; //scanned = false; tag = new CombinedTag(); try { Mode = FileAccessMode.Read; } catch (TagLibException) { return; } Read(propertiesStyle); Mode = FileAccessMode.Closed; }
protected override void ReadStart(long start, ReadStyle propertiesStyle) { if ((this.header_block == null) || (propertiesStyle != ReadStyle.None)) { base.Seek(start); this.header_block = base.ReadBlock(0x20); } }
private void Read(ReadStyle propertiesStyle) { AsfHeaderObject header = new AsfHeaderObject(this, 0); asfTag = new AsfTag(header); if (propertiesStyle != ReadStyle.None) properties = new AsfProperties(header, propertiesStyle); }
public FlacProperties(ByteVector data, long streamLength, ReadStyle style) : base(style) { duration = TimeSpan.Zero; //bitrate = 0; //sample_rate = 0; //sample_width = 0; //channels = 0; Read(data, streamLength); // the old version of this had style as the third parameter }
private void Read(bool read_tags, ReadStyle style, out uint aiff_size, out long tag_start, out long tag_end) { base.Seek(0L); if (base.ReadBlock(4) != FileIdentifier) { throw new CorruptFileException("File does not begin with AIFF identifier"); } aiff_size = base.ReadBlock(4).ToUInt(true); tag_start = -1L; tag_end = -1L; if ((this.header_block == null) && (style != ReadStyle.None)) { long offset = base.Find(CommIdentifier, 0L); if (offset == -1L) { throw new CorruptFileException("No Common chunk available in AIFF file."); } base.Seek(offset); this.header_block = base.ReadBlock(0x1a); StreamHeader header = new StreamHeader(this.header_block, (long) ((ulong) aiff_size)); ICodec[] codecs = new ICodec[] { header }; this.properties = new TagLib.Properties(TimeSpan.Zero, codecs); } long num2 = -1L; if (base.Find(SoundIdentifier, 0L, ID3Identifier) == -1L) { num2 = base.Find(ID3Identifier, 0L); } long num3 = base.Find(SoundIdentifier, 0L); if (num3 == -1L) { throw new CorruptFileException("No Sound chunk available in AIFF file."); } base.Seek(num3 + 4L); long startPosition = (((long) base.ReadBlock(4).ToULong(true)) + num3) + 4L; if (num2 == -1L) { num2 = base.Find(ID3Identifier, startPosition); } if (num2 > -1L) { if (read_tags && (this.tag == null)) { this.tag = new TagLib.Id3v2.Tag(this, num2 + 8L); } base.Seek(num2 + 4L); uint num6 = base.ReadBlock(4).ToUInt(true) + 8; long num7 = num2; base.InvariantStartPosition = num7; tag_start = num7; num7 = tag_start + num6; base.InvariantEndPosition = num7; tag_end = num7; } }
public File (File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base (abstraction) { Mode = AccessMode.Read; try { tag = new GroupedComment (); Read (propertiesStyle); TagTypesOnDisk = TagTypes; } finally { Mode = AccessMode.Closed; } }
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 OggVorbisProperties(OggVorbisFile file, ReadStyle style) : base(style) { duration = TimeSpan.Zero; //bitrate = 0; //sample_rate = 0; //channels = 0; //vorbis_version = 0; //bitrate_maximum = 0; //bitrate_nominal = 0; //bitrate_minimum = 0; Read(file); // the old version of this had style as the second parameter }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="File.IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File(File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { ImageTag = new CombinedImageTag (TagTypes.TiffIFD | TagTypes.XMP); Mode = AccessMode.Read; try { Read (propertiesStyle); TagTypesOnDisk = TagTypes; } finally { Mode = AccessMode.Closed; } }
public File(TagLib.File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { base.Mode = TagLib.File.AccessMode.Read; try { this.tag = new GroupedComment(); this.Read(propertiesStyle); base.TagTypesOnDisk = base.TagTypes; } finally { base.Mode = TagLib.File.AccessMode.Closed; } }
////////////////////////////////////////////////////////////////////////// // public methods ////////////////////////////////////////////////////////////////////////// public MpegProperties (MpegFile file, ReadStyle style) : base (style) { this.file = file; duration = TimeSpan.Zero; //bitrate = 0; //sample_rate = 0; //channels = 0; version = MpegVersion.One; //layer = 0; channel_mode = MpegChannelMode.Stereo; //is_copyrighted = false; //is_original = false; Read(); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified path in the local file /// system and specified read style. /// </summary> /// <param name="path"> /// A <see cref="string" /> object containing the path of the /// file to use in the new instance. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="path" /> is <see langword="null" />. /// </exception> public File (string path, ReadStyle propertiesStyle, CUETools.Processor.CUEToolsTagger _tagger) : base (path, propertiesStyle) { tagger = _tagger; // Make sure we have a tag. switch (tagger) { case CUETools.Processor.CUEToolsTagger.APEv2: GetTag(TagTypes.Ape, true); break; case CUETools.Processor.CUEToolsTagger.ID3v2: GetTag(TagTypes.Id3v2, true); break; } }
private GeoInfo() { this.m_CurrentReadStyle = ReadStyle.ClosestResolution; this.m_ClutterlayerIndex = 0; this.m_geoClutterCalcBound = null; this.m_HeightlayerIndex = 0; this.m_geoHeightCalcBound = null; this.m_BuildinglayerIndex = 0; this.m_geoBuildingCalcBound = null; this.pointThreadTag = new object(); this.lineThreadTag = new object(); this.boundThreadTag = new object(); this.m_IsGeoXYLinePointCalc = false; this.m_ClutterIDInLine = null; this.m_PointListOfClutterID = null; }
public File(TagLib.File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { 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); }
////////////////////////////////////////////////////////////////////////// // public methods ////////////////////////////////////////////////////////////////////////// public OggVorbisFile (string file, ReadStyle properties_style) : base (file) { //comment = null; //properties = null; try { Mode = FileAccessMode.Read; } catch (TagLibException) { return; } Read(properties_style); Mode = FileAccessMode.Closed; }
public AsfFile(string file, ReadStyle propertiesStyle) : base(file) { //asfTag = null; //properties = null; try { Mode = FileAccessMode.Read; } catch (TagLibException) { return; } Read(propertiesStyle); Mode = FileAccessMode.Closed; }
private void Read(ReadStyle propertiesStyle) { base.Mode = TagLib.File.AccessMode.Read; try { this.tag = new TagLib.NonContainer.Tag(this); base.InvariantStartPosition = this.tag.ReadStart(); base.TagTypesOnDisk |= this.StartTag.TagTypes; this.ReadStart(base.InvariantStartPosition, propertiesStyle); base.InvariantEndPosition = (base.InvariantStartPosition != base.Length) ? this.tag.ReadEnd() : base.Length; base.TagTypesOnDisk |= this.EndTag.TagTypes; this.ReadEnd(base.InvariantEndPosition, propertiesStyle); this.properties = (propertiesStyle == ReadStyle.None) ? null : this.ReadProperties(base.InvariantStartPosition, base.InvariantEndPosition, propertiesStyle); } finally { base.Mode = TagLib.File.AccessMode.Closed; } }
private void Read(ReadStyle propertiesStyle) { long num; Dictionary<uint, Bitstream> dictionary = this.ReadStreams(null, out num); List<ICodec> codecs = new List<ICodec>(); base.InvariantStartPosition = num; base.InvariantEndPosition = base.Length; foreach (uint num2 in dictionary.Keys) { this.tag.AddComment(num2, dictionary[num2].Codec.CommentData); codecs.Add(dictionary[num2].Codec); } if (propertiesStyle != ReadStyle.None) { PageHeader lastPageHeader = this.LastPageHeader; TimeSpan duration = dictionary[lastPageHeader.StreamSerialNumber].GetDuration(lastPageHeader.AbsoluteGranularPosition); this.properties = new TagLib.Properties(duration, codecs); } }
public WavPackFile(string file, ReadStyle propertiesStyle) : base(file) { //apeTag = null; //id3v1Tag = null; tag = new CombinedTag(); //properties = null; try { Mode = FileAccessMode.Read; } catch (TagLibException) { return; } Read(propertiesStyle); Mode = FileAccessMode.Closed; }
public File (File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base (abstraction) { uint riff_size; long tag_start, tag_end; Mode = AccessMode.Read; try { Read (true, propertiesStyle, out riff_size, out tag_start, out tag_end); } finally { Mode = AccessMode.Closed; } TagTypesOnDisk = TagTypes; GetTag (TagTypes.Id3v2, true); GetTag (TagTypes.RiffInfo, true); GetTag (TagTypes.MovieId, true); GetTag (TagTypes.DivX, true); }
public static TagLib.File Create(IFileAbstraction abstraction, string mimetype, ReadStyle propertiesStyle) { TagLib.File file3; if (mimetype == null) { string str = string.Empty; int startIndex = abstraction.Name.LastIndexOf(".") + 1; if ((startIndex >= 1) && (startIndex < abstraction.Name.Length)) { str = abstraction.Name.Substring(startIndex, abstraction.Name.Length - startIndex); } mimetype = "taglib/" + str.ToLower(CultureInfo.InvariantCulture); } foreach (FileTypeResolver resolver in file_type_resolvers) { TagLib.File file = resolver(abstraction, mimetype, propertiesStyle); if (file != null) { return file; } } if (!FileTypes.AvailableTypes.ContainsKey(mimetype)) { object[] args = new object[] { abstraction.Name, mimetype }; throw new UnsupportedFormatException(string.Format(CultureInfo.InvariantCulture, "{0} ({1})", args)); } Type type = FileTypes.AvailableTypes[mimetype]; try { object[] objArray2 = new object[] { abstraction, propertiesStyle }; TagLib.File file2 = (TagLib.File) Activator.CreateInstance(type, objArray2); file2.MimeType = mimetype; file3 = file2; } catch (TargetInvocationException exception) { throw exception.InnerException; } return file3; }
public Mpeg4File(string file, ReadStyle propertiesStyle) : base(file) { // Nullify for safety. //tag = null; //properties = null; // Try to open read support. try { Mode = FileAccessMode.Read; } catch (TagLibException) { return; } // Read Read(propertiesStyle); // Be nice and close. Mode = FileAccessMode.Closed; }
private void Read (ReadStyle properties_style) { long end; Dictionary<uint, Bitstream> streams = ReadStreams (null, out end); List<ICodec> codecs = new List<ICodec> (); InvariantStartPosition = end; InvariantEndPosition = Length; foreach (uint id in streams.Keys) { tag.AddComment (id, streams [id].Codec.CommentData); codecs.Add (streams [id].Codec); } if (properties_style == ReadStyle.None) return; PageHeader last_header = LastPageHeader; TimeSpan duration = streams [last_header.StreamSerialNumber].GetDuration (last_header.AbsoluteGranularPosition); properties = new Properties (duration, codecs); }
public GeoInfo(IGeoDataMgr IGeoDataMgr) { this.m_CurrentReadStyle = ReadStyle.ClosestResolution; this.m_ClutterlayerIndex = 0; this.m_geoClutterCalcBound = null; this.m_HeightlayerIndex = 0; this.m_geoHeightCalcBound = null; this.m_BuildinglayerIndex = 0; this.m_geoBuildingCalcBound = null; this.pointThreadTag = new object(); this.lineThreadTag = new object(); this.boundThreadTag = new object(); this.m_IsGeoXYLinePointCalc = false; this.m_ClutterIDInLine = null; this.m_PointListOfClutterID = null; this.m_GeoDataMgr = IGeoDataMgr; this.m_DemDataColletion = new Dictionary<DemDataType, List<IGeoRasterData>>(); this.m_DemDataColletion.Add(DemDataType.Clutter, this.m_GeoDataMgr.ClutterRasterData); this.m_DemDataColletion.Add(DemDataType.Height, this.m_GeoDataMgr.HeightRasterData); this.m_DemDataColletion.Add(DemDataType.Building, this.m_GeoDataMgr.BuildingRasterData); this.InitGetValueByPointDelegate(); }
/// <summary> /// Reads format specific information at the end of the /// file. /// </summary> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or /// <see /// cref="ReadStyle.None" /> /// to ignore the properties. /// </param> protected override void ReadEnd(long end, ReadStyle propertiesStyle) { }
public static File Create(string path, string mimetype, ReadStyle propertiesStyle) { return(Create(new LocalFileAbstraction(path), mimetype, propertiesStyle)); }
/// <summary> /// Reads the tags stored at the end of the file into the /// current instance. /// </summary> /// <returns> /// A <see cref="long" /> value indicating the seek position /// in the file at which the read tags begin. This also /// marks the seek position at which the media ends. /// </returns> public long ReadEnd(ReadStyle style) { return(EndTag.Read(style)); }
/// <summary> /// Reads format specific information at the end of the /// file. /// </summary> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> protected override void ReadEnd(long end, ReadStyle propertiesStyle) { // Make sure we have ID3v1 and ID3v2 tags. GetTag(TagTypes.Id3v1, true); GetTag(TagTypes.Id3v2, true); }
/// <summary> /// Reads the audio properties from the file represented by /// the current instance. /// </summary> /// <param name="start"> /// A <see cref="long" /> value containing the seek position /// at which the tags end and the media data begins. /// </param> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <returns> /// A <see cref="TagLib.Properties" /> object describing the /// media properties of the file represented by the current /// instance. /// </returns> /// <remarks> /// This method is called ONLY IF the file is constructed /// with a read style other than <see cref="ReadStyle.None" /// />, and as such MUST NOT return <see langword="null" />. /// It is guaranteed that <see cref="ReadStart" /> and <see /// cref="ReadEnd" /> will have been called first and this /// method should be strictly used to perform final /// processing on already read data. /// </remarks> protected abstract Properties ReadProperties(long start, long end, ReadStyle propertiesStyle);
protected File(string path, ReadStyle propertiesStyle) : base(path) { Read(propertiesStyle); }
/// <summary> /// Reads format specific information at the end of the /// file. /// </summary> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> protected override void ReadEnd(long end, ReadStyle propertiesStyle) { // Make sure we have an APE tag. GetTag(TagTypes.Ape, true); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File(File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction, propertiesStyle) { }
protected override Properties ReadProperties(long start, long end, ReadStyle propertiesStyle) { first_header.SetStreamLength(end - start); return(new Properties(TimeSpan.Zero, first_header)); }
protected override void ReadEnd(long end, ReadStyle propertiesStyle) { GetTag(TagTypes.Id3v1, true); GetTag(TagTypes.Id3v2, true); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File(File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { Magic = 85; // Panasonic uses 0x55 Read(propertiesStyle); }
/// <summary> /// Reads format specific information at the end of the /// file. /// </summary> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> protected override void ReadEnd (long end, ReadStyle propertiesStyle) { // Make sure we have ID3v1 and ID3v2 tags. GetTag (TagTypes.Id3v1, true); GetTag (TagTypes.Id3v2, true); if (propertiesStyle == ReadStyle.None || start_time == null) return; RFindMarker (ref end, Marker.SystemSyncPacket); end_time = ReadTimestamp (end + 4); }
/// <summary> /// Reads the tags stored at the start of the file into the /// current instance. /// </summary> /// <returns> /// A <see cref="long" /> value indicating the seek position /// in the file at which the read tags end. This also /// marks the seek position at which the media begins. /// </returns> public long ReadStart(ReadStyle style) { return(StartTag.Read(style)); }
public static File Create(string path, ReadStyle style) { return(Create(path, null, style)); }
/// <summary> /// Reads the file with a specified read style. /// </summary> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> private void Read(ReadStyle propertiesStyle) { // TODO: Support Id3v2 boxes!!! tag = new CombinedTag(); Mode = AccessMode.Read; try { FileParser parser = new FileParser(this); if (propertiesStyle == ReadStyle.None) { parser.ParseTag(); } else { parser.ParseTagAndProperties(); } InvariantStartPosition = parser.MdatStartPosition; InvariantEndPosition = parser.MdatEndPosition; udta_boxes.AddRange(parser.UserDataBoxes); // Ensure our collection contains at least a single empty box if (udta_boxes.Count == 0) { IsoUserDataBox dummy = new IsoUserDataBox(); udta_boxes.Add(dummy); } // Check if a udta with ILST actually exists if (IsAppleTagUdtaPresent()) { TagTypesOnDisk |= TagTypes.Apple; //There is an udta present with ILST info } // Find the udta box with the Apple Tag ILST IsoUserDataBox udtaBox = FindAppleTagUdta(); if (null == udtaBox) { udtaBox = new IsoUserDataBox(); } apple_tag = new AppleTag(udtaBox); tag.SetTags(apple_tag); // If we're not reading properties, we're done. if (propertiesStyle == ReadStyle.None) { Mode = AccessMode.Closed; return; } // Get the movie header box. IsoMovieHeaderBox mvhd_box = parser.MovieHeaderBox; if (mvhd_box == null) { Mode = AccessMode.Closed; throw new CorruptFileException( "mvhd box not found."); } IsoAudioSampleEntry audio_sample_entry = parser.AudioSampleEntry; IsoVisualSampleEntry visual_sample_entry = parser.VisualSampleEntry; // Read the properties. properties = new Properties(mvhd_box.Duration, audio_sample_entry, visual_sample_entry); } finally { Mode = AccessMode.Closed; } }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified path in the local file /// system and specified read style. /// </summary> /// <param name="path"> /// A <see cref="string" /> object containing the path of the /// file to use in the new instance. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="path" /> is <see langword="null" />. /// </exception> public File(string path, ReadStyle propertiesStyle) : base(path, propertiesStyle) { }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified path in the local file /// system and specified read style. /// </summary> /// <param name="path"> /// A <see cref="string" /> object containing the path of the /// file to use in the new instance. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="path" /> is <see langword="null" />. /// </exception> public File(string path, ReadStyle propertiesStyle) : this(new LocalFileAbstraction(path), propertiesStyle) { }
/// <summary> /// Reads the contents of the current instance determining /// the size of the riff data, the area the tagging is in, /// and optionally reading in the tags and media properties. /// </summary> /// <param name="read_tags"> /// If <see langword="true" />, any tags found will be read /// into the current instance. /// </param> /// <param name="style"> /// A <see cref="ReadStyle"/> value specifying how the media /// data is to be read into the current instance. /// </param> /// <param name="aiff_size"> /// A <see cref="uint"/> value reference to be filled with /// the size of the RIFF data as read from the file. /// </param> /// <param name="tag_start"> /// A <see cref="long" /> value reference to be filled with /// the absolute seek position at which the tagging data /// starts. /// </param> /// <param name="tag_end"> /// A <see cref="long" /> value reference to be filled with /// the absolute seek position at which the tagging data /// ends. /// </param> /// <exception cref="CorruptFileException"> /// The file does not begin with <see cref="FileIdentifier" /// />. /// </exception> private void Read(bool read_tags, ReadStyle style, out uint aiff_size, out long tag_start, out long tag_end) { Seek(0); if (ReadBlock(4) != FileIdentifier) { throw new CorruptFileException( "File does not begin with AIFF identifier"); } aiff_size = ReadBlock(4).ToUInt(true); tag_start = -1; tag_end = -1; // Get the properties of the file if (header_block == null && style != ReadStyle.None) { long common_chunk_pos = Find(CommIdentifier, 0); if (common_chunk_pos == -1) { throw new CorruptFileException( "No Common chunk available in AIFF file."); } Seek(common_chunk_pos); header_block = ReadBlock((int)StreamHeader.Size); StreamHeader header = new StreamHeader(header_block, aiff_size); properties = new Properties(TimeSpan.Zero, header); } // Now we search for the ID3 chunk. // Normally it appears after the Sound data chunk. But as the order of // chunks is free, it might be the case that the ID3 chunk appears before // the sound data chunk. // So we search first for the Sound data chunk and see, if an ID3 chunk appears before long id3_chunk_pos = -1; long sound_chunk_pos = Find(SoundIdentifier, 0, ID3Identifier); if (sound_chunk_pos == -1) { // The ID3 chunk appears before the Sound chunk id3_chunk_pos = Find(ID3Identifier, 0); } // Now let's look for the Sound chunk again // Since a previous return value of -1 does mean, that the ID3 chunk was found first sound_chunk_pos = Find(SoundIdentifier, 0); if (sound_chunk_pos == -1) { throw new CorruptFileException( "No Sound chunk available in AIFF file."); } // Get the length of the Sound chunk and use this as a start value to look for the ID3 chunk Seek(sound_chunk_pos + 4); ulong sound_chunk_length = ReadBlock(4).ToULong(true); long start_search_pos = (long)sound_chunk_length + sound_chunk_pos + 4; if (id3_chunk_pos == -1) { id3_chunk_pos = Find(ID3Identifier, start_search_pos); } if (id3_chunk_pos > -1) { if (read_tags && tag == null) { tag = new Id3v2.Tag(this, id3_chunk_pos + 8); } // Get the length of the tag out of the ID3 chunk Seek(id3_chunk_pos + 4); uint tag_size = ReadBlock(4).ToUInt(true) + 8; tag_start = InvariantStartPosition = id3_chunk_pos; tag_end = InvariantEndPosition = tag_start + tag_size; } }
/// <summary> /// Reads format specific information at the end of the /// file. /// </summary> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <remarks> /// This method is called by the constructor immediately /// after the tags at the end of the file have been read /// and as such (so the internal seek mechanism is close to /// the end). It should be used for reading any content /// specific information, such as an audio header from the /// end of the file. /// </remarks> protected virtual void ReadEnd(long end, ReadStyle propertiesStyle) { }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="AudioFile" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="TagLib.File.IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public AudioFile(IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction, propertiesStyle) { }
/// <summary> /// Reads the file with a specified read style. /// </summary> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> private void Read(ReadStyle propertiesStyle) { // TODO: Support Id3v2 boxes!!! tag = new CombinedTag(); Mode = AccessMode.Read; try { FileParser parser = new FileParser(this); if (propertiesStyle == ReadStyle.None) { parser.ParseTag(); } else { parser.ParseTagAndProperties(); } InvariantStartPosition = parser.MdatStartPosition; InvariantEndPosition = parser.MdatEndPosition; udta_box = parser.UserDataBox; if (udta_box != null && udta_box.GetChild(BoxType.Meta) != null && udta_box.GetChild(BoxType.Meta ).GetChild(BoxType.Ilst) != null) { TagTypesOnDisk |= TagTypes.Apple; } if (udta_box == null) { udta_box = new IsoUserDataBox(); } apple_tag = new AppleTag(udta_box); tag.SetTags(apple_tag); // If we're not reading properties, we're done. if (propertiesStyle == ReadStyle.None) { Mode = AccessMode.Closed; return; } // Get the movie header box. IsoMovieHeaderBox mvhd_box = parser.MovieHeaderBox; if (mvhd_box == null) { Mode = AccessMode.Closed; throw new CorruptFileException( "mvhd box not found."); } IsoAudioSampleEntry audio_sample_entry = parser.AudioSampleEntry; IsoVisualSampleEntry visual_sample_entry = parser.VisualSampleEntry; // Read the properties. properties = new Properties(mvhd_box.Duration, audio_sample_entry, visual_sample_entry); } finally { Mode = AccessMode.Closed; } }
/// <summary> /// Reads the contents of the current instance determining /// the size of the riff data, the area the tagging is in, /// and optionally reading in the tags and media properties. /// </summary> /// <param name="read_tags"> /// If <see langword="true" />, any tags found will be read /// into the current instance. /// </param> /// <param name="style"> /// A <see cref="ReadStyle"/> value specifying how the media /// data is to be read into the current instance. /// </param> /// <param name="aiff_size"> /// A <see cref="uint"/> value reference to be filled with /// the size of the RIFF data as read from the file. /// </param> /// <param name="tag_start"> /// A <see cref="long" /> value reference to be filled with /// the absolute seek position at which the tagging data /// starts. /// </param> /// <param name="tag_end"> /// A <see cref="long" /> value reference to be filled with /// the absolute seek position at which the tagging data /// ends. /// </param> /// <exception cref="CorruptFileException"> /// The file does not begin with <see cref="FileIdentifier" /// />. /// </exception> private void Read(bool read_tags, ReadStyle style, out uint aiff_size, out long tag_start, out long tag_end) { Seek(0); if (ReadBlock(4) != FileIdentifier) { throw new CorruptFileException( "File does not begin with AIFF identifier"); } aiff_size = ReadBlock(4).ToUInt(true); tag_start = -1; tag_end = -1; // Check formType if (ReadBlock(4) != AIFFFormType) { throw new CorruptFileException( "File form type is not AIFF"); } long formBlockChunksPosition = Tell; // Get the properties of the file if (header_block == null && style != ReadStyle.None) { long common_chunk_pos = FindChunk(CommIdentifier, formBlockChunksPosition); if (common_chunk_pos == -1) { throw new CorruptFileException( "No Common chunk available in AIFF file."); } Seek(common_chunk_pos); header_block = ReadBlock((int)StreamHeader.Size); StreamHeader header = new StreamHeader(header_block, aiff_size); properties = new Properties(TimeSpan.Zero, header); } // Search for the ID3 chunk long id3_chunk_pos = FindChunk(ID3Identifier, formBlockChunksPosition); // Search for the sound chunk long sound_chunk_pos = FindChunk(SoundIdentifier, formBlockChunksPosition); // Ensure there is a sound chunk for the file to be valid if (sound_chunk_pos == -1) { throw new CorruptFileException( "No Sound chunk available in AIFF file."); } // Get the length of the Sound chunk and use this as a start value to look for the ID3 chunk Seek(sound_chunk_pos + 4); // Read the id3 chunk if (id3_chunk_pos > -1) { if (read_tags && tag == null) { tag = new Id3v2.Tag(this, id3_chunk_pos + 8); } // Get the length of the tag out of the ID3 chunk Seek(id3_chunk_pos + 4); uint tag_size = ReadBlock(4).ToUInt(true) + 8; tag_start = InvariantStartPosition = id3_chunk_pos; tag_end = InvariantEndPosition = tag_start + tag_size; } }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="TagLib.File.IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File (IFileAbstraction abstraction, ReadStyle propertiesStyle) : base (abstraction) { Read (propertiesStyle); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="TagLib.File.IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File(IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { ImageTag = new CombinedImageTag(TagTypes.XMP); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified path in the local file /// system and specified read style. /// </summary> /// <param name="path"> /// A <see cref="string" /> object containing the path of the /// file to use in the new instance. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="path" /> is <see langword="null" />. /// </exception> public File (string path, ReadStyle propertiesStyle) : base (path) { Read (propertiesStyle); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langref="null" /// />. /// </exception> protected File(File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { Read(propertiesStyle); }
/// <summary> /// Reads the audio properties from the file represented by /// the current instance. /// </summary> /// <param name="start"> /// A <see cref="long" /> value containing the seek position /// at which the tags end and the media data begins. /// </param> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <returns> /// A <see cref="TagLib.Properties" /> object describing the /// media properties of the file represented by the current /// instance. /// </returns> protected override Properties ReadProperties(long start, long end, ReadStyle propertiesStyle) { var header = new StreamHeader(header_block, end - stream_start); return(new Properties(TimeSpan.Zero, header)); }
/// <summary> /// Reads format specific information at the start of the /// file. /// </summary> /// <param name="start"> /// A <see cref="long" /> value containing the seek position /// at which the tags end and the media data begins. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <remarks> /// This method is called by the constructor immediately /// after the tags at the start of the file have been read /// and as such (so the internal seek mechanism is close to /// the start). It should be used for reading any content /// specific information, such as an audio header from the /// start of the file. /// </remarks> protected virtual void ReadStart(long start, ReadStyle propertiesStyle) { }
public static void WriteStandardPictures(string sample_file, string tmp_file, ReadStyle readStyle = ReadStyle.Average, TestTagLevel level = TestTagLevel.Medium) { if (System.IO.File.Exists(tmp_file)) { System.IO.File.Delete(tmp_file); } File file = null; try { System.IO.File.Copy(sample_file, tmp_file); file = File.Create(tmp_file, readStyle); } finally { } Assert.NotNull(file); var pics = file.Tag.Pictures; // Raw Picture data references var raws = new ByteVector[3]; // Insert new picture Array.Resize(ref pics, 3); raws[0] = ByteVector.FromPath(sample_picture); pics[0] = new Picture(sample_picture); pics[0].Type = PictureType.BackCover; pics[0].Description = "TEST description 1"; raws[1] = ByteVector.FromPath(sample_other); pics[1] = new Picture(sample_other); pics[1].Description = "TEST description 2"; raws[2] = raws[0]; pics[2] = new Picture(sample_picture); pics[2].Filename = "renamed.gif"; pics[2].Type = PictureType.Other; pics[2].Description = "TEST description 3"; file.Tag.Pictures = pics; file.Save(); // Read back the tags file = File.Create(tmp_file, readStyle); Assert.NotNull(file); pics = file.Tag.Pictures; Assert.AreEqual(3, pics.Length); // Lazy picture check var isLazy = (readStyle & ReadStyle.PictureLazy) != 0; for (int i = 0; i < 3; i++) { if (isLazy) { Assert.IsTrue(pics[i] is ILazy); if (pics[i] is ILazy lazy) { Assert.IsFalse(lazy.IsLoaded); } } else { if (pics[i] is ILazy lazy) { Assert.IsTrue(lazy.IsLoaded); } } } Assert.AreEqual("TEST description 1", pics[0].Description); Assert.AreEqual("image/gif", pics[0].MimeType); Assert.AreEqual(73, pics[0].Data.Count); Assert.AreEqual(raws[0], pics[0].Data); Assert.AreEqual("TEST description 2", pics[1].Description); Assert.AreEqual(102400, pics[1].Data.Count); Assert.AreEqual(raws[1], pics[1].Data); Assert.AreEqual("TEST description 3", pics[2].Description); Assert.AreEqual("image/gif", pics[2].MimeType); Assert.AreEqual(73, pics[2].Data.Count); Assert.AreEqual(raws[2], pics[2].Data); // Types and Mime-Types assumed to be properly supported at Medium level test if (level >= TestTagLevel.Medium) { Assert.AreEqual("audio/mp4", pics[1].MimeType); Assert.AreEqual(PictureType.BackCover, pics[0].Type); Assert.AreEqual(PictureType.NotAPicture, pics[1].Type); Assert.AreEqual(PictureType.Other, pics[2].Type); } else { Assert.AreNotEqual(PictureType.NotAPicture, pics[0].Type); Assert.AreEqual(PictureType.NotAPicture, pics[1].Type); Assert.AreNotEqual(PictureType.NotAPicture, pics[2].Type); } // Filename assumed to be properly supported at High level test if (level >= TestTagLevel.High) { Assert.AreEqual("apple_tags.m4a", pics[1].Filename); } else if (level >= TestTagLevel.Medium) { if (pics[1].Filename != null) { Assert.AreEqual("apple_tags.m4a", pics[1].Filename); } } }
/// <summary> /// Reads the contents of the current instance determining /// the size of the riff data, the area the tagging is in, /// and optionally reading in the tags and media properties. /// </summary> /// <param name="read_tags"> /// If <see langword="true" />, any tags found will be read /// into the current instance. /// </param> /// <param name="style"> /// A <see cref="ReadStyle"/> value specifying how the media /// data is to be read into the current instance. /// </param> /// <param name="riff_size"> /// A <see cref="uint"/> value reference to be filled with /// the size of the RIFF data as read from the file. /// </param> /// <param name="tag_start"> /// A <see cref="long" /> value reference to be filled with /// the absolute seek position at which the tagging data /// starts. /// </param> /// <param name="tag_end"> /// A <see cref="long" /> value reference to be filled with /// the absolute seek position at which the tagging data /// ends. /// </param> /// <exception cref="CorruptFileException"> /// The file does not begin with <see cref="FileIdentifier" /// />. /// </exception> private void Read(bool read_tags, ReadStyle style, out uint riff_size, out long tag_start, out long tag_end) { Seek(0); if (ReadBlock(4) != FileIdentifier) { throw new CorruptFileException( "File does not begin with RIFF identifier"); } riff_size = ReadBlock(4).ToUInt(false); ByteVector stream_format = ReadBlock(4); tag_start = -1; tag_end = -1; long position = 12; long length = Length; uint size = 0; TimeSpan duration = TimeSpan.Zero; ICodec [] codecs = new ICodec [0]; // Read until there are less than 8 bytes to read. do { bool tag_found = false; Seek(position); string fourcc = ReadBlock(4).ToString(StringType.UTF8); size = ReadBlock(4).ToUInt(false); switch (fourcc) { // "fmt " is used by Wave files to hold the // WaveFormatEx structure. case "fmt ": if (style == ReadStyle.None || stream_format != "WAVE") { break; } Seek(position + 8); codecs = new ICodec [] { new WaveFormatEx(ReadBlock(18)) }; break; // "data" contains the audio data for wave // files. It's contents represent the invariant // portion of the file and is used to determine // the duration of a file. It should always // appear after "fmt ". case "data": if (stream_format != "WAVE") { break; } InvariantStartPosition = position; InvariantEndPosition = position + size; if (style == ReadStyle.None || codecs.Length != 1 || !(codecs [0] is WaveFormatEx)) { break; } duration += TimeSpan.FromSeconds( (double)size / (double) ((WaveFormatEx)codecs [0]) .AverageBytesPerSecond); break; // Lists are used to store a variety of data // collections. Read the type and act on it. case "LIST": { switch (ReadBlock(4).ToString(StringType.UTF8)) { // "hdlr" is used by AVI files to hold // a media header and BitmapInfoHeader // and WaveFormatEx structures. case "hdrl": if (style == ReadStyle.None || stream_format != "AVI ") { continue; } AviHeaderList header_list = new AviHeaderList(this, position + 12, (int)(size - 4)); duration = header_list.Header.Duration; codecs = header_list.Codecs; break; // "INFO" is a tagging format handled by // the InfoTag class. case "INFO": if (read_tags && info_tag == null) { info_tag = new InfoTag( this, position + 12, (int)(size - 4)); } tag_found = true; break; // "MID " is a tagging format handled by // the MovieIdTag class. case "MID ": if (read_tags && mid_tag == null) { mid_tag = new MovieIdTag( this, position + 12, (int)(size - 4)); } tag_found = true; break; // "movi" contains the media data for // and AVI and its contents represent // the invariant portion of the file. case "movi": if (stream_format != "AVI ") { break; } InvariantStartPosition = position; InvariantEndPosition = position + size; break; } break; } // "ID32" is a custom box for this format that // contains an ID3v2 tag. case "ID32": if (read_tags && id32_tag == null) { id32_tag = new Id3v2.Tag(this, position + 8); } tag_found = true; break; // "IDVX" is used by DivX and holds an ID3v1- // style tag. case "IDVX": if (read_tags && divx_tag == null) { divx_tag = new DivXTag(this, position + 8); } tag_found = true; break; // "JUNK" is a padding element that could be // associated with tag data. case "JUNK": if (tag_end == position) { tag_end = position + 8 + size; } break; } // Determine the region of the file that // contains tags. if (tag_found) { if (tag_start == -1) { tag_start = position; tag_end = position + 8 + size; } else if (tag_end == position) { tag_end = position + 8 + size; } } // Move to the next item. } while ((position += 8 + size) + 8 < length); // If we're reading properties, and one were found, // throw an exception. Otherwise, create the Properties // object. if (style != ReadStyle.None) { if (codecs.Length == 0) { throw new UnsupportedFormatException( "Unsupported RIFF type."); } properties = new Properties(duration, codecs); } // If we're reading tags, update the combined tag. if (read_tags) { tag.SetTags(id32_tag, info_tag, mid_tag, divx_tag); } }
/// <summary> /// Reads the audio properties from the file represented by /// the current instance. /// </summary> /// <param name="start"> /// A <see cref="long" /> value containing the seek position /// at which the tags end and the media data begins. /// </param> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <returns> /// A <see cref="TagLib.Properties" /> object describing the /// media properties of the file represented by the current /// instance. /// </returns> protected override Properties ReadProperties (long start, long end, ReadStyle propertiesStyle) { TimeSpan duration = start_time == null ? TimeSpan.Zero : TimeSpan.FromSeconds ( end_time - (double) start_time); return new Properties (duration, video_header, audio_header); }
/// <summary> /// Reads format specific information at the end of the /// file. /// </summary> /// <param name="end"> /// A <see cref="long" /> value containing the seek position /// at which the media data ends and the tags begin. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> protected override void ReadEnd(long end, ReadStyle propertiesStyle) { tag = new CombinedTag(metadata, base.Tag); GetTag(TagTypes.Xiph, true); }