Sha256: 8bd7e5d896fcbb0ff29b56c055ab51c70cba9d71695543ddcf45892d9749dabd

Contents?: true

Size: 1 KB

Versions: 31

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'ehbrs/videos/profiles/same_quality'
require 'ehbrs/videos/unsupported/fixes/supported_container'

module Ehbrs
  module Videos
    module Unsupported
      class FixProfile
        include ::Ehbrs::Videos::Profiles::SameQuality

        common_constructor :video
        set_callback :swap, :after do
          video.all_fixes.each do |fix|
            next unless fix.respond_to?(:after_swap)

            fix.after_swap(self)
          end
        end

        def name
          "fix_for_#{::File.basename(video.file)}"
        end

        def ffmpeg_args
          r = fix_args
          r += container_fix_args unless r.include?('-f')
          r + super
        end

        private

        def fix_args
          ['-c', 'copy'] + video.ffmpeg_fix_args +
            video.tracks.flat_map(&:ffmpeg_fix_args)
        end

        def container_fix_args
          ['-f', ::Ehbrs::Videos::Unsupported::Fixes::SupportedContainer::FIX_FORMAT]
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
ehbrs-tools-0.39.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.38.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.37.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.36.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.35.1 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.35.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.34.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.33.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.32.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.31.1 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.31.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.30.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.29.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.28.3 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.28.2 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.28.1 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.28.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.27.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.26.0 lib/ehbrs/videos/unsupported/fix_profile.rb
ehbrs-tools-0.25.1 lib/ehbrs/videos/unsupported/fix_profile.rb