Class: Bagel::Video::FFMPEG::FadeFilter
- Inherits:
-
Object
- Object
- Bagel::Video::FFMPEG::FadeFilter
- Defined in:
- lib/bagel/video/ffmpeg/fade_filter.rb
Instance Attribute Summary collapse
-
#alpha ⇒ Object
readonly
Returns the value of attribute alpha.
-
#fade ⇒ Object
readonly
Returns the value of attribute fade.
-
#input_index ⇒ Object
readonly
Returns the value of attribute input_index.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input_index, fade, label, alpha = false) ⇒ FadeFilter
constructor
A new instance of FadeFilter.
- #to_s ⇒ Object
Constructor Details
#initialize(input_index, fade, label, alpha = false) ⇒ FadeFilter
Returns a new instance of FadeFilter.
13 14 15 16 17 18 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 13 def initialize(input_index, fade, label, alpha=false) @input_index = input_index @fade = fade @label = label @alpha = alpha end |
Instance Attribute Details
#alpha ⇒ Object (readonly)
Returns the value of attribute alpha.
3 4 5 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 3 def alpha @alpha end |
#fade ⇒ Object (readonly)
Returns the value of attribute fade.
3 4 5 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 3 def fade @fade end |
#input_index ⇒ Object (readonly)
Returns the value of attribute input_index.
3 4 5 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 3 def input_index @input_index end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
3 4 5 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 3 def label @label end |
Class Method Details
.for_clip(fade) ⇒ Object
5 6 7 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 5 def self.for_clip(fade) new(INDEX_VIDEO, fade, LABEL_VIDEO, false).to_s end |
.for_overlay(fade, input_index) ⇒ Object
9 10 11 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 9 def self.(fade, input_index) new(input_index+1, fade, "#{LABEL_OVERLAY}#{input_index}", true).to_s end |
Instance Method Details
#to_s ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bagel/video/ffmpeg/fade_filter.rb', line 20 def to_s chain = [] if fade.in_start && fade.in_duration chain << "fade=t=in:st=#{fade.in_start}:d=#{fade.in_duration}:alpha=#{alpha ? '1' : '0'}" end if fade.out_start && fade.out_duration chain << "fade=t=out:st=#{fade.out_start}:d=#{fade.out_duration}:alpha=#{alpha ? '1' : '0'}" end "[#{input_index}]#{chain.join(',')}[#{label}]" end |