Sha256: 502d418b0550f8cd37e3851cae6fafdd7bed5839d9bb9ae366d167c44dc71480

Contents?: true

Size: 825 Bytes

Versions: 11

Compression:

Stored size: 825 Bytes

Contents

module Ffmprb

  class Process

    class Input

      def mute
        Loud.new self, volume: 0
      end

      def volume(vol)
        Loud.new self, volume: vol
      end

      class Loud < ChainBase

        def initialize(unfiltered, volume:)
          super unfiltered
          @volume = volume

          fail Error, "volume cannot be nil"  if volume.nil?
        end

        def filters_for(lbl, video:, audio:)

          # Modulating volume

          lbl_aux = "ld#{lbl}"
          unfiltered.filters_for(lbl_aux, video: video, audio: audio) +
            [
              *((video && channel?(:video))? Filter.copy("#{lbl_aux}:v", "#{lbl}:v"): nil),
              *((audio && channel?(:audio))? Filter.volume(@volume, "#{lbl_aux}:a", "#{lbl}:a"): nil)
            ]
        end

      end

    end

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ffmprb-0.11.4 lib/ffmprb/process/input/loud.rb
ffmprb-0.11.3 lib/ffmprb/process/input/loud.rb
ffmprb-0.11.2 lib/ffmprb/process/input/loud.rb
ffmprb-0.10.1 lib/ffmprb/process/input/loud.rb
ffmprb-0.10.0 lib/ffmprb/process/input/loud.rb
ffmprb-0.9.6 lib/ffmprb/process/input/loud.rb
ffmprb-0.9.4 lib/ffmprb/process/input/loud.rb
ffmprb-0.9.3 lib/ffmprb/process/input/loud.rb
ffmprb-0.9.2 lib/ffmprb/process/input/loud.rb
ffmprb-0.9.1 lib/ffmprb/process/input/loud.rb
ffmprb-0.9.0 lib/ffmprb/process/input/loud.rb