Class: ScreenRecorder::Options Private
- Inherits:
-
Object
- Object
- ScreenRecorder::Options
- 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.
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.
'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.
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
'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.
'yuv420p'.freeze
- YUV420P_SCALING =
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.
'"scale=trunc(iw/2)*2:trunc(ih/2)*2"'.freeze
Instance Attribute Summary collapse
- #all ⇒ Object readonly private
Instance Method Summary collapse
-
#advanced ⇒ Object
private
Returns given values that are optional.
-
#capture_device ⇒ Object
private
Returns capture device in use.
-
#framerate ⇒ Object
private
Returns given framerate.
-
#initialize(options) ⇒ Options
constructor
private
A new instance of Options.
-
#input ⇒ Object
private
Returns given input file or input.
-
#log ⇒ Object
private
Returns given log filename.
-
#output ⇒ Object
private
Returns given output filepath.
-
#parsed ⇒ Object
private
Returns a String with all options parsed and ready for the ffmpeg process to use.
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.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/screen-recorder/options.rb', line 15 def initialize() # @todo Consider using OpenStruct @all = advanced[:input] = default_advanced_input.merge(advanced_input) advanced[:output] = default_advanced_output.merge(advanced_output) advanced[:log] ||= DEFAULT_LOG_FILE # Fix for using yuv420p pixel format for output # @see https://www.reck.dk/ffmpeg-libx264-height-not-divisible-by-2/ advanced_output[:vf] = YUV420P_SCALING if advanced_output[:pix_fmt] == 'yuv420p' end |
Instance Attribute Details
#all ⇒ Object (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.
7 8 9 |
# File 'lib/screen-recorder/options.rb', line 7 def all @all end |
Instance Method Details
#advanced ⇒ Object
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
51 52 53 |
# File 'lib/screen-recorder/options.rb', line 51 def advanced @all[:advanced] ||= {} end |
#capture_device ⇒ Object
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
37 38 39 |
# File 'lib/screen-recorder/options.rb', line 37 def capture_device determine_capture_device end |
#framerate ⇒ Object
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
58 59 60 61 |
# File 'lib/screen-recorder/options.rb', line 58 def framerate ScreenRecorder.logger.warn '#framerate will not be available in the next release. Use #advanced instead.' advanced[:output][:framerate] end |
#input ⇒ Object
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
30 31 32 |
# File 'lib/screen-recorder/options.rb', line 30 def input @all[:input] end |
#log ⇒ Object
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
66 67 68 |
# File 'lib/screen-recorder/options.rb', line 66 def log advanced[:log] end |
#output ⇒ Object
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
44 45 46 |
# File 'lib/screen-recorder/options.rb', line 44 def output @all[:output] end |
#parsed ⇒ Object
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
74 75 76 77 78 79 80 81 |
# File 'lib/screen-recorder/options.rb', line 74 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 |