Show / Hide Table of Contents

Class OptionQueryableBase

An abstract base class for querying and setting options in AV-option-enabled classes.

Inheritance
object
OptionQueryableBase
SwrContext
CodecContext
FilterContext
AVStream
FormatContext
SwsContext
Implements
IOptionQueryable
ILoggingContext
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: FFmpeg.Options
Assembly: FFmpeg.dll
Syntax
public abstract class OptionQueryableBase : IOptionQueryable, ILoggingContext
Remarks

This class provides methods for retrieving and modifying various options on AV-option-enabled classes, facilitating interaction with their private data through the "av_opt_*" functions.

Constructors

View Source

OptionQueryableBase()

Declaration
protected OptionQueryableBase()

Properties

View Source

Pointer

Abstract base class that provides access to a pointer for AVOptions retrieval.

Declaration
protected abstract void* Pointer { get; }
Property Value
Type Description
void*

Methods

View Source

FindOption(string, bool)

Finds and returns an AVOption by name, optionally searching recursively through child objects.

Declaration
public Option? FindOption(string name, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to find.

bool recursive

Specifies whether to search recursively through child objects.

Returns
Type Description
Option

The found Option, or null if not found.

View Source

GetOptions(bool)

Retrieves a list of available AVOptions, optionally including those from child objects recursively.

Declaration
public IReadOnlyList<Option> GetOptions(bool recursive = true)
Parameters
Type Name Description
bool recursive

Specifies whether to include options from child objects recursively.

Returns
Type Description
IReadOnlyList<Option>

A read-only list of Option objects.

View Source

ResetOptions()

Reset all options to their default value.

Declaration
public void ResetOptions()
View Source

SetOption(Option, ChannelLayout, bool)

Sets the value of the specified Option to the given ChannelLayout.

Declaration
public AVResult32 SetOption(Option option, ChannelLayout layout, bool recursive = true)
Parameters
Type Name Description
Option option

The Option to set.

ChannelLayout layout

The ChannelLayout value to assign to the option.

bool recursive

Specifies whether the search for the option should be recursive in child options. If true, the method will search child options recursively.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

SetOption(Option, SampleFormat, bool)

Sets an option using an Option and a sample format.

Declaration
public AVResult32 SetOption(Option option, SampleFormat value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

SampleFormat value

The sample format to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, PixelFormat, bool)

Sets an option using an Option and a pixel format.

Declaration
public AVResult32 SetOption(Option option, PixelFormat value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

PixelFormat value

The pixel format to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, Rational, bool)

Sets an option using an Option and a Rational value.

Declaration
public AVResult32 SetOption(Option option, Rational value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

Rational value

The Rational value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, bool, bool)

Sets an option using an Option and a boolean value.

Declaration
public AVResult32 SetOption(Option option, bool value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

bool value

The boolean value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, IDictionary<string, string>, bool)

Sets an option using an Option and a dictionary of key-value pairs.

Declaration
public AVResult32 SetOption(Option option, IDictionary<string, string> values, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

IDictionary<string, string> values

The dictionary of key-value pairs to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, double, bool)

Sets an option using an Option and a double value.

Declaration
public AVResult32 SetOption(Option option, double value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

double value

The double value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, int, int, bool)

Sets an option using an Option and image dimensions (width and height).

Declaration
public AVResult32 SetOption(Option option, int width, int height, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

int width

The width value to set.

int height

The height value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, long, bool)

Sets an option using an Option and a long value.

Declaration
public AVResult32 SetOption(Option option, long value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

long value

The long value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, ILookup<string, string>, bool)

Sets an option using an Option and a lookup collection of key-value pairs.

Declaration
public AVResult32 SetOption(Option option, ILookup<string, string> values, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

ILookup<string, string> values

The lookup collection of key-value pairs to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, object, bool)

Sets an option using an Option and a generic object value.

Declaration
public AVResult32 SetOption(Option option, object value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

object value

The object value to set (can be string, long, double, etc.).

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, ReadOnlyMemory<byte>, bool)

Sets an option using an Option and a memory of bytes.

Declaration
public AVResult32 SetOption(Option option, ReadOnlyMemory<byte> value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

ReadOnlyMemory<byte> value

The memory of bytes to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, ReadOnlySpan<byte>, bool)

Sets an option using an Option and a span of bytes.

Declaration
public AVResult32 SetOption(Option option, ReadOnlySpan<byte> value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

ReadOnlySpan<byte> value

The span of bytes to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, string, bool)

Sets an option using an Option and a string value.

Declaration
public AVResult32 SetOption(Option option, string value, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

string value

The string value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(Option, (int Width, int Height), bool)

Sets an option using an Option and a tuple representing image size.

Declaration
public AVResult32 SetOption(Option option, (int Width, int Height) size, bool recursive = true)
Parameters
Type Name Description
Option option

The AVOption to set.

(int Width, int Height) size

The tuple containing width and height values.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(IDictionary<string, string>, bool)

Sets multiple options using a dictionary of key-value pairs.

Declaration
public AVResult32 SetOption(IDictionary<string, string> values, bool recursive = true)
Parameters
Type Name Description
IDictionary<string, string> values

The dictionary of key-value pairs to set as options.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, ChannelLayout, bool)

Sets the value of an option specified by name to the given ChannelLayout.

Declaration
public AVResult32 SetOption(string name, ChannelLayout layout, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to set.

ChannelLayout layout

The ChannelLayout value to assign to the option.

bool recursive

Specifies whether the search for the option should be recursive in child options. If true, the method will search child options recursively.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful.
  • InvalidArgument if the option type or the arguments are invalid.
View Source

SetOption(string, SampleFormat, bool)

Sets an option by name with a sample format.

Declaration
public AVResult32 SetOption(string name, SampleFormat format, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

SampleFormat format

The sample format to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, PixelFormat, bool)

Sets an option by name with a pixel format.

Declaration
public AVResult32 SetOption(string name, PixelFormat format, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

PixelFormat format

The pixel format to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, Rational, bool)

Sets an option by name with a Rational value.

Declaration
public AVResult32 SetOption(string name, Rational value, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

Rational value

The rational value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, bool, bool)

Sets an option by name with a boolean value.

Declaration
public AVResult32 SetOption(string name, bool value, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

bool value

The boolean value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, IDictionary<string, string>, bool)

Sets an option by name with a dictionary of key-value pairs.

Declaration
public AVResult32 SetOption(string name, IDictionary<string, string> values, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

IDictionary<string, string> values

The dictionary of key-value pairs to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, double, bool)

Sets an option by name with a double value.

Declaration
public AVResult32 SetOption(string name, double value, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

double value

The double value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, int, int, bool)

Sets an option by name with image size (width and height).

Declaration
public AVResult32 SetOption(string name, int width, int height, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

int width

The image width to set.

int height

The image height to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, long, bool)

Sets an option by name with a long integer value.

Declaration
public AVResult32 SetOption(string name, long value, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

long value

The long integer value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, ILookup<string, string>, bool)

Sets an option by name with a lookup collection of key-value pairs.

Declaration
public AVResult32 SetOption(string name, ILookup<string, string> values, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

ILookup<string, string> values

The lookup collection of key-value pairs to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, ref ILookup<string, string>, bool)

Sets multiple options using a reference to a lookup collection of key-value pairs.

Declaration
public AVResult32 SetOption(string name, ref ILookup<string, string> values, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

ILookup<string, string> values

The lookup collection of key-value pairs to set as options.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, object, bool)

Sets an option by name with a generic object value.

Declaration
public AVResult32 SetOption(string name, object value, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

object value

The value to set (can be string, long, double, etc.).

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, ReadOnlyMemory<byte>, bool)

Sets an option by name with a ReadOnlyMemory of bytes.

Declaration
public AVResult32 SetOption(string name, ReadOnlyMemory<byte> memory, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

ReadOnlyMemory<byte> memory

The memory of bytes to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, ReadOnlySpan<byte>, bool)

Sets an option by name with a ReadOnlySpan of bytes.

Declaration
public AVResult32 SetOption(string name, ReadOnlySpan<byte> span, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

ReadOnlySpan<byte> span

The span of bytes to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, string, bool)

Sets an option by name with a string value.

Declaration
public AVResult32 SetOption(string name, string value, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

string value

The string value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption(string, (int Width, int Height), bool)

Sets an option by name with a tuple representing image size (Width, Height).

Declaration
public AVResult32 SetOption(string name, (int Width, int Height) size, bool recursive = true)
Parameters
Type Name Description
string name

The option name to set.

(int Width, int Height) size

A tuple containing width and height values.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

View Source

SetOption<T>(Option, T, bool)

Sets an option using an Option and an enum value.

Declaration
public AVResult32 SetOption<T>(Option option, T value, bool recursive = true) where T : Enum
Parameters
Type Name Description
Option option

The AVOption to set.

T value

The enum value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

Type Parameters
Name Description
T

The enum type of the value to set.

View Source

SetOption<T>(string, T, bool)

Sets an option by name using an enum value.

Declaration
public AVResult32 SetOption<T>(string name, T value, bool recursive = true) where T : Enum
Parameters
Type Name Description
string name

The option name to set.

T value

The enum value to set.

bool recursive

Whether to search child objects recursively.

Returns
Type Description
AVResult32

An AVResult32 indicating the success of the operation.

Type Parameters
Name Description
T

The enumeration type of the value.

View Source

TryGetOption(Option, out ChannelLayout, bool)

Attempts to retrieve the value of the specified Option and convert it to an ChannelLayout.

Declaration
public AVResult32 TryGetOption(Option option, out ChannelLayout layout, bool recursive = true)
Parameters
Type Name Description
Option option

The Option whose value you want to retrieve.

ChannelLayout layout

When this method returns, contains the ChannelLayout value of the specified option. If the option is not found or if an error occurs, this will be set to the default ChannelLayout value.

bool recursive

Specifies whether the search for the option should be recursive in child options. If true, the method will search child options recursively.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(Option, out SampleFormat, bool)

Attempts to retrieve an option as an SampleFormat from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out SampleFormat value, bool recursive = true)
Parameters
Type Name Description
Option option
SampleFormat value

When this method returns, contains the SampleFormat value of the option, or a default value if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an SampleFormat enumeration value, which represents audio sample formats. This method is useful for retrieving options related to audio data formats.

View Source

TryGetOption(Option, out AVDictionary, bool)

Attempts to retrieve an option as a collection of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out AVDictionary value, bool recursive = true)
Parameters
Type Name Description
Option option
AVDictionary value

When this method returns, contains an instance of AVDictionary representing the option's key-value pairs, or a new instance if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and wrapped in a .NET AVDictionary. This method is useful when you need to work directly with the AV dictionary object within the FFmpeg library.

View Source

TryGetOption(Option, out AVMultiDictionary, bool)

Attempts to retrieve an option as a multi-dictionary of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out AVMultiDictionary value, bool recursive = true)
Parameters
Type Name Description
Option option
AVMultiDictionary value

