Show / Hide Table of Contents

Class AudioBufferSource

Represents an audio buffer source filter that supplies audio frames to a filter graph.

Inheritance
object
OptionQueryableBase
FilterContext
AudioBufferSource
Implements
IOptionQueryable
ILoggingContext
IAVPointer<_AVFilterContext>
IBufferSink
IBufferSource
Inherited Members
FilterContext.Allocate(string, Filter, FilterGraph)
FilterContext.Create(string, Filter, FilterGraph)
FilterContext.Create(string, Filter, string, FilterGraph)
FilterContext.Create(string, Filter, AVDictionary, FilterGraph)
FilterContext.Create(string, Filter, IDictionary<string, string>, FilterGraph)
FilterContext.Create(string, Filter, AVMultiDictionary, FilterGraph)
FilterContext.As<T>()
FilterContext.Init(string)
FilterContext.Init()
FilterContext.Init(AVDictionary)
FilterContext.Init(AVMultiDictionary)
FilterContext.Init(IDictionary<string, string>)
FilterContext.GetInputFilterPad(int)
FilterContext.GetOutputFilterPad(int)
FilterContext.GetInputFilterLink(int)
FilterContext.GetOutputFilterLink(int)
FilterContext.Delete()
FilterContext.Pointer
FilterContext.Filter
FilterContext.Name
FilterContext.Threads
FilterContext.HwDeviceContext
FilterContext.ExtraHWFrames
FilterContext.InputCount
FilterContext.OutputCount
FilterContext.InputFilterPads
FilterContext.OutputFilterPads
FilterContext.InputFilterLinks
FilterContext.OutputFilterLinks
OptionQueryableBase.ResetOptions()
OptionQueryableBase.GetOptions(bool)
OptionQueryableBase.FindOption(string, bool)
OptionQueryableBase.SetOption(string, string, bool)
OptionQueryableBase.SetOption(string, long, bool)
OptionQueryableBase.SetOption(string, bool, bool)
OptionQueryableBase.SetOption(string, double, bool)
OptionQueryableBase.SetOption(string, Rational, bool)
OptionQueryableBase.SetOption(string, ReadOnlySpan<byte>, bool)
OptionQueryableBase.SetOption(string, ReadOnlyMemory<byte>, bool)
OptionQueryableBase.SetOption(string, int, int, bool)
OptionQueryableBase.SetOption(string, (int Width, int Height), bool)
OptionQueryableBase.SetOption(string, PixelFormat, bool)
OptionQueryableBase.SetOption(string, SampleFormat, bool)
OptionQueryableBase.SetOption(string, IDictionary<string, string>, bool)
OptionQueryableBase.SetOption(string, ILookup<string, string>, bool)
OptionQueryableBase.SetOption(IDictionary<string, string>, bool)
OptionQueryableBase.SetOption(string, ref ILookup<string, string>, bool)
OptionQueryableBase.SetOption<T>(string, T, bool)
OptionQueryableBase.SetOption(string, object, bool)
OptionQueryableBase.SetOption(Option, string, bool)
OptionQueryableBase.SetOption(Option, bool, bool)
OptionQueryableBase.SetOption(Option, long, bool)
OptionQueryableBase.SetOption(Option, double, bool)
OptionQueryableBase.SetOption(Option, Rational, bool)
OptionQueryableBase.SetOption(Option, ReadOnlySpan<byte>, bool)
OptionQueryableBase.SetOption(Option, ReadOnlyMemory<byte>, bool)
OptionQueryableBase.SetOption(Option, int, int, bool)
OptionQueryableBase.SetOption(Option, (int Width, int Height), bool)
OptionQueryableBase.SetOption(Option, PixelFormat, bool)
OptionQueryableBase.SetOption(Option, SampleFormat, bool)
OptionQueryableBase.SetOption(Option, IDictionary<string, string>, bool)
OptionQueryableBase.SetOption(Option, ILookup<string, string>, bool)
OptionQueryableBase.SetOption<T>(Option, T, bool)
OptionQueryableBase.SetOption(Option, object, bool)
OptionQueryableBase.TryGetOption(string, out string, bool)
OptionQueryableBase.TryGetOption(string, out long, bool)
OptionQueryableBase.TryGetOption<T>(string, out T, bool)
OptionQueryableBase.TryGetOption(string, out ulong, bool)
OptionQueryableBase.TryGetOption(string, out int, bool)
OptionQueryableBase.TryGetOption(string, out bool, bool)
OptionQueryableBase.TryGetOption(string, out uint, bool)
OptionQueryableBase.TryGetOption(string, out double, bool)
OptionQueryableBase.TryGetOption(string, out Rational, bool)
OptionQueryableBase.TryGetOption(string, out PixelFormat, bool)
OptionQueryableBase.TryGetOption(string, out SampleFormat, bool)
OptionQueryableBase.TryGetOption(string, out IDictionary<string, string>, bool)
OptionQueryableBase.TryGetOption(string, out Dictionary<string, string>, bool)
OptionQueryableBase.TryGetOption(string, out AVDictionary, bool)
OptionQueryableBase.TryGetOption(string, out ILookup<string, string>, bool)
OptionQueryableBase.TryGetOption(string, out AVMultiDictionary, bool)
OptionQueryableBase.TryGetOption(string, out int, out int, bool)
OptionQueryableBase.TryGetOption(string, out (int Width, int Height), bool)
OptionQueryableBase.TryGetOption(string, Span<byte>, bool)
OptionQueryableBase.TryGetOption(string, out byte[], bool)
OptionQueryableBase.TryGetOption(string, out Memory<byte>, bool)
OptionQueryableBase.TryGetOption(string, out ReadOnlyMemory<byte>, bool)
OptionQueryableBase.TryGetOption(string, out object, bool)
OptionQueryableBase.TryGetOption(Option, out string, bool)
OptionQueryableBase.TryGetOption(Option, out long, bool)
OptionQueryableBase.TryGetOption<T>(Option, out T, bool)
OptionQueryableBase.TryGetOption(Option, out ulong, bool)
OptionQueryableBase.TryGetOption(Option, out int, bool)
OptionQueryableBase.TryGetOption(Option, out bool, bool)
OptionQueryableBase.TryGetOption(Option, out uint, bool)
OptionQueryableBase.TryGetOption(Option, out double, bool)
OptionQueryableBase.TryGetOption(Option, out Rational, bool)
OptionQueryableBase.TryGetOption(Option, out PixelFormat, bool)
OptionQueryableBase.TryGetOption(Option, out SampleFormat, bool)
OptionQueryableBase.TryGetOption(Option, out IDictionary<string, string>, bool)
OptionQueryableBase.TryGetOption(Option, out Dictionary<string, string>, bool)
OptionQueryableBase.TryGetOption(Option, out AVDictionary, bool)
OptionQueryableBase.TryGetOption(Option, out ILookup<string, string>, bool)
OptionQueryableBase.TryGetOption(Option, out AVMultiDictionary, bool)
OptionQueryableBase.TryGetOption(Option, out int, out int, bool)
OptionQueryableBase.TryGetOption(Option, out (int Width, int Height), bool)
OptionQueryableBase.TryGetOption(Option, out byte[], bool)
OptionQueryableBase.TryGetOption(Option, out Memory<byte>, bool)
OptionQueryableBase.TryGetOption(Option, out ReadOnlyMemory<byte>, bool)
OptionQueryableBase.TryGetOption(Option, Span<byte>, bool)
OptionQueryableBase.TryGetOption(Option, out object, bool)
OptionQueryableBase.SetOption(string, ChannelLayout, bool)
OptionQueryableBase.SetOption(Option, ChannelLayout, bool)
OptionQueryableBase.TryGetOption(string, out ChannelLayout, bool)
OptionQueryableBase.TryGetOption(Option, out ChannelLayout, bool)
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: FFmpeg.Filters.AudioFilters
Assembly: FFmpeg.dll
Syntax
public class AudioBufferSource : FilterContext, IOptionQueryable, ILoggingContext, IAVPointer<_AVFilterContext>, IBufferSink, IBufferSource
Remarks

