Class: MMPlayer::Player::Invoker
- Inherits:
-
Object
- Object
- MMPlayer::Player::Invoker
- Defined in:
- lib/mmplayer/player/invoker.rb
Overview
Invoke MPlayer
Instance Attribute Summary collapse
-
#player ⇒ Object
readonly
Returns the value of attribute player.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#ensure_invoked(file, state) ⇒ MPlayer::Slave
Ensure that the MPlayer process is invoked.
-
#initialize(options = {}) ⇒ Invoker
constructor
A new instance of Invoker.
Constructor Details
#initialize(options = {}) ⇒ Invoker
Returns a new instance of Invoker.
12 13 14 15 16 17 |
# File 'lib/mmplayer/player/invoker.rb', line 12 def initialize( = {}) @flags = "-fixed-vo -idle" @flags += " #{[:flags]}" unless [:flags].nil? @player.nil? @thread = nil end |
Instance Attribute Details
#player ⇒ Object (readonly)
Returns the value of attribute player.
8 9 10 |
# File 'lib/mmplayer/player/invoker.rb', line 8 def player @player end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
8 9 10 |
# File 'lib/mmplayer/player/invoker.rb', line 8 def thread @thread end |
Instance Method Details
#destroy ⇒ Object
19 20 21 |
# File 'lib/mmplayer/player/invoker.rb', line 19 def destroy @thread.kill unless @thread.nil? end |
#ensure_invoked(file, state) ⇒ MPlayer::Slave
Ensure that the MPlayer process is invoked
27 28 29 30 31 32 33 34 35 |
# File 'lib/mmplayer/player/invoker.rb', line 27 def ensure_invoked(file, state) if @player.nil? && @thread.nil? @thread = ::MMPlayer::Thread.new(:timeout => false) do @player = MPlayer::Slave.new(file, :options => @flags) state.handle_start end end @player end |