When this method returns, contains an instance of AVMultiDictionary representing the option's key-value pairs, or a new instance if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and wrapped in a .NET AVMultiDictionary. This method is useful for options that may have multiple values for each key and need to be represented in a multi-dictionary format.

View Source

TryGetOption(Option, out PixelFormat, bool)

Attempts to retrieve an option as an PixelFormat from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out PixelFormat value, bool recursive = true)
Parameters
Type Name Description
Option option
PixelFormat value

When this method returns, contains the PixelFormat value of the option, or a default value if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an PixelFormat enumeration value, which represents pixel formats used in video processing. This method is useful for retrieving options related to image formats or color spaces.

View Source

TryGetOption(Option, out Rational, bool)

Attempts to retrieve an option as a rational number from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out Rational value, bool recursive = true)
Parameters
Type Name Description
Option option
Rational value

When this method returns, contains the Rational value of the option, or a default value if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an Rational structure and assigned to the Rational output parameter. This method is useful for options that represent rational values (e.g., frame rates or timebases).

View Source

TryGetOption(Option, out bool, bool)

Attempts to retrieve an option as a boolean value from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out bool value, bool recursive = true)
Parameters
Type Name Description
Option option
bool value

When this method returns, contains the boolean value of the option, or false if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(Option, out byte[], bool)

