Class AudioStreamInfo
- Namespace
- VisioForge.Core.Types.MediaInfo
- Assembly
- VisioForge.Core.dll
Represents detailed information about an audio stream within a media file. This class provides properties such as bitrate, channels, sample rate, codec, and duration.
public class AudioStreamInfoInheritance
Inherited Members
Examples
// Assume mediaInfo is an instance of MediaFileInfo containing stream information.
foreach (var audioStream in mediaInfo.AudioStreams)
{
Console.WriteLine($"Audio Stream Found:");
Console.WriteLine($" Codec: {audioStream.Codec} ({audioStream.CodecInfo})");
Console.WriteLine($" Channels: {audioStream.Channels}");
Console.WriteLine($" Sample Rate: {audioStream.SampleRate} Hz");
Console.WriteLine($" Bitrate: {audioStream.Bitrate} bps");
Console.WriteLine($" Duration: {audioStream.Duration}");
Console.WriteLine($" Language: {audioStream.Language}");
if (audioStream.Tags != null && audioStream.Tags.Any())
{
Console.WriteLine(" Tags:");
foreach (var tag in audioStream.Tags)
{
Console.WriteLine($" {tag.Name}: {tag.Value}");
}
}
}
Remarks
This information is typically retrieved by a media information parser and is useful for displaying stream properties to the user, or for making decisions about audio processing and playback. The class provides both basic audio characteristics (channels, sample rate) and advanced metadata (codec info, language, tags). Bitrate is provided in bits per second and helps determine file size and quality. The Channels property indicates audio configuration: 1=mono, 2=stereo, 6=5.1 surround, 8=7.1 surround, etc. ChannelMask provides detailed speaker position information for multi-channel audio. SampleRate is measured in Hz with common values being 44100 (CD quality), 48000 (DVD/professional), or 96000 (high-resolution audio). The Tags collection contains stream-specific metadata that may differ from file-level tags. This information is essential for audio format validation, stream selection in multi-audio files, and transcoding decisions.
Constructors
AudioStreamInfo()
Initializes a new instance of the VisioForge.Core.Types.MediaInfo.AudioStreamInfo class. All string properties are initialized to Empty, VisioForge.Core.Types.MediaInfo.AudioStreamInfo.Duration to Zero, and VisioForge.Core.Types.MediaInfo.AudioStreamInfo.Tags as an empty list.
public AudioStreamInfo()Properties
BPS
Gets or sets the bits per sample (bit depth) of the audio data.
public byte BPS { get; set; }Property Value
Bitrate
Gets or sets the average bitrate of the audio stream in bits per second (bps).
public int Bitrate { get; set; }Property Value
ChannelMask
Gets or sets the channel mask, indicating the speaker positions for multi-channel audio.
public ulong ChannelMask { get; set; }Property Value
Channels
Gets or sets the number of audio channels (e.g., 1 for mono, 2 for stereo, 6 for 5.1 surround).
public byte Channels { get; set; }Property Value
Codec
Gets or sets the name of the audio codec (e.g., "AAC", "MP3", "AC3").
public string Codec { get; set; }Property Value
CodecInfo
Gets or sets additional information about the audio codec, such as profile or specific encoder details.
public string CodecInfo { get; set; }Property Value
Duration
Gets or sets the duration of the audio stream.
public TimeSpan Duration { get; set; }Property Value
ID
Gets or sets a unique identifier for the audio stream within the media file.
public string ID { get; set; }Property Value
Language
Gets or sets the language of the audio stream, typically represented by a two-letter ISO 639-1 code (e.g., "en", "fr").
public string Language { get; set; }Property Value
Name
Gets or sets the name of the audio track, if available (e.g., "Director's Commentary").
public string Name { get; set; }Property Value
SampleRate
Gets or sets the sample rate of the audio stream in Hertz (Hz). Common values include 44100 Hz (CD quality) or 48000 Hz.
public int SampleRate { get; set; }Property Value
Tags
Gets a list of VisioForge.Core.Types.MediaInfo.MediaInfoTag objects associated with this audio stream. These tags can include metadata like title, artist, album, etc.
public List<MediaInfoTag> Tags { get; }Property Value
Methods
ToString()
Returns a string that represents the current VisioForge.Core.Types.MediaInfo.AudioStreamInfo instance. The string includes the codec, number of channels, sample rate, and duration.
public override string ToString()