Class FramerateConverter
Converts video frames from one framerate to another by dropping or duplicating frames as needed.
public class FramerateConverter : IDisposable
- Inheritance
-
FramerateConverter
- Implements
- Inherited Members
Remarks
This converter only supports uncompressed video samples. It handles discontinuities in the input stream and adjusts timestamps to match the output framerate.
Constructors
FramerateConverter(MediaType, MediaType)
Initializes a new instance of the FramerateConverter class.
public FramerateConverter(MediaType inputMediaType, MediaType outputMediaType)
Parameters
inputMediaTypeMediaTypeThe input media type describing the source video format and framerate.
outputMediaTypeMediaTypeThe output media type describing the target video format and framerate.
Exceptions
- Exception
Thrown when the media types are not video, not uncompressed, or missing framerate information.
Methods
CanPassThrough(long)
Checks if the frame at the given DTS can be passed through without dropping. Caches the result in VAST.Media.FramerateConverter.passThroughVerified so Write(VersatileBuffer) can reuse it without recalculating.
public bool CanPassThrough(long dts)
Parameters
dtslongThe decode timestamp of the frame to check.
Returns
- bool
True if the frame can be passed through; false if it should be dropped.
Dispose()
Releases all resources used by the framerate converter.
public void Dispose()
Read()
Reads the next converted output frame from the converter.
public VersatileBuffer Read()
Returns
- VersatileBuffer
The converted video frame with adjusted timestamp, or null if no frame is available.
Write(VersatileBuffer)
Writes an input video frame to the converter for framerate conversion.
public void Write(VersatileBuffer packet)
Parameters
packetVersatileBufferThe input video frame to process.
Remarks
The frame may be dropped if it arrives too early relative to the expected output timing. Discontinuities in the input stream are automatically detected and handled.