Class: Mediakit::FFmpeg

Inherits:
Object
  • Object
show all
Defined in:
lib/mediakit/ffmpeg.rb,
lib/mediakit/ffmpeg/options.rb

Defined Under Namespace

Modules: BaseTypeMatcher Classes: AudioCodec, AudioDecoder, AudioEncoder, Codec, Decoder, Encoder, FFmpegError, Format, Options, SubtitleCodec, SubtitleDecoder, SubtitleEncoder, VideoCodec, VideoDecoder, VideoEncoder

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver) ⇒ FFmpeg

Returns a new instance of FFmpeg.



21
22
23
24
# File 'lib/mediakit/ffmpeg.rb', line 21

def initialize(driver)
  @driver                                 = driver
  @codecs, @formats, @decoders, @encoders = [], [], [], []
end

Class Attribute Details

.default_global_optionObject

Returns the value of attribute default_global_option.



11
12
13
# File 'lib/mediakit/ffmpeg.rb', line 11

def default_global_option
  @default_global_option
end

Instance Attribute Details

#codecsObject (readonly)

Returns the value of attribute codecs.



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

def codecs
  @codecs
end

#decodersObject (readonly)

Returns the value of attribute decoders.



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

def decoders
  @decoders
end

#encodersObject (readonly)

Returns the value of attribute encoders.



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

def encoders
  @encoders
end

#formatsObject (readonly)

Returns the value of attribute formats.



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

def formats
  @formats
end

Class Method Details

.create(driver = Mediakit::Drivers::FFmpeg.new) ⇒ Object



17
18
19
# File 'lib/mediakit/ffmpeg.rb', line 17

def self.create(driver = Mediakit::Drivers::FFmpeg.new)
  @ffmpeg ||= new(driver)
end

Instance Method Details

#command(options, driver_options = {}) ⇒ Object



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

def command(options, driver_options = {})
  args = options.compose(self.class.default_global_option)
  @driver.command(args, driver_options)
end

#initObject



26
27
28
# File 'lib/mediakit/ffmpeg.rb', line 26

def init
  Mediakit::Initializers::FFmpeg.setup(self)
end

#run(options, driver_options = {}) ⇒ Object

execute runners with options object

Parameters:

  • options (Mediakit::Runners::FFmpeg::Options)

    options to create CLI argument



33
34
35
36
# File 'lib/mediakit/ffmpeg.rb', line 33

def run(options, driver_options = {})
  args = options.compose(self.class.default_global_option)
  @driver.run(args, driver_options)
end