Sha256: 5ca44026197f18b614fd723338e4c9bbb0413b820336c403a1953fd2778d0988

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 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(output:, input: input_by_os, 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

1 entries across 1 versions & 1 rubygems

Version Path
screen-recorder-1.5.0 lib/screen-recorder/desktop.rb