Attempts to retrieve an option and return its binary data as a byte array from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out byte[] value, bool recursive = true)
Parameters
Type Name Description
Option option
byte[] value

When this method returns, contains the binary data of the option as a byte array. If the option is not found or if an error occurs, the array will be empty.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful.
  • OptionNotFound if the option could not be found or if the data type is incorrect.
  • InvalidArgument if the data size is invalid or if any other argument-related issue occurs.
Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. If the option contains binary data, it is copied into a new byte array. If the option is not found or does not contain binary data, or if there is an issue with the size, appropriate error codes are returned:

  • OptionNotFound if the option is not found or the data type is not binary.
  • InvalidArgument if the binary data size is too large or other issues occur.

To ensure correct operation, handle errors based on the returned AVResult32 code and validate the size of binary data if necessary.

View Source

TryGetOption(Option, out Dictionary<string, string>, bool)

Attempts to retrieve an option as a dictionary of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out Dictionary<string, string> value, bool recursive = true)
Parameters
Type Name Description
Option option
Dictionary<string, string> value

When this method returns, contains a dictionary where keys and values are strings representing the option's key-value pairs, or an empty dictionary if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and converted into a .NET Dictionary<TKey, TValue>. This method is useful for options that are represented as key-value pairs in the underlying AV system.

