Skip to content

Commit

Permalink
fix(frame#quick_crop): raise if not possible
Browse files Browse the repository at this point in the history
instead of failing silently
  • Loading branch information
stakach committed Jul 28, 2024
1 parent fb4143e commit 0055472
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/ffmpeg/frame.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 0055472

Please sign in to comment.