Class: FFMPEG::RecorderOptions

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

Overview

Since:

  • 1.0.0-beta2

Constant Summary collapse

DEFAULT_LOG_FILE =

Since:

  • 1.0.0-beta2

'ffmpeg.log'.freeze
DEFAULT_FPS =

Since:

  • 1.0.0-beta2

15.0

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ RecorderOptions

Returns a new instance of RecorderOptions.

Since:

  • 1.0.0-beta2


7
8
9
10
11
# File 'lib/ffmpeg/recorder_options.rb', line 7

def initialize(options)
  TypeChecker.check options, Hash
  TypeChecker.check options[:advanced], Hash if options[:advanced]
  @options = verify_options options
end

Instance Method Details

#advancedObject

Returns given values that are optional

Since:

  • 1.0.0-beta2


44
45
46
# File 'lib/ffmpeg/recorder_options.rb', line 44

def advanced
  @options[:advanced]
end

#allObject

Returns all given options

Since:

  • 1.0.0-beta2


65
66
67
# File 'lib/ffmpeg/recorder_options.rb', line 65

def all
  @options
end

#formatObject

Returns given recording format

Since:

  • 1.0.0-beta2


16
17
18
# File 'lib/ffmpeg/recorder_options.rb', line 16

def format
  determine_capture_device
end

#framerateObject

Returns given framerate

Since:

  • 1.0.0-beta2


23
24
25
# File 'lib/ffmpeg/recorder_options.rb', line 23

def framerate
  @options[:framerate] || DEFAULT_FPS
end

#inputObject

Returns given input file or input

Since:

  • 1.0.0-beta2


30
31
32
# File 'lib/ffmpeg/recorder_options.rb', line 30

def input
  @options[:input]
end

#logObject

Returns given log filename

Since:

  • 1.0.0-beta2


51
52
53
# File 'lib/ffmpeg/recorder_options.rb', line 51

def log
  @options[:log] || DEFAULT_LOG_FILE
end

#log_levelObject

Returns given log_level

Since:

  • 1.0.0-beta2


58
59
60
# File 'lib/ffmpeg/recorder_options.rb', line 58

def log_level
  @options[:log_level]
end

#outputObject

Returns given output filepath

Since:

  • 1.0.0-beta2


37
38
39
# File 'lib/ffmpeg/recorder_options.rb', line 37

def output
  @options[:output]
end

#parsedObject

Returns a String with all options parsed and ready for the ffmpeg process to use

Since:

  • 1.0.0-beta2


73
74
75
76
77
78
79
80
# File 'lib/ffmpeg/recorder_options.rb', line 73

def parsed
  vals = "-f #{determine_capture_device} "
  vals << "-r #{@options[:framerate]} "
  vals << advanced_options if @options[:advanced]
  vals << "-i #{determine_input} "
  vals << @options[:output]
  vals << ffmpeg_log_to(@options[:log]) # If provided
end