Class AudioBufferSink
Represents an audio buffer sink filter that receives audio frames from a filter graph.
Inherited Members
Namespace: FFmpeg.Filters.AudioFilters
Assembly: FFmpeg.dll
Syntax
public class AudioBufferSink : FilterContext, IOptionQueryable, ILoggingContext, IAVPointer<_AVFilterContext>, IBufferSource, IBufferSink
Remarks
An AudioBufferSink is the exit point for audio frames from a filter graph. Frames can be retrieved using ReceiveFrame(AVFrame) after the filter graph has been configured and initialized.
Properties
View SourceChannels
Gets the number of channels in audio frames produced by the buffer sink filter.
Declaration
public int Channels { get; }
Property Value
| Type | Description |
|---|---|
| int | The number of audio channels in the frames received from the sink. |
SampleFormat
Gets the sample format of audio frames produced by the buffer sink filter.
Declaration
public SampleFormat SampleFormat { get; }
Property Value
| Type | Description |
|---|---|
| SampleFormat | The sample format of the frames received from the sink. |
SampleRate
Gets the sample rate of audio frames produced by the buffer sink filter.
Declaration
public int SampleRate { get; }
Property Value
| Type | Description |
|---|---|
| int | The sample rate of the frames received from the sink, in samples per second. |
TimeBase
Gets the time base of frames produced by the audio buffer sink filter.
Declaration
public Rational TimeBase { get; }
Property Value
| Type | Description |
|---|---|
| Rational | The time base used for timestamps of frames received from the sink. |
Methods
View SourceAllocate(string, FilterGraph)
Allocates an uninitialized audio buffer sink filter.
Declaration
public static AudioBufferSink Allocate(string name, FilterGraph graph)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the filter instance. |
| FilterGraph | graph | The filter graph that will own the filter. |
Returns
| Type | Description |
|---|---|
| AudioBufferSink | The allocated, uninitialized audio buffer sink filter. |
Exceptions
| Type | Condition |
|---|---|
| FFmpegException | The filter could not be allocated. |
Create(string, FilterGraph)
Creates and initializes an audio buffer sink filter.
Declaration
public static AudioBufferSink Create(string name, FilterGraph graph)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the filter instance. |
| FilterGraph | graph | The filter graph that will own the filter. |
Returns
| Type | Description |
|---|---|
| AudioBufferSink | The initialized audio buffer sink filter. |
Exceptions
| Type | Condition |
|---|---|
| FFmpegException | The filter could not be allocated or initialized. |
ReceiveFrame(AVFrame)
Receives the next available audio frame from the buffer sink filter.
Declaration
public AVResult32 ReceiveFrame(AVFrame frame)
Parameters
| Type | Name | Description |
|---|---|---|
| AVFrame | frame | The destination frame that receives the filtered audio data. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by FFmpeg. |
Remarks
The supplied frame is unreferenced before receiving the new frame. The frame's TimeBase is updated to the sink's time base and its BestEffortTimestamp is set to its presentation timestamp.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
TryGetChannelLayout(out ChannelLayout?)
Attempts to retrieve the channel layout of audio frames produced by the buffer sink filter.
Declaration
public bool TryGetChannelLayout(out ChannelLayout? layout)
Parameters
| Type | Name | Description |
|---|---|---|
| ChannelLayout | layout | When this method returns true, contains the channel layout; otherwise, null. |
Returns
| Type | Description |
|---|---|
| bool | true if the channel layout was successfully retrieved; otherwise, false. |