From 498bb38a0d899376c1d0bc8d032f4023e8461089 Mon Sep 17 00:00:00 2001 From: bajankristof Date: Thu, 2 May 2024 12:13:54 +0200 Subject: [PATCH] fix: transcoder optional argument issues with Ruby 2.7 --- lib/ffmpeg/media.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/ffmpeg/media.rb b/lib/ffmpeg/media.rb index ec2d640..fe76026 100644 --- a/lib/ffmpeg/media.rb +++ b/lib/ffmpeg/media.rb @@ -239,6 +239,19 @@ def audio_tags audio&.first&.tags end + def transcoder(output_path, options, **kwargs) + Transcoder.new(self, output_path, options, **kwargs) + end + + def transcode(output_path, options = EncodingOptions.new, **kwargs) + transcoder(output_path, options, **kwargs).run { |progress| yield progress if block_given? } + end + + def screenshot(output_path, options = EncodingOptions.new, **kwargs) + options = options.merge(screenshot: true) + transcode(output_path, options, **kwargs) { |progress| yield progress if block_given? } + end + def cut(output_path, from, to, options = EncodingOptions.new, **kwargs) kwargs[:input_options] ||= [] if kwargs[:input_options].is_a?(Array) @@ -251,18 +264,5 @@ def cut(output_path, from, to, options = EncodingOptions.new, **kwargs) options = options.merge(seek_time: from) transcode(output_path, options, **kwargs) end - - def transcoder(output_path, options = EncodingOptions.new, **kwargs) - Transcoder.new(self, output_path, options, **kwargs) - end - - def transcode(output_path, options = EncodingOptions.new, **kwargs, &block) - transcoder(output_path, options, **kwargs).run(&block) - end - - def screenshot(output_path, options = EncodingOptions.new, **kwargs, &block) - options = options.merge(screenshot: true) - transcode(output_path, options, **kwargs, &block) - end end end