Class: FFmpeg::FilterGraph::Pad

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

Overview

The base class for inpads and outpads.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Pad

Returns a new instance of Pad.



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

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

  @name = name
end

Instance Attribute Details

#nameObject (readonly)

the name to return in the output



5
6
7
# File 'lib/ffmpeg/filter_graph/pad.rb', line 5

def name
  @name
end

Class Method Details

.in(pad) ⇒ Pads::Inpad

A factory method for creating inpads

Returns:



9
10
11
12
13
14
15
# File 'lib/ffmpeg/filter_graph/pad.rb', line 9

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

.out(pad) ⇒ Pads::Outpad

A factory method for creating outpads

Returns:



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

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

Instance Method Details

#to_sObject



33
34
35
# File 'lib/ffmpeg/filter_graph/pad.rb', line 33

def to_s
  "[#{name}]"
end