//private void Read(OggVorbisFile file, ReadStyle style)
		private void Read(OggVorbisFile file)
		{
			// Get the identification header from the Ogg implementation.

			ByteVector data = file.GetPacket(0);

			int pos = 0;

			if (data.Mid(pos, 7) != vorbisCommentHeaderId)
			{
				TagLibDebugger.Debug("Vorbis.Properties.Read() -- invalid Vorbis identification header");
				return;
			}

			pos += 7;

			vorbisVersion = (int)data.Mid(pos, 4).ToUInt(false);
			pos += 4;

			channels = data[pos];
			pos += 1;

			sampleRate = (int)data.Mid(pos, 4).ToUInt(false);
			pos += 4;

			bitrateMaximum = (int)data.Mid(pos, 4).ToUInt(false);
			pos += 4;

			bitrateNominal = (int)data.Mid(pos, 4).ToUInt(false);
			pos += 4;

			bitrateMinimum = (int)data.Mid(pos, 4).ToUInt(false);

			// TODO: Later this should be only the "fast" mode.
			bitrate = bitrateNominal;

			// Find the length of the file.  See http://wiki.xiph.org/VorbisStreamLength/
			// for my notes on the topic.

			OggPageHeader first = file.FirstPageHeader;
			OggPageHeader last = file.LastPageHeader;

			if (first != null && last != null)
			{
				long start = first.AbsoluteGranularPosition;
				long end = last.AbsoluteGranularPosition;

				if (start >= 0 && end >= 0 && sampleRate > 0)
					duration = TimeSpan.FromSeconds(((double)(end - start) / (double)sampleRate));
				else
					TagLibDebugger.Debug("Vorbis.Properties.Read() -- Either the PCM " +
									"values for the start or end of this file was " +
									"incorrect or the sample rate is zero.");
			}
			else
				TagLibDebugger.Debug("Vorbis.Properties.Read() -- Could not find valid first and last Ogg pages.");
		}
        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
        }
		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
		}
        //private void Read(OggVorbisFile file, ReadStyle style)
        private void Read(OggVorbisFile file)
        {
            // Get the identification header from the Ogg implementation.

            ByteVector data = file.GetPacket(0);

            int pos = 0;

            if (data.Mid(pos, 7) != vorbisCommentHeaderId)
            {
                TagLibDebugger.Debug("Vorbis.Properties.Read() -- invalid Vorbis identification header");
                return;
            }

            pos += 7;

            vorbisVersion = (int)data.Mid(pos, 4).ToUInt(false);
            pos          += 4;

            channels = data[pos];
            pos     += 1;

            sampleRate = (int)data.Mid(pos, 4).ToUInt(false);
            pos       += 4;

            bitrateMaximum = (int)data.Mid(pos, 4).ToUInt(false);
            pos           += 4;

            bitrateNominal = (int)data.Mid(pos, 4).ToUInt(false);
            pos           += 4;

            bitrateMinimum = (int)data.Mid(pos, 4).ToUInt(false);

            // TODO: Later this should be only the "fast" mode.
            bitrate = bitrateNominal;

            // Find the length of the file.  See http://wiki.xiph.org/VorbisStreamLength/
            // for my notes on the topic.

            OggPageHeader first = file.FirstPageHeader;
            OggPageHeader last  = file.LastPageHeader;

            if (first != null && last != null)
            {
                long start = first.AbsoluteGranularPosition;
                long end   = last.AbsoluteGranularPosition;

                if (start >= 0 && end >= 0 && sampleRate > 0)
                {
                    duration = TimeSpan.FromSeconds(((double)(end - start) / (double)sampleRate));
                }
                else
                {
                    TagLibDebugger.Debug("Vorbis.Properties.Read() -- Either the PCM " +
                                         "values for the start or end of this file was " +
                                         "incorrect or the sample rate is zero.");
                }
            }
            else
            {
                TagLibDebugger.Debug("Vorbis.Properties.Read() -- Could not find valid first and last Ogg pages.");
            }
        }
 public OggVorbisProperties(OggVorbisFile file) : this(file, ReadStyle.Average)
 {
 }
		public OggVorbisProperties(OggVorbisFile file) : this(file, ReadStyle.Average)
		{
		}