View Source Xav.VideoConverter (xav v0.9.0)
Video samples converter.
It supports pixel format conversion and/or scaling.
Summary
Types
@type converter_opts() :: [ out_format: Xav.Frame.video_format(), out_width: Xav.Frame.width(), out_height: Xav.Frame.height() ]
Type definition for converter options.
out_format
- video format to convert to (e.g. :rgb24
).out_width
- scale the video frame to this width.out_height
- scale the video frame to this height.
If out_width
and out_height
are both not provided, scaling is not performed. If one of the
dimensions is nil
, the other will be calculated based on the input dimensions as
to keep the aspect ratio.
@type t() :: %Xav.VideoConverter{ converter: reference(), out_format: Xav.Frame.video_format(), out_height: Xav.Frame.height(), out_width: Xav.Frame.width() }
Functions
@spec convert(t(), Xav.Frame.t()) :: Xav.Frame.t()
Converts a video frame.
@spec new(converter_opts()) :: t()
Creates a new video converter.