Class: PopCap::FFmpeg

Inherits:
Object
  • Object
show all
Defined in:
lib/pop_cap/ffmpeg/ffmpeg.rb

Overview

Public: This is a wrapper for the FFmpeg C library.

Examples

file = 'spec/fixtures/sample.flac'
ffmpeg = FFmpeg.new(filepath)

Direct Known Subclasses

Converter, TagReader, TagWriter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath, options = {}) ⇒ FFmpeg

Public: initialize

filepath - Requires a valid filepath to a file on the local filesystem. commander - Defaults to Commander for executing system commands.



22
23
24
25
26
# File 'lib/pop_cap/ffmpeg/ffmpeg.rb', line 22

def initialize(filepath, options={})
  check_for_ffmpeg_install
  @filepath, @options = filepath, options
  @commander = options[:commander] || Commander
end

Instance Attribute Details

#commanderObject

Returns the value of attribute commander.



15
16
17
# File 'lib/pop_cap/ffmpeg/ffmpeg.rb', line 15

def commander
  @commander
end

#filepathObject

Returns the value of attribute filepath.



15
16
17
# File 'lib/pop_cap/ffmpeg/ffmpeg.rb', line 15

def filepath
  @filepath
end

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'lib/pop_cap/ffmpeg/ffmpeg.rb', line 15

def options
  @options
end

Instance Method Details

#error_message(message) ⇒ Object

Public: error_message

message - Provide the message to return.



32
33
34
# File 'lib/pop_cap/ffmpeg/ffmpeg.rb', line 32

def error_message(message)
  "Error #{message} #{filepath}."
end

#executeObject

Public: execute a command



38
39
40
# File 'lib/pop_cap/ffmpeg/ffmpeg.rb', line 38

def execute
  @executed ||= commander.new(*command).execute
end