Class VideoStreamDecoder
Handles video stream decoding using FFmpeg, supporting hardware acceleration and metadata retrieval.
Namespace: Evergine.Runtimes.Video.Helpers
Assembly: Evergine.Runtimes.Video.dll
Syntax
public class VideoStreamDecoder
Constructors
VideoStreamDecoder(string, AVHWDeviceType)
Initializes a new instance of the VideoStreamDecoder class.
Declaration
public VideoStreamDecoder(string videoPath, AVHWDeviceType hWDeviceType = AVHWDeviceType.AV_HWDEVICE_TYPE_NONE)
Parameters
Type | Name | Description |
---|---|---|
string | videoPath | The path to the video file. |
AVHWDeviceType | hWDeviceType | The hardware acceleration device type. |
Properties
CodecName
Gets the name of the codec used for decoding.
Declaration
public string CodecName { get; }
Property Value
Type | Description |
---|---|
string |
FrameRate
Gets the frame rate of the video.
Declaration
public float FrameRate { get; }
Property Value
Type | Description |
---|---|
float |
FrameSize
Gets the size of the video frame.
Declaration
public Size FrameSize { get; }
Property Value
Type | Description |
---|---|
Size |
PixelFormat
Gets the pixel format of the video frame.
Declaration
public AVPixelFormat PixelFormat { get; }
Property Value
Type | Description |
---|---|
AVPixelFormat |
Methods
Dispose()
Releases resources used by the decoder.
Declaration
public void Dispose()
GetContextInfo()
Retrieves metadata from the video context.
Declaration
public IReadOnlyDictionary<string, string> GetContextInfo()
Returns
Type | Description |
---|---|
IReadOnlyDictionary<string, string> | A dictionary containing metadata key-value pairs. |
Reset()
Resets the video stream to the beginning.
Declaration
public void Reset()
TryDecodeNextFrame(out AVFrame, bool)
Attempts to decode the next video frame.
Declaration
public bool TryDecodeNextFrame(out AVFrame frame, bool loop)
Parameters
Type | Name | Description |
---|---|---|
AVFrame | frame | The output decoded frame. |
bool | loop | Whether to loop the video when it reaches the end. |
Returns
Type | Description |
---|---|
bool | True if a frame was successfully decoded, otherwise false. |