Struct CodecParameters_ref
A managed wrapper around the unmanaged FFmpeg _AVCodecParameters structure, providing safe access to codec parameters.
Implements
Inherited Members
Namespace: FFmpeg.Codecs
Assembly: FFmpeg.dll
Syntax
public struct CodecParameters_ref : ICodecParameters
Properties
View SourceAlphaMode
Gets or sets how the alpha channel is represented in relation to the color components.
Declaration
public AlphaMode AlphaMode { get; set; }
Property Value
| Type | Description |
|---|---|
| AlphaMode |
Remarks
Premultiplied indicates that the color components are already multiplied by the alpha value, while Straight indicates that the alpha channel is stored independently of the color components.
BitRate
Gets or sets the target bit rate in bits per second for the codec.
Declaration
public int BitRate { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
BitsPerCodedSample
Gets or sets the number of bits per coded sample.
Declaration
public int BitsPerCodedSample { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
BitsPerRawSample
Gets or sets the number of bits per raw (uncoded) sample.
Declaration
public int BitsPerRawSample { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
BlockAlign
Gets or sets the block alignment (in bytes) for audio data.
Declaration
public int BlockAlign { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ChannelLayout
Declaration
public ChannelLayout_ref ChannelLayout { get; }
Property Value
| Type | Description |
|---|---|
| ChannelLayout_ref |
Channels
Gets the number of audio channels for the current codec parameters.
Declaration
public int Channels { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This value indicates the number of channels in the audio stream, such as 1 for mono, 2 for stereo, or higher for surround formats. The meaning is related to the ChannelLayout property.
ChromaLocation
Gets or sets the chroma sample location for video data.
Declaration
public ChromaLocation ChromaLocation { get; set; }
Property Value
| Type | Description |
|---|---|
| ChromaLocation |
CodecId
Gets or sets the specific codec ID used for the encoded data.
Declaration
public CodecID CodecId { get; set; }
Property Value
| Type | Description |
|---|---|
| CodecID |
CodecTag
Gets or sets the codec tag, which is additional information about the codec (corresponding to the AVI FOURCC).
Declaration
public FourCC CodecTag { get; set; }
Property Value
| Type | Description |
|---|---|
| FourCC |
ColorPrimaries
Gets or sets the color primaries used for color interpretation in video streams.
Declaration
public ColorPrimaries ColorPrimaries { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorPrimaries |
ColorRange
Gets or sets the color range (e.g., limited or full) for video data.
Declaration
public ColorRange ColorRange { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorRange |
ColorSpace
Gets or sets the color space for video data.
Declaration
public ColorSpace ColorSpace { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorSpace |
ColorTransferCharacteristic
Gets or sets the color transfer characteristic for video data.
Declaration
public ColorTransferCharacteristic ColorTransferCharacteristic { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorTransferCharacteristic |
ExtraData
Gets the extra binary data needed for initializing the decoder.
Declaration
public Span<byte> ExtraData { get; }
Property Value
| Type | Description |
|---|---|
| Span<byte> |
FieldOrder
Gets or sets the field order for interlaced video (e.g., top field first).
Declaration
public FieldOrder FieldOrder { get; set; }
Property Value
| Type | Description |
|---|---|
| FieldOrder |
FrameRate
Gets or sets the frame rate for video streams.
Declaration
public Rational FrameRate { get; set; }
Property Value
| Type | Description |
|---|---|
| Rational |
FrameSize
Gets or sets the frame size, such as the number of audio samples per frame.
Declaration
public int FrameSize { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Height
Gets or sets the height of the video frame in pixels.
Declaration
public int Height { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
InitialPadding
Gets or sets the initial padding for audio data, in samples.
Declaration
public int InitialPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Level
Gets or sets the codec level, which may indicate the complexity or feature set.
Declaration
public int Level { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
MediaType
Gets or sets the general type of the encoded data (e.g., video, audio).
Declaration
public MediaType MediaType { get; set; }
Property Value
| Type | Description |
|---|---|
| MediaType |
PixelFormat
Gets or sets the pixel format, which specifies how video frames are stored and processed.
Declaration
public PixelFormat PixelFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| PixelFormat |
Remarks
Ensure the assigned value is compatible with the codec and video stream.
Profile
Gets or sets the codec profile, which defines the feature set and restrictions for the codec.
Declaration
public Profile Profile { get; set; }
Property Value
| Type | Description |
|---|---|
| Profile |
SampleAspectRatio
Gets or sets the sample aspect ratio for video frames.
Declaration
public Rational SampleAspectRatio { get; set; }
Property Value
| Type | Description |
|---|---|
| Rational |
SampleFormat
Gets or sets the sample format, which specifies how audio samples are stored and processed.
Declaration
public SampleFormat SampleFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| SampleFormat |
Remarks
Ensure the assigned value is compatible with the codec and audio stream.
SampleRate
Gets or sets the audio sample rate in Hz.
Declaration
public int SampleRate { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
SeekPreroll
Gets or sets the seek preroll, which is the number of samples to discard before playback starts.
Declaration
public int SeekPreroll { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
TrailingPadding
Gets or sets the trailing padding for audio data, in samples.
Declaration
public int TrailingPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
VideoDelay
Gets or sets the video delay, which is the number of frames of delay for video decoding.
Declaration
public int VideoDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Width
Gets or sets the width of the video frame in pixels.
Declaration
public int Width { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceCopyFrom(CodecContext)
Copies the contents of a CodecContext instance to this instance.
Declaration
public readonly void CopyFrom(CodecContext other)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecContext | other | The CodecContext instance to copy from. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ApplicationException | Thrown if copying fails. |
CopyFrom(ICodecParameters)
Copies the contents of another CodecParameters instance to this instance.
Declaration
public readonly void CopyFrom(ICodecParameters other)
Parameters
| Type | Name | Description |
|---|---|---|
| ICodecParameters | other | The other CodecParameters instance to copy from. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ApplicationException | Thrown if copying fails. |
CopyTo(CodecContext)
Copies the contents of this instance to a specified CodecContext instance.
Declaration
public readonly void CopyTo(CodecContext other)
Parameters
| Type | Name | Description |
|---|---|---|
| CodecContext | other | The CodecContext instance to copy to. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ApplicationException | Thrown if copying fails. |
GetAudioFrameDuration(int)
Calculates the duration of an audio frame based on the number of bytes in the frame.
Declaration
public readonly int GetAudioFrameDuration(int frameBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | frameBytes | The number of bytes in the audio frame. |
Returns
| Type | Description |
|---|---|
| int | The duration of the frame in samples. |
SetExtraData(ReadOnlySpan<byte>)
Sets the extra binary data needed for initializing the decoder.
Declaration
public void SetExtraData(ReadOnlySpan<byte> data)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | data | The extra binary data to set. |
Exceptions
| Type | Condition |
|---|---|
| OutOfMemoryException | Thrown if memory allocation fails. |