Edit

Share via


AudioFileStream Class

Definition

Process partial audio files.

public class AudioFileStream : IDisposable
type AudioFileStream = class
    interface IDisposable
Inheritance
AudioFileStream
Implements

Remarks

You use AudioFileStream when you want to decode audio content that does not live in an local file or if you want to decode it in chunks. New data is fed into the AudioFileStream using one of the ParseBytes method and decoded audio is provided on the PacketDecoded event (or the OnPacketDecoded virtual method) and information about the stream is raised on the PropertyFound event (or the OnPropertyFound virtual method).

This can be used to parse audio files when you are streaming audio from the network for example.

The methods and properties in this class update the LastError property to track any potential errors during parsing, but without throwing an exception.

Constructors

AudioFileStream(AudioFileType)

Creates a new instance of this object.

Fields

PacketDecoded

This event is raised when a packet has been decoded.

PropertyFound

This event is raised when a property has been found on the decoded data.

Properties

AverageBytesPerPacket

Average bytes per packet. This value is precise for audio files with constant bit rates or audio files that have a packet index, otherwise it is a computed average.

BitRate

The stream's bit rate in bits per second.

ChannelLayout

The channel layout for the audio stream.

DataByteCount

For streams whose length is known, the number of audio byte data.

DataFormat

Format of the data (as an AudioStreamBasicDescription

DataOffset

Offset of the audio date from the beginning of the audio file stream.

DataPacketCount

The number of audio packets on the audio file stream.

FileType

The audio file type for the audio stream.

FormatList

List of formats supported by the audio stream.

LastError

Contains the latest error code set by one of the methods in AudioFileStream.

MagicCookie

The magic cookie for this file.

MaximumPacketSize

Maximum packet size for data on the audio file stream

PacketSizeUpperBound

The largest possible packet size.

PacketTableInfo

Contains information about the valid frames in the audio file stream (their start and end).

ReadyToProducePackets

Set to true once the file stream parser has read enough of the headers to be able to produce audio packets.

StreamBasicDescription

Format of the data

Methods

ByteToPacket(Int64, Int32, Boolean)

Maps a position in the file to an audio packet.

Close()

Closes (and disposes the audio stream).

Dispose()

Releases the resources used by the AudioFileStream object.

Dispose(Boolean)

Releases the resources used by the AudioFileStream object.

Finalize()

Finalizer for the AudioFileStream object

FrameToPacket(Int64, Int32)

Returns the packet number and the frame offset in the packet (on the out parameter) corresponding to the requested audio frame.

GetProperty(AudioFileStreamProperty, Int32)

Low-level routine used to fetch arbitrary property values from the underlying AudioFileStream object.

GetProperty(AudioFileStreamProperty, Int32, IntPtr)

Low-level routine used to fetch arbitrary property values from the underlying AudioFileStream object.

OnPacketDecoded(Int32, IntPtr, AudioStreamPacketDescription[])

Invoked when a packet has been decoded.

OnPropertyFound(AudioFileStreamProperty, AudioFileStreamPropertyFlag)

Invoked when a propety is found.

PacketToByte(Int64, Boolean)

Maps a packet number to a byte number in the audio file stream.

PacketToFrame(Int64)

Maps a packet number to an audio frame number in the audio file stream.

ParseBytes(Byte[], Boolean)

Parse and decode the array of bytes provided.

ParseBytes(Byte[], Int32, Int32, Boolean)

Parses and decode a portion of the array of bytes provided.

ParseBytes(Int32, IntPtr, Boolean)

Parse and decode the block of data provided.

Seek(Int64, Int64, Boolean)

Maps the absolute file offset for the specified packetOffset.

SetProperty(AudioFileStreamProperty, Int32, IntPtr)

Low-level property setting API. Use the exposed managed properties instead.

Applies to

See also