Struct CodecDescription
Represents a codec descriptor with various properties.
This struct is a readonly wrapper around an FFmpeg.AutoGen._AVCodecDescriptor pointer, providing a way to access codec descriptor properties in a safe manner.
Implements
Inherited Members
Namespace: FFmpeg.Codecs
Assembly: FFmpeg.dll
Syntax
public readonly struct CodecDescription : IEquatable<CodecDescription>
Properties
View SourceId
Gets the codec ID, which is a value from the CodecID enumeration.
Declaration
public CodecID Id { get; }
Property Value
| Type | Description |
|---|---|
| CodecID | The codec ID for this codec descriptor. |
LongName
Gets the more descriptive name for this codec.
This name provides additional details about the codec and may be null if not available.
Declaration
public string? LongName { get; }
Property Value
| Type | Description |
|---|---|
| string | The more descriptive name of the codec, or null if not available. |
MimeTypes
Gets the MIME types associated with the codec.
This property returns an array of MIME types that are associated with the codec. If no MIME types are available, it returns an empty array. The first item in the array is always the preferred MIME type if available.
Declaration
public string[] MimeTypes { get; }
Property Value
| Type | Description |
|---|---|
| string[] | An array of MIME types associated with the codec, or an empty array if none are available. |
Name
Gets the name of the codec.
This name is non-empty and unique for each codec descriptor. It is intended for identification purposes.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string | The name of the codec. |
Profiles
Gets the array of profiles recognized for this codec.
This property returns a read-only collection of profiles associated with the codec. Profiles provide additional information about codec capabilities and configurations. If no profiles are available, it returns an empty collection.
Declaration
public ReadOnlyCollection<Profile> Profiles { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyCollection<Profile> | A ReadOnlyCollection<T> containing the profiles recognized for this codec, or an empty collection if none are available. |
Properties
Gets the codec properties, which is a combination of flags from the CodecProperties enumeration.
Declaration
public CodecProperties Properties { get; }
Property Value
| Type | Description |
|---|---|
| CodecProperties | The properties of the codec, represented as a bit field combining various flags. |
Type
Gets the media type of the codec, which is a value from the MediaType enumeration.
Declaration
public MediaType Type { get; }
Property Value
| Type | Description |
|---|---|
| MediaType | The media type for this codec descriptor. |
Methods
View SourceEquals(CodecDescription)
Determines whether the specified CodecDescription is equal to the current CodecDescription.
Declaration
public bool Equals(CodecDescription other)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecDescription | other | The CodecDescription to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(object?)
Determines whether the specified object is equal to the current CodecDescription.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current CodecDescription. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
View SourceGetAllCodecDescriptors()
Retrieves an array of all available codec descriptors.
This method iterates through all codec descriptors registered with FFmpeg and collects them into an array.
Declaration
public static CodecDescription[] GetAllCodecDescriptors()
Returns
| Type | Description |
|---|---|
| CodecDescription[] | An array of CodecDescription instances representing all available codec descriptors. |
GetCodecDescriptor(Codec)
Retrieves a CodecDescription for the specified Codec.
Declaration
public static CodecDescription GetCodecDescriptor(Codec codec)
Parameters
| Type | Name | Description |
|---|---|---|
| Codec | codec | The codec to get the descriptor for. |
Returns
| Type | Description |
|---|---|
| CodecDescription | A CodecDescription instance representing the codec descriptor. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the |
GetCodecDescriptor(CodecID)
Retrieves a CodecDescription for the specified codec ID.
Declaration
public static CodecDescription GetCodecDescriptor(CodecID codecID)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecID | codecID | The codec ID to get the descriptor for. |
Returns
| Type | Description |
|---|---|
| CodecDescription | A CodecDescription instance representing the codec descriptor. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the |
GetCodecDescriptor(string)
Retrieves a CodecDescription for the specified codec name.
Declaration
public static CodecDescription GetCodecDescriptor(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the codec to get the descriptor for. |
Returns
| Type | Description |
|---|---|
| CodecDescription | A CodecDescription instance representing the codec descriptor. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the |
GetHashCode()
Serves as a hash function for the CodecDescription type.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current CodecDescription. |
Overrides
View SourceToString()
Returns a string representation of the CodecDescription.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The long name of the codec descriptor, providing a more descriptive name for the codec. |
Overrides
View SourceTryGetCodecDescriptor(Codec, out CodecDescription)
Attempts to retrieve a CodecDescription for the specified Codec.
Declaration
public static bool TryGetCodecDescriptor(Codec codec, out CodecDescription descriptor)
Parameters
| Type | Name | Description |
|---|---|---|
| Codec | codec | The codec to get the descriptor for. |
| CodecDescription | descriptor | When this method returns, contains the CodecDescription instance if the codec was valid. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetCodecDescriptor(CodecID, out CodecDescription)
Attempts to retrieve a CodecDescription for the specified codec ID.
Declaration
public static bool TryGetCodecDescriptor(CodecID codecID, out CodecDescription descriptor)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecID | codecID | The codec ID to get the descriptor for. |
| CodecDescription | descriptor | When this method returns, contains the CodecDescription instance if the codec ID was valid. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetCodecDescriptor(string, out CodecDescription)
Attempts to retrieve a CodecDescription for the specified codec name.
Declaration
public static bool TryGetCodecDescriptor(string name, out CodecDescription descriptor)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the codec to get the descriptor for. |
| CodecDescription | descriptor | When this method returns, contains the CodecDescription instance if the name was valid. |
Returns
| Type | Description |
|---|---|
| bool |
|
Operators
View Sourceoperator ==(CodecDescription, CodecDescription)
Determines whether two CodecDescription instances are equal.
Declaration
public static bool operator ==(CodecDescription left, CodecDescription right)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecDescription | left | The first CodecDescription instance. |
| CodecDescription | right | The second CodecDescription instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
operator !=(CodecDescription, CodecDescription)
Determines whether two CodecDescription instances are not equal.
Declaration
public static bool operator !=(CodecDescription left, CodecDescription right)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecDescription | left | The first CodecDescription instance. |
| CodecDescription | right | The second CodecDescription instance. |
Returns
| Type | Description |
|---|---|
| bool |
|