View Source

TryGetOption(Option, out IDictionary<string, string>, bool)

Attempts to retrieve an option as a dictionary of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out IDictionary<string, string> value, bool recursive = true)
Parameters
Type Name Description
Option option
IDictionary<string, string> value

When this method returns, contains a dictionary where keys and values are strings representing the option's key-value pairs, or an empty dictionary if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and converted into a .NET IDictionary<TKey, TValue>. This method is useful for options that are represented as key-value pairs in the underlying AV system.

View Source

TryGetOption(Option, out double, bool)

Attempts to retrieve an option as a double-precision floating point number from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out double value, bool recursive = true)
Parameters
Type Name Description
Option option
double value

When this method returns, contains the double-precision floating point value of the option, or 0.0 if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as a double-precision floating point number directly. This method is useful for retrieving options that are represented as floating point values in the underlying AV system.

View Source

TryGetOption(Option, out int, bool)

Attempts to retrieve an option as a 32-bit signed integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out int value, bool recursive = true)
Parameters
Type Name Description
Option option
int value

When this method returns, contains the 32-bit signed integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(Option, out int, out int, bool)

Attempts to retrieve the width and height of an image option from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out int width, out int height, bool recursive = true)
Parameters
Type Name Description
Option option
int width

When this method returns, contains the width of the image option in pixels, or 0 if the option is not found or if an error occurs.

int height

When this method returns, contains the height of the image option in pixels, or 0 if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The width and height are retrieved as separate integers using the av_opt_get_image_size(void*, string, int, int*, int*) function. This method is useful for options that specify image dimensions, such as video frame sizes or image resolutions.

View Source

TryGetOption(Option, out long, bool)

Attempts to retrieve an option as a 64-bit signed integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out long value, bool recursive = true)
Parameters
Type Name Description
Option option
long value

When this method returns, contains the 64-bit signed integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(Option, out ILookup<string, string>, bool)

Attempts to retrieve an option as a lookup of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out ILookup<string, string> value, bool recursive = true)
Parameters
Type Name Description
Option option
ILookup<string, string> value

When this method returns, contains an ILookup<TKey, TElement> of key-value pairs representing the option's key-value pairs, or an empty lookup if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and converted into an ILookup<TKey, TElement>. This method is useful for options that may contain multiple values per key and need to be represented as a lookup collection.

View Source

TryGetOption(Option, out Memory<byte>, bool)

Attempts to retrieve an option and return its binary data as a Memory<T> from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out Memory<byte> value, bool recursive = true)
Parameters
Type Name Description
Option option
Memory<byte> value

When this method returns, contains the binary data of the option as a Memory<T>. If the option is not found or if an error occurs, the memory will be empty.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful and the binary data has been successfully copied into the Memory<T>.
  • OptionNotFound if the option could not be found or if the data type is incorrect.
  • InvalidArgument if the data size is invalid or if any other argument-related issue occurs.
Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. If the option contains binary data, it is copied into a new byte array, which is then wrapped in a Memory<T> object. If the option is not found, or the data type is not binary, or there are issues with the data size, appropriate error codes are returned:

  • OptionNotFound if the option is not found or if the data type is not binary.
  • InvalidArgument if the binary data size is too large or other issues occur.

To ensure correct operation, handle errors based on the returned AVResult32 code and validate the size of binary data if necessary.

View Source

TryGetOption(Option, out object?, bool)

Attempts to retrieve the value of the specified Option and returns it as an object of the appropriate managed type.

Declaration
public AVResult32 TryGetOption(Option option, out object? obj, bool recursive = true)
Parameters
Type Name Description
Option option

The option whose value should be retrieved.

object obj

When this method returns successfully, contains the option value converted to the corresponding managed type. Otherwise, the value is unspecified.

bool recursive

true to search recursively in child option containers; otherwise, false.

