Sha256: 29ea20adfbef8e8ab072475baffcb32b86e89e07d75b8cb5e00a4eaa53f35fa7

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

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

    #
    # Desktop recording specific initializer.
    #
    def initialize(input: 'desktop', output:, advanced: {})
      super(input: determine_input(input), output: output, advanced: advanced)
    end

    private

    #
    # Returns FFmpeg expected input value based on current OS
    #
    def determine_input(val)
      if OS.linux?
        return DEFAULT_INPUT_LINUX if val == 'desktop'

        return val # Custom $DISPLAY number in Linux
      end
      return DEFAULT_INPUT_WIN if OS.windows?

      raise ArgumentError, "Unsupported input type: '#{val}'. Expected: 'desktop'"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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