An AudioBufferSource is the entry point for audio frames into a filter graph. The source can be configured using explicit audio parameters, BufferSrcParameters, a CodecContext, or an AVStream.

Properties

View Source

ChannelLayout

Gets or sets the channel layout of the audio source.

Declaration
public ChannelLayout? ChannelLayout { get; set; }
Property Value
Type Description
ChannelLayout

The channel layout of the source.

View Source

Channels

Gets or sets the number of audio channels of the source.

Declaration
public int Channels { get; set; }
Property Value
Type Description
int

The number of audio channels, or 0 if the option could not be read.

View Source

SampleFormat

Gets or sets the sample format of the audio source.

Declaration
public SampleFormat SampleFormat { get; set; }
Property Value
Type Description
SampleFormat

The sample format, or None if the option could not be read.

View Source

SampleRate

Gets or sets the sample rate of the audio source.

Declaration
public int SampleRate { get; set; }
Property Value
Type Description
int

The sample rate in samples per second, or 0 if the option could not be read.

View Source

TimeBase

Gets or sets the time base of the audio source.

Declaration
public Rational TimeBase { get; set; }
Property Value
Type Description
Rational

The time base used for timestamps of audio frames submitted to the source, or NaN if the option could not be read.

Methods

View Source

Allocate(string, FilterGraph)

