Class: FFmpeg::FilterGraph::Pad

Inherits:
Object
  • Object
show all
Defined in:
lib/ffmpeg/filter_graph/pad.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Pad

Returns a new instance of Pad.



21
22
23
24
25
# File 'lib/ffmpeg/filter_graph/pad.rb', line 21

def initialize(name)
  fail ArgumentError, 'name cannot be empty' if name.nil? || name.empty?

  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/ffmpeg/filter_graph/pad.rb', line 3

def name
  @name
end

Class Method Details

.in(pad) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/ffmpeg/filter_graph/pad.rb', line 5

def self.in(pad)
  case pad
  when Pads::Outpad then fail ArgumentError, 'cannot use Outpad as input'
  when Pad then pad
  else Pads::Inpad.new(pad.to_s)
  end
end

.out(pad) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/ffmpeg/filter_graph/pad.rb', line 13

def self.out(pad)
  case pad
  when Pads::Inpad then fail ArgumentError, 'cannot use Inpad as output'
  when Pad then pad
  else Pads::Outpad.new(pad.to_s)
  end
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/ffmpeg/filter_graph/pad.rb', line 27

def to_s
  "[#{name}]"
end