AudioStreamInfo¶
The AudioStreamInfo class describes an elementary audio stream.
The media type is always MediaType.Audio and cannot be changed.
Class¶
- class avblocks.AudioStreamInfo¶
Bases:
StreamInfoDescribes an elementary audio stream.
The media type is always MediaType.Audio and cannot be changed.
- property bits_per_sample: int¶
The number of valid bits per sample (sample resolution).
Common values are 8, 16, 20, 24 and 32.
Normally BitsPerSample is defined only for uncompressed audio streams. For compressed audio it is not defined and is 0. However it is possible for a compressed audio stream to return a positive value as an indication of audio quality. It can also designate the bits per sample of the LPCM stream once the compressed stream is decoded.
- property bytes_per_frame: int¶
The number of bytes occupied by an audio frame (smallest discrete unit).
A frame is the smallest discrete unit in an audio stream. It may contain one or more samples. Depending on the audio stream type the frame may contain fixed or variable number of samples.
For compressed streams the frame size is variable even if there are fixed number of samples in each frame. In this case BytesPerFrame is 0.
For an LPCM stream the frame size is constant. In this case BytesPerFrame is greater than 0. Normally for interleaved LPCM streams the following is true: - BytesPerFrame / ChannelCount == SampleSize - The valid bits in a sample are given by BitsPerSample and they are
aligned towards the hi-order byte.
- property channel_layout: AudioChannelFlags¶
The channel layout defines the mapping between channels and speakers.
- property channels: int¶
The number of audio channels in the stream.
- clone() AudioStreamInfo¶
Creates a deep copy of this object.
- Returns:
A new AudioStreamInfo object
- property pcm_flags: PcmFlags¶
Various properties of the audio stream.
- reset()¶
Resets the audio stream information to its default state.
- property sample_rate: int¶
The audio sample rate in Hz.