Class SampleExtensions
Provides extension methods for working with SampleFormat values.
Inherited Members
Namespace: FFmpeg.Audio
Assembly: FFmpeg.dll
Syntax
public static class SampleExtensions
Methods
View SourceAsPacked(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. |
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. |
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. |
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. |
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. |
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. |
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. |
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 |
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 |
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. |
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. |
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 |