Returns
Type Description
AVResult32

An AVResult32 indicating whether the operation succeeded. Returns InvalidArgument if the option type is not supported by this overload or if the arguments are invalid.

Remarks

The runtime type of obj depends on the option type:

Option TypeManaged Type
Color, Flags, Int32int
Int64long
Constant, Double, Floatdouble
Stringstring
VideoRate, RationalRational
Binarybyte[]
DictionaryDictionary<TKey, TValue> where TKey and TValue are string.
Duration, UInt64ulong
ImageSize(T1, T2) containing the width and height.
PixelFormatPixelFormat
SampleFormatSampleFormat
Boolbool
ChannelLayoutChannelLayout
UInt32uint

Array options are supported only for String and Binary. All other array option types return InvalidArgument.

View Source

TryGetOption(Option, out ReadOnlyMemory<byte>, bool)

Attempts to retrieve an option and return its binary data as a ReadOnlyMemory<T> from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out ReadOnlyMemory<byte> value, bool recursive = true)
Parameters
Type Name Description
Option option
ReadOnlyMemory<byte> value

When this method returns, contains the binary data of the option as a ReadOnlyMemory<T>. If the option is not found or if an error occurs, the memory will be empty.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful and the binary data has been successfully copied into the ReadOnlyMemory<T>.
  • OptionNotFound if the option could not be found or if the data type is incorrect.
  • InvalidArgument if the data size is invalid or if any other argument-related issue occurs.
Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. If the option contains binary data, it is copied into a new byte array, which is then wrapped in a ReadOnlyMemory<T> object. If the option is not found, or the data type is not binary, or there are issues with the data size, appropriate error codes are returned:

  • OptionNotFound if the option is not found or if the data type is not binary.
  • InvalidArgument if the binary data size is too large or other issues occur.

To ensure correct operation, handle errors based on the returned AVResult32 code and validate the size of binary data if necessary.

View Source

TryGetOption(Option, Span<byte>, bool)

Attempts to retrieve an option and copy its binary data into a Span<T> from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, Span<byte> value, bool recursive = true)
Parameters
Type Name Description
Option option
Span<byte> value

When this method returns, contains the data of the option copied into the provided Span<T>. If the span is not large enough to hold the data, the method returns a negative size indicating the required size.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns the size of the data successfully copied into the Span<T> if the operation was successful. If the provided span is too small to hold the data, returns a negative value indicating the required size of the span. If the option is not found, the data type is incorrect, or any other error occurs, returns MinValue.

Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. The binary data is copied into the provided Span<T>. If the span is too small to accommodate the data, a negative value representing the required size is returned. In case of errors such as invalid option names, incorrect data types, or other failures, MinValue is returned. To ensure the data is copied correctly, make sure the span is sufficiently sized based on the expected data size.

View Source

TryGetOption(Option, out string?, bool)

Attempts to retrieve an option using an Option object and return its value as a string.

Declaration
public AVResult32 TryGetOption(Option option, out string? value, bool recursive = true)
Parameters
Type Name Description
Option option

The Option object representing the option to retrieve.

string value

When this method returns, contains the string representation of the option's value. If the option is of type binary, this method will call another overload to handle binary data. If the option is not found or if an error occurs, this will be null.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful and the value has been successfully retrieved as a string.
  • InvalidArgument if the option is of type binary and the binary retrieval fails, or if any other argument-related issue occurs.
Remarks

This method handles options of type binary separately by calling the TryGetOption(string, out ReadOnlyMemory<byte>, bool) overload. For other types, it retrieves the option's value as a UTF-8 string using the av_opt_get(void*, string, int, byte**) function. If the option is not found or if there are issues with retrieving its value, appropriate error codes are returned:

  • InvalidArgument if the option cannot be found or other issues occur.
View Source

TryGetOption(Option, out uint, bool)

Attempts to retrieve an option as a 32-bit unsigned integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out uint value, bool recursive = true)
Parameters
Type Name Description
Option option
uint value

When this method returns, contains the 32-bit unsigned integer value of the option, or 0 if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as a 64-bit signed integer, and then converted to a 32-bit unsigned integer. Ensure that the value fits within the range of a 32-bit unsigned integer; otherwise, unexpected results may occur.

View Source

TryGetOption(Option, out ulong, bool)

Attempts to retrieve an option as a 64-bit unsigned integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out ulong value, bool recursive = true)
Parameters
Type Name Description
Option option
ulong value

