Sha256: 1a67f94568246f59e4c4b5a1353e7521d5229f6dd0aabf8ecbc5af4ef4a05527

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

# @since 1.0.0-beta11
module ScreenRecorder
  # @since 1.0.0-beta11
  class Desktop < Common
    DEFAULT_INPUT_WIN   = 'desktop'.freeze
    DEFAULT_INPUT_LINUX = ':0'.freeze
    DEFAULT_INPUT_MAC   = '1'.freeze

    #
    # Desktop recording mode.
    #
    def initialize(input: input_by_os, output:, advanced: {})
      super(input: determine_input(input), output: output, advanced: advanced)
    end

    private

    #
    # Returns default input value for current OS
    #
    def input_by_os
      return DEFAULT_INPUT_WIN if OS.windows?

      return DEFAULT_INPUT_LINUX if OS.linux?

      return DEFAULT_INPUT_MAC if OS.mac?

      raise 'Your OS is not supported. Feel free to create an Issue on GitHub.'
    end

    #
    # Returns FFmpeg expected input based on user given value or
    # default for the current OS.
    #
    def determine_input(val)
      return val if val

      input_by_os
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
screen-recorder-1.4.0 lib/screen-recorder/desktop.rb
screen-recorder-1.3.1 lib/screen-recorder/desktop.rb
screen-recorder-1.3.0 lib/screen-recorder/desktop.rb