Show / Hide Table of Contents

Class SampleExtensions

Provides extension methods for working with SampleFormat values.

Inheritance
object
SampleExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: FFmpeg.Audio
Assembly: FFmpeg.dll
Syntax
public static class SampleExtensions

Methods

View Source

AsPacked(SampleFormat)

Converts the specified SampleFormat to its packed equivalent.

Declaration
public static SampleFormat AsPacked(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
SampleFormat

The packed SampleFormat equivalent of the specified format.

View Source

AsPlanar(SampleFormat)

Converts the specified SampleFormat to its planar equivalent.

Declaration
public static SampleFormat AsPlanar(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
SampleFormat

The planar SampleFormat equivalent of the specified format.

View Source

GetBitsPerSample(SampleFormat)

Gets the number of bits per sample for the specified SampleFormat.

Declaration
public static int GetBitsPerSample(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
int

The number of bits per sample.

View Source

GetBitsPerSample(_AVCodecID)

Gets the number of bits per sample for the specified FFmpeg.AutoGen._AVCodecID.

Declaration
public static int GetBitsPerSample(this _AVCodecID codec)
Parameters
Type Name Description
_AVCodecID codec
Returns
Type Description
int

The number of bits per sample.

View Source

GetBytesPerSample(SampleFormat)

Gets the number of bytes per sample for the specified SampleFormat.

Declaration
public static int GetBytesPerSample(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
int

The number of bytes per sample.

View Source

GetName(SampleFormat)

Gets the name of the specified SampleFormat as a string.

Declaration
public static string GetName(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
string

The name of the sample format.

View Source

GetSampleFormatType(SampleFormat)

Returns the .NET type that corresponds to the specified SampleFormat.

Declaration
public static Type GetSampleFormatType(this SampleFormat sampleFormat)
Parameters
Type Name Description
SampleFormat sampleFormat
Returns
Type Description
Type

The .NET type that matches the given sample format.

Exceptions
Type Condition
ArgumentException

Thrown if the SampleFormat is not recognized or is unsupported.

View Source

IsPacked(SampleFormat)

Determines if the specified SampleFormat is packed.

Declaration
public static bool IsPacked(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
bool

true if the format is packed; otherwise, false.

View Source

IsPlanar(SampleFormat)

Determines if the specified SampleFormat is planar.

Declaration
public static bool IsPlanar(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
bool

true if the format is planar; otherwise, false.

View Source

Parse(string)

Gets the SampleFormat from its name.

Declaration
public static SampleFormat Parse(string name)
Parameters
Type Name Description
string name

The name of the sample format.

Returns
Type Description
SampleFormat

The corresponding SampleFormat.

View Source

ToFFmpegString(SampleFormat)

Gets the FFmpeg name of this sample format.

Declaration
public static string ToFFmpegString(this SampleFormat format)
Parameters
Type Name Description
SampleFormat format
Returns
Type Description
string

The FFmpeg name of the sample format, or null if the sample format is not recognized.

View Source

ValidateType<T>(SampleFormat)

Validates that the generic type T matches the specified SampleFormat.

Declaration
public static void ValidateType<T>(this SampleFormat sampleFormat) where T : unmanaged
Parameters
Type Name Description
SampleFormat sampleFormat
Type Parameters
Name Description
T

The unmanaged type to validate against the sample format.

Exceptions
Type Condition
ArgumentException

Thrown if T does not match the SampleFormat or if the format is unsupported.

  • View Source
In this article
Back to top Generated by DocFX