Skip to content

Commit

Permalink
fix: transcoder optional argument issues with Ruby 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bajankristof committed May 2, 2024
1 parent 72b0c2e commit 498bb38
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/ffmpeg/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit 498bb38

Please sign in to comment.