Class: ScreenRecorder::Options Private

Inherits:
Object
  • Object
show all
Defined in:
lib/screen-recorder/options.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0-beta11

Constant Summary collapse

DEFAULT_LOG_FILE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0-beta11

'ffmpeg.log'.freeze
DEFAULT_FPS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0-beta11

15.0
DEFAULT_MAC_INPUT_PIX_FMT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

For avfoundation

Since:

  • 1.0.0-beta11

'uyvy422'.freeze
DEFAULT_PIX_FMT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0-beta11

'yuv420p'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Options

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Options.

Since:

  • 1.0.0-beta11



14
15
16
17
18
19
20
# File 'lib/screen-recorder/options.rb', line 14

def initialize(options)
  # @todo Consider using OpenStruct
  @all = verify_options options
  advanced[:input] = default_advanced_input.merge(advanced_input)
  advanced[:output] = default_advanced_output.merge(advanced_output)
  advanced[:log] ||= DEFAULT_LOG_FILE
end

Instance Attribute Details

#allObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0-beta11



7
8
9
# File 'lib/screen-recorder/options.rb', line 7

def all
  @all
end

Instance Method Details

#advancedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns given values that are optional

Since:

  • 1.0.0-beta11



46
47
48
# File 'lib/screen-recorder/options.rb', line 46

def advanced
  @all[:advanced] ||= {}
end

#capture_deviceObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns capture device in use

Since:

  • 1.0.0-beta11



32
33
34
# File 'lib/screen-recorder/options.rb', line 32

def capture_device
  determine_capture_device
end

#framerateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns given framerate

Since:

  • 1.0.0-beta11



53
54
55
56
# File 'lib/screen-recorder/options.rb', line 53

def framerate
  ScreenRecorder.logger.warn '#framerate will not be available in the next release. Use #advanced instead.'
  advanced[:output][:framerate]
end

#inputObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns given input file or input

Since:

  • 1.0.0-beta11



25
26
27
# File 'lib/screen-recorder/options.rb', line 25

def input
  @all[:input]
end

#logObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns given log filename

Since:

  • 1.0.0-beta11



61
62
63
# File 'lib/screen-recorder/options.rb', line 61

def log
  advanced[:log]
end

#outputObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns given output filepath

Since:

  • 1.0.0-beta11



39
40
41
# File 'lib/screen-recorder/options.rb', line 39

def output
  @all[:output]
end

#parsedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Since:

  • 1.0.0-beta11



69
70
71
72
73
74
75
76
# File 'lib/screen-recorder/options.rb', line 69

def parsed
  vals = "-f #{capture_device} "
  vals << parse_advanced(advanced_input)
  vals << "-i #{input} " unless advanced_input[:i] # Input provided by user
  vals << parse_advanced(advanced)
  vals << parse_advanced(advanced_output)
  vals << output
end