/// <summary> /// Reads an audio packet, assigning the audio header and /// advancing the position to the next packet position. /// </summary> /// <param name="position"> /// A <see cref="long" /> value reference specifying the /// position at which to start reading the packet. This value /// is updated to the position of the next packet. /// </param> void ReadAudioPacket(ref long position) { Seek(position + 4); int length = ReadBlock(2).ToUShort(); if (!audio_found) { audio_found = AudioHeader.Find( out audio_header, this, position + 15, length - 9); } position += length; }
/// <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 only searches for an audio header in the /// first 16384 bytes of code to avoid searching forever in /// corrupt files. /// </remarks> protected override void ReadStart(long start, ReadStyle propertiesStyle) { // Only check the first 16 bytes so we're not stuck // reading a bad file forever. if (propertiesStyle != ReadStyle.None && !AudioHeader.Find(out first_header, this, start, 0x4000)) { throw new CorruptFileException( "MPEG audio header not found."); } }