Allocates an uninitialized audio buffer source filter.

Declaration
public static AudioBufferSource 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
AudioBufferSource

The allocated, uninitialized audio buffer source filter.

Exceptions
Type Condition
FFmpegException

The filter could not be allocated.

View Source

Create(string, CodecContext, FilterGraph)

Creates and initializes an audio buffer source filter using the settings from a codec context.

Declaration
public static AudioBufferSource Create(string name, CodecContext ctx, FilterGraph graph)
Parameters
Type Name Description
string name

The name of the filter instance.

CodecContext ctx

The codec context whose audio parameters are used to configure the filter.

FilterGraph graph

The filter graph that will own the filter.

Returns
Type Description
AudioBufferSource

The initialized audio buffer source filter.

Exceptions
Type Condition
ArgumentException

ctx does not describe an audio codec.

FFmpegException

The filter could not be allocated, configured, or initialized.

View Source

Create(string, BufferSrcParameters, FilterGraph)

Creates and initializes an audio buffer source filter using the specified buffer source parameters.

Declaration
public static AudioBufferSource Create(string name, BufferSrcParameters parameters, FilterGraph graph)
Parameters
Type Name Description
string name

The name of the filter instance.

BufferSrcParameters parameters

The parameters used to configure the audio buffer source.

FilterGraph graph

The filter graph that will own the filter.

Returns
Type Description
AudioBufferSource

The initialized audio buffer source filter.

Exceptions
Type Condition
ArgumentException

parameters does not contain a valid audio sample rate.

FFmpegException

The filter could not be configured or initialized.

View Source

Create(string, AVStream, FilterGraph)

Creates and initializes an audio buffer source filter using the settings from an audio stream.

Declaration
public static AudioBufferSource Create(string name, AVStream stream, FilterGraph graph)
Parameters
Type Name Description
string name

The name of the filter instance.

AVStream stream

The audio stream whose parameters are used to configure the filter.

FilterGraph graph

The filter graph that will own the filter.

Returns
Type Description
AudioBufferSource

The initialized audio buffer source filter.

Exceptions
Type Condition
ArgumentException

stream does not describe an audio stream.

FFmpegException

The filter could not be allocated, configured, or initialized.

View Source

