From 00554724ce811fdf4d8b6397e119e4b89585324b Mon Sep 17 00:00:00 2001 From: Stephen von Takach Date: Sun, 28 Jul 2024 11:46:15 +1000 Subject: [PATCH] fix(frame#quick_crop): raise if not possible instead of failing silently --- shard.yml | 2 +- src/ffmpeg/frame.cr | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shard.yml b/shard.yml index 401d1a0..dffcb46 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: ffmpeg -version: 1.2.0 +version: 1.2.1 dependencies: # we use stumpy to extract each pixels colour and draw bounding boxes diff --git a/src/ffmpeg/frame.cr b/src/ffmpeg/frame.cr index a644b29..9916a36 100644 --- a/src/ffmpeg/frame.cr +++ b/src/ffmpeg/frame.cr @@ -88,7 +88,7 @@ class FFmpeg::Frame end # crops the frame for use with scaler to combine cropping in a single operation - def quick_crop(top : Int32, left : Int32, bottom : Int32, right : Int32) : FFmpeg::Frame? + def quick_crop(top : Int32, left : Int32, bottom : Int32, right : Int32) : FFmpeg::Frame case pixel_format when .yuv420_p?, .yuvj420_p? new_frame = FFmpeg::Frame.new(self) @@ -102,6 +102,8 @@ class FFmpeg::Frame when .yuyv422? new_frame = FFmpeg::Frame.new(self) new_frame.quick_crop_uyvy(top, left, bottom, right) + else + raise "pixel format #{pixel_format} does not support quick crop" end new_frame end