Module: FFmpeg::FilterGraph::Helper

Defined in:
lib/ffmpeg/filter_graph/helper.rb

Constant Summary collapse

CHANNELS =
%w(FL FR FC LFE RL RR)

Instance Method Summary collapse

Instance Method Details

#chain(*args) ⇒ Object



6
# File 'lib/ffmpeg/filter_graph/helper.rb', line 6

def chain(*args); Chain.new(*args) end

#count_channels(ch) ⇒ Object

Returns the number of channels in the given channel layout.

Returns:

  • the number of channels in the given channel layout



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ffmpeg/filter_graph/helper.rb', line 17

def count_channels(ch)
  case ch
  when Fixnum   then ch
  when '7.1'    then 8
  when '6.1'    then 7
  when '5.1'    then 6
  when '4.1'    then 5
  when '3.1'    then 4
  when '2.1'    then 3
  when 'stereo' then 2
  when 'mono'   then 1
  else fail 'unknown layout'
  end
end

#graph(*args) ⇒ Object



5
# File 'lib/ffmpeg/filter_graph/helper.rb', line 5

def graph(*args); Graph.new(*args) end

#surround_channels(prefix = '', *channels) ⇒ Object

Filter-specific helpers will be added to this module by default, by the FilterFactory class.



11
12
13
14
# File 'lib/ffmpeg/filter_graph/helper.rb', line 11

def surround_channels(prefix = '', *channels)
  channels = CHANNELS if channels.empty?
  channels.map(&:to_s).map(&:upcase).map { |c| "#{prefix}#{c}" }
end