Create(string, int, SampleFormat, ChannelLayout, FilterGraph)

Creates and initializes an audio buffer source filter using the specified audio format and channel layout.

Declaration
public static AudioBufferSource Create(string name, int sampleRate, SampleFormat sampleFormat, ChannelLayout channelLayout, FilterGraph graph)
Parameters
Type Name Description
string name

The name of the filter instance.

int sampleRate

The sample rate, in samples per second.

SampleFormat sampleFormat

The sample format.

ChannelLayout channelLayout

The channel layout of the audio stream.

FilterGraph graph

The filter graph that will own the filter.

Returns
Type Description
AudioBufferSource

The initialized audio buffer source filter.

Exceptions
Type Condition
ArgumentOutOfRangeException

sampleRate is less than or equal to zero.

FFmpegException

The filter could not be configured or initialized.

View Source

Create(string, int, SampleFormat, int, FilterGraph)

Creates and initializes an audio buffer source filter using the specified audio format.

Declaration
public static AudioBufferSource Create(string name, int sampleRate, SampleFormat sampleFormat, int channels, FilterGraph graph)
Parameters
Type Name Description
string name

The name of the filter instance.

int sampleRate

The sample rate, in samples per second.

SampleFormat sampleFormat

The sample format.

int channels

The number of audio channels.

FilterGraph graph

The filter graph that will own the filter.

Returns
Type Description
AudioBufferSource

The initialized audio buffer source filter.

Exceptions
Type Condition
ArgumentOutOfRangeException

sampleRate or channels is less than or equal to zero.

FFmpegException

The filter could not be configured or initialized.

View Source

Drain()

Signals end-of-stream to the audio buffer source filter.

Declaration
public AVResult32 Drain()
Returns
Type Description
AVResult32

The result returned by FFmpeg.

Remarks

After end-of-stream has been signaled, no further frames can be submitted to the source filter.

View Source

SendFrame(AVFrame?, bool)

Sends an audio frame to the buffer source filter.

Declaration
public AVResult32 SendFrame(AVFrame? frame, bool keepRef = false)
Parameters
Type Name Description
AVFrame frame

The audio frame to send, or null to signal end-of-stream.

bool keepRef

true to retain a reference to the supplied frame; false to allow FFmpeg to take ownership of the frame when possible.

Returns
Type Description
AVResult32

The result returned by FFmpeg.

Remarks

When keepRef is true, FFmpeg creates a new reference to the supplied frame. When it is false, ownership of the frame may be transferred to the filter.

View Source

SetBufferSourceParameters(BufferSrcParameters)

Sets the parameters of the audio buffer source filter.

Declaration
public AVResult32 SetBufferSourceParameters(BufferSrcParameters parameters)
Parameters
Type Name Description
BufferSrcParameters parameters

The buffer source parameters to apply.

Returns
Type Description
AVResult32

The result returned by FFmpeg.

Remarks

This method must be called before the filter is initialized.

View Source

ToString()

Returns a string representation of the audio format.

Declaration
public override string ToString()
Returns
Type Description
string

A string containing the sample rate, channel count, and sample format.

Overrides
FilterContext.ToString()

Implements

IOptionQueryable
ILoggingContext
IAVPointer<T>
IBufferSink
IBufferSource

Extension Methods

LoggingContextExtensions.Debug(ILoggingContext, string)
LoggingContextExtensions.Error(ILoggingContext, string)
LoggingContextExtensions.Fatal(ILoggingContext, string)
LoggingContextExtensions.Info(ILoggingContext, string)
LoggingContextExtensions.Log(ILoggingContext, LogLevel, string)
LoggingContextExtensions.Panic(ILoggingContext, string)
LoggingContextExtensions.Trace(ILoggingContext, string)
LoggingContextExtensions.Verbose(ILoggingContext, string)
LoggingContextExtensions.Warning(ILoggingContext, string)
  • View Source
In this article
Back to top Generated by DocFX