Skip to content

Commit

Permalink
feat(swscale): add helper method for scaling a frame
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Feb 16, 2024
1 parent c02fc19 commit f712e2f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ffmpeg/swscale.cr
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@ class FFmpeg::SWScale
LibAV::SWScale.scale(@context, inp.value.data, inp.value.linesize, 0, input.height, outp.value.data, outp.value.linesize)
output
end

def self.scale(input : Frame, width : Int32, height : Int32, output_format : PixelFormat = PixelFormat::Rgb24, scaling_method : ScalingAlgorithm = ScalingAlgorithm::Bicublin) : Frame
new(
input.width, input.height, input.pixel_format,
width, height, output_format, scaling_method
).unsafe_scale(input)
end
end

0 comments on commit f712e2f

Please sign in to comment.