/**************************************************************************** * NVorbis * * Copyright (C) 2014, Andrew Ward * * * * See COPYING for license terms (Ms-PL). * * * ***************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NVorbis { /// /// Provides packets on-demand for the Vorbis stream decoder. /// public interface IPacketProvider : IDisposable { /// /// Gets the serial number associated with this stream. /// int StreamSerial { get; } /// /// Gets whether seeking is supported on this stream. /// bool CanSeek { get; } /// /// Gets the number of bits of overhead in this stream's container. /// long ContainerBits { get; } /// /// Retrieves the total number of pages (or frames) this stream uses. /// /// The page count. /// is False. int GetTotalPageCount(); /// /// Retrieves the next packet in the stream. /// /// The next packet in the stream or null if no more packets. DataPacket GetNextPacket(); /// /// Retrieves the next packet in the stream but does not advance to the following packet. /// /// The next packet in the stream or null if no more packets. DataPacket PeekNextPacket(); /// /// Retrieves the packet specified from the stream. /// /// The index of the packet to retrieve. /// The specified packet. /// is less than 0 or past the end of the stream. /// is False. DataPacket GetPacket(int packetIndex); /// /// Retrieves the total number of granules in this Vorbis stream. /// /// The number of samples /// is False. long GetGranuleCount(); /// /// Finds the packet index to the granule position specified in the current stream. /// /// The granule position to seek to. /// A callback method that takes the current and previous packets and returns the number of granules in the current packet. /// The index of the packet that includes the specified granule position or -1 if none found. /// is less than 0 or is after the last granule. DataPacket FindPacket(long granulePos, Func packetGranuleCountCallback); /// /// Sets the next packet to be returned, applying a pre-roll as necessary. /// /// The packet to key from. /// The number of packets to return before the indicated packet. void SeekToPacket(DataPacket packet, int preRoll); /// /// Occurs when the stream is about to change parameters. /// event EventHandler ParameterChange; } }