When this method returns, contains the 64-bit unsigned integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(Option, out (int Width, int Height), bool)

Attempts to retrieve the width and height of an image option as a tuple from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(Option option, out (int Width, int Height) size, bool recursive = true)
Parameters
Type Name Description
Option option
(int Width, int Height) size

When this method returns, contains a tuple with the width and height of the image option in pixels, or (0, 0) if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The width and height are retrieved as a tuple using the av_opt_get_image_size(void*, string, int, int*, int*) function. This method is useful for quickly obtaining image dimensions as a single tuple value, which can simplify code that requires both width and height together.

View Source

TryGetOption(string, out ChannelLayout, bool)

Attempts to retrieve the value of the option specified by name and convert it to an ChannelLayout.

Declaration
public AVResult32 TryGetOption(string name, out ChannelLayout layout, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

ChannelLayout layout

When this method returns, contains the ChannelLayout value of the specified option. If the option is not found or if an error occurs, this will be set to the default ChannelLayout value.

bool recursive

Specifies whether the search for the option should be recursive in child options. If true, the method will search child options recursively.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful and the value has been successfully retrieved and converted.
  • InvalidArgument if the option type is not supported or if there is an issue with the arguments.
View Source

TryGetOption(string, out SampleFormat, bool)

Attempts to retrieve an option as an SampleFormat from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out SampleFormat value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

SampleFormat value

When this method returns, contains the SampleFormat value of the option, or a default value if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an SampleFormat enumeration value, which represents audio sample formats. This method is useful for retrieving options related to audio data formats.

View Source

TryGetOption(string, out AVDictionary, bool)

Attempts to retrieve an option as a collection of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out AVDictionary value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

AVDictionary value

When this method returns, contains an instance of AVDictionary representing the option's key-value pairs, or a new instance if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and wrapped in a .NET AVDictionary. This method is useful when you need to work directly with the AV dictionary object within the FFmpeg library.

View Source

TryGetOption(string, out AVMultiDictionary, bool)

Attempts to retrieve an option as a multi-dictionary of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out AVMultiDictionary value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

AVMultiDictionary value

When this method returns, contains an instance of AVMultiDictionary representing the option's key-value pairs, or a new instance if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and wrapped in a .NET AVMultiDictionary. This method is useful for options that may have multiple values for each key and need to be represented in a multi-dictionary format.

View Source

TryGetOption(string, out PixelFormat, bool)

Attempts to retrieve an option as an PixelFormat from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out PixelFormat value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

PixelFormat value

When this method returns, contains the PixelFormat value of the option, or a default value if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an PixelFormat enumeration value, which represents pixel formats used in video processing. This method is useful for retrieving options related to image formats or color spaces.

View Source

TryGetOption(string, out Rational, bool)

Attempts to retrieve an option as a rational number from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out Rational value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

Rational value

When this method returns, contains the Rational value of the option, or a default value if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an Rational structure and assigned to the Rational output parameter. This method is useful for options that represent rational values (e.g., frame rates or timebases).

View Source

TryGetOption(string, out bool, bool)

Attempts to retrieve an option as a boolean value from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out bool value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

bool value

When this method returns, contains the boolean value of the option, or false if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(string, out byte[], bool)

Attempts to retrieve an option and return its binary data as a byte array from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out byte[] value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

byte[] value

When this method returns, contains the binary data of the option as a byte array. If the option is not found or if an error occurs, the array will be empty.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful.
  • OptionNotFound if the option could not be found or if the data type is incorrect.
  • InvalidArgument if the data size is invalid or if any other argument-related issue occurs.
Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. If the option contains binary data, it is copied into a new byte array. If the option is not found or does not contain binary data, or if there is an issue with the size, appropriate error codes are returned:

  • OptionNotFound if the option is not found or the data type is not binary.
  • InvalidArgument if the binary data size is too large or other issues occur.

To ensure correct operation, handle errors based on the returned AVResult32 code and validate the size of binary data if necessary.

View Source

TryGetOption(string, out Dictionary<string, string>, bool)

Attempts to retrieve an option as a dictionary of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out Dictionary<string, string> value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

Dictionary<string, string> value

When this method returns, contains a dictionary where keys and values are strings representing the option's key-value pairs, or an empty dictionary if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and converted into a .NET Dictionary<TKey, TValue>. This method is useful for options that are represented as key-value pairs in the underlying AV system.

View Source

TryGetOption(string, out IDictionary<string, string>, bool)

Attempts to retrieve an option as a dictionary of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out IDictionary<string, string> value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

IDictionary<string, string> value

When this method returns, contains a dictionary where keys and values are strings representing the option's key-value pairs, or an empty dictionary if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and converted into a .NET IDictionary<TKey, TValue>. This method is useful for options that are represented as key-value pairs in the underlying AV system.

View Source

TryGetOption(string, out double, bool)

Attempts to retrieve an option as a double-precision floating point number from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out double value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

double value

When this method returns, contains the double-precision floating point value of the option, or 0.0 if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as a double-precision floating point number directly. This method is useful for retrieving options that are represented as floating point values in the underlying AV system.

View Source

TryGetOption(string, out int, bool)

Attempts to retrieve an option as a 32-bit signed integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out int value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

int value

When this method returns, contains the 32-bit signed integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(string, out int, out int, bool)

Attempts to retrieve the width and height of an image option from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out int width, out int height, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

int width

When this method returns, contains the width of the image option in pixels, or 0 if the option is not found or if an error occurs.

int height

When this method returns, contains the height of the image option in pixels, or 0 if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The width and height are retrieved as separate integers using the av_opt_get_image_size(void*, string, int, int*, int*) function. This method is useful for options that specify image dimensions, such as video frame sizes or image resolutions.

View Source

TryGetOption(string, out long, bool)

Attempts to retrieve an option as a 64-bit signed integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out long value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

long value

When this method returns, contains the 64-bit signed integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(string, out ILookup<string, string>, bool)

Attempts to retrieve an option as a lookup of key-value pairs from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out ILookup<string, string> value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

ILookup<string, string> value

When this method returns, contains an ILookup<TKey, TElement> of key-value pairs representing the option's key-value pairs, or an empty lookup if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as an FFmpeg.AutoGen._AVDictionary and converted into an ILookup<TKey, TElement>. This method is useful for options that may contain multiple values per key and need to be represented as a lookup collection.

View Source

TryGetOption(string, out Memory<byte>, bool)

Attempts to retrieve an option and return its binary data as a Memory<T> from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out Memory<byte> value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

Memory<byte> value

When this method returns, contains the binary data of the option as a Memory<T>. If the option is not found or if an error occurs, the memory will be empty.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful and the binary data has been successfully copied into the Memory<T>.
  • OptionNotFound if the option could not be found or if the data type is incorrect.
  • InvalidArgument if the data size is invalid or if any other argument-related issue occurs.
Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. If the option contains binary data, it is copied into a new byte array, which is then wrapped in a Memory<T> object. If the option is not found, or the data type is not binary, or there are issues with the data size, appropriate error codes are returned:

  • OptionNotFound if the option is not found or if the data type is not binary.
  • InvalidArgument if the binary data size is too large or other issues occur.

To ensure correct operation, handle errors based on the returned AVResult32 code and validate the size of binary data if necessary.

View Source

TryGetOption(string, out object?, bool)

Attempts to retrieve the value of the specified Option and returns it as an object of the appropriate managed type.

Declaration
public AVResult32 TryGetOption(string name, out object? value, bool recursive = true)
Parameters
Type Name Description
string name
object value
bool recursive

true to search recursively in child option containers; otherwise, false.

Returns
Type Description
AVResult32

An AVResult32 indicating whether the operation succeeded. Returns InvalidArgument if the option type is not supported by this overload or if the arguments are invalid.

Remarks

The runtime type of obj depends on the option type:

Option TypeManaged Type
Color, Flags, Int32int
Int64long
Constant, Double, Floatdouble
Stringstring
VideoRate, RationalRational
Binarybyte[]
DictionaryDictionary<TKey, TValue> where TKey and TValue are string.
Duration, UInt64ulong
ImageSize(T1, T2) containing the width and height.
PixelFormatPixelFormat
SampleFormatSampleFormat
Boolbool
ChannelLayoutChannelLayout
UInt32uint

Array options are supported only for String and Binary. All other array option types return InvalidArgument.

View Source

TryGetOption(string, out ReadOnlyMemory<byte>, bool)

Attempts to retrieve an option and return its binary data as a ReadOnlyMemory<T> from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out ReadOnlyMemory<byte> value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

ReadOnlyMemory<byte> value

When this method returns, contains the binary data of the option as a ReadOnlyMemory<T>. If the option is not found or if an error occurs, the memory will be empty.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include:

  • Zero (0) if the operation was successful and the binary data has been successfully copied into the ReadOnlyMemory<T>.
  • OptionNotFound if the option could not be found or if the data type is incorrect.
  • InvalidArgument if the data size is invalid or if any other argument-related issue occurs.
Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. If the option contains binary data, it is copied into a new byte array, which is then wrapped in a ReadOnlyMemory<T> object. If the option is not found, or the data type is not binary, or there are issues with the data size, appropriate error codes are returned:

  • OptionNotFound if the option is not found or if the data type is not binary.
  • InvalidArgument if the binary data size is too large or other issues occur.

To ensure correct operation, handle errors based on the returned AVResult32 code and validate the size of binary data if necessary.

View Source

TryGetOption(string, Span<byte>, bool)

Attempts to retrieve an option and copy its binary data into a Span<T> from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, Span<byte> value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

Span<byte> value

When this method returns, contains the data of the option copied into the provided Span<T>. If the span is not large enough to hold the data, the method returns a negative size indicating the required size.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns the size of the data successfully copied into the Span<T> if the operation was successful. If the provided span is too small to hold the data, returns a negative value indicating the required size of the span. If the option is not found, the data type is incorrect, or any other error occurs, returns MinValue.

Remarks

The method retrieves the option data as binary using the av_opt_find2(void*, string, string, int, int, void**) function. The binary data is copied into the provided Span<T>. If the span is too small to accommodate the data, a negative value representing the required size is returned. In case of errors such as invalid option names, incorrect data types, or other failures, MinValue is returned. To ensure the data is copied correctly, make sure the span is sufficiently sized based on the expected data size.

View Source

TryGetOption(string, out string?, bool)

Attempts to retrieve an option as a string from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out string? value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

string value

When this method returns, contains the string representation of the option value, or null if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

Remarks

If the option is found and is of type binary, it will be converted to a hexadecimal string representation. If the option is not found or is invalid, appropriate error codes will be returned.

View Source

TryGetOption(string, out uint, bool)

Attempts to retrieve an option as a 32-bit unsigned integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out uint value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

uint value

When this method returns, contains the 32-bit unsigned integer value of the option, or 0 if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The option is retrieved as a 64-bit signed integer, and then converted to a 32-bit unsigned integer. Ensure that the value fits within the range of a 32-bit unsigned integer; otherwise, unexpected results may occur.

View Source

TryGetOption(string, out ulong, bool)

Attempts to retrieve an option as a 64-bit unsigned integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out ulong value, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

ulong value

When this method returns, contains the 64-bit unsigned integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

View Source

TryGetOption(string, out (int Width, int Height), bool)

Attempts to retrieve the width and height of an image option as a tuple from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption(string name, out (int Width, int Height) size, bool recursive = true)
Parameters
Type Name Description
string name

The name of the option to retrieve.

(int Width, int Height) size

When this method returns, contains a tuple with the width and height of the image option in pixels, or (0, 0) if the option is not found or if an error occurs.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation. Possible values include success or various error codes.

Remarks

The width and height are retrieved as a tuple using the av_opt_get_image_size(void*, string, int, int*, int*) function. This method is useful for quickly obtaining image dimensions as a single tuple value, which can simplify code that requires both width and height together.

View Source

TryGetOption<T>(Option, out T, bool)

Attempts to retrieve an option as a 64-bit signed integer from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption<T>(Option option, out T value, bool recursive = true) where T : Enum
Parameters
Type Name Description
Option option
T value

When this method returns, contains the 64-bit signed integer value of the option, or 0 if the option is not found.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

Type Parameters
Name Description
T
View Source

TryGetOption<T>(string, out T, bool)

Attempts to retrieve an option as an enum value from the AV-option-enabled class.

Declaration
public AVResult32 TryGetOption<T>(string name, out T value, bool recursive = true) where T : Enum
Parameters
Type Name Description
string name

The name of the option to retrieve.

T value

When this method returns, contains the enum value of the option, or the default value if the option could not be retrieved.

bool recursive

Specifies whether to search for the option recursively in child options.

Returns
Type Description
AVResult32

Returns an AVResult32 indicating the result of the operation.

Type Parameters
Name Description
T

The enum type of the option value.

Implements

IOptionQueryable
ILoggingContext

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