Sha256: 100bcab1157b03d8c08c3f307387eeaed51fcd008127854c240f636f785c3761

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

#
# Capturer Baseclass
#

module VCSRuby
  class Capturer
    $formats = { :png => 'png', :bmp => 'bmp', :tiff => 'tif', :mjpeg => 'jpg', :jpeg => 'jpg', :jpg => 'jpg' }

    def available?
      false
    end

    def self.initialize_capturers video
      puts "Available capturers: #{available_capturers.map{ |c| c.to_s }.join(', ')}" if Tools.verbose?
    end

    def self.create
      capturers = []

      capturers << LibAV.new(video)
      capturers << MPlayer.new(video)
      capturers << FFmpeg.new(video)

      return capturers.first
    end

    def format
      @format || available_formats.first
    end

    def format_extension
      $formats[format]
    end

    def format= format
      if available_formats.include? format
        @format = format
      else
        raise "Capturer '#{name}' does not support format: '#{format}'"
      end
    end

  private
    def probe_meta_information
      check_cache
      return parse_meta_info
    rescue Exception => e
      puts e
      return false
    end

    def parse_meta_info
      parse_format && parse_audio_streams && parse_video_streams
    end

    def get_hash defines
      result = {}
      defines.lines.each do |line|
        kv = line.split("=")
        result[kv[0].strip] = kv[1].strip if kv.count == 2
      end
      result
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vcs_ruby-1.1.16 lib/capturer.rb
vcs_ruby-1.1.15 lib/capturer.rb
vcs_ruby-1.1.14 lib/capturer.rb
vcs_ruby-1.1.13 lib/capturer.rb
vcs_ruby-1.1.12 lib/capturer.rb
vcs_ruby-1.1.11 lib/capturer.rb