about summary refs log tree commit homepage
path: root/lib/dtas/player.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-08-26 02:00:05 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-26 02:17:57 +0000
commit3d96e3d4a3ad7fbf45b38c81478f04cffb329e25 (patch)
treed5ec3b7db1316e1930980bf836feca70dfa233df /lib/dtas/player.rb
parent6d67d9c2af57233743187a92b7e651174d6eb42b (diff)
downloaddtas-3d96e3d4a3ad7fbf45b38c81478f04cffb329e25.tar.gz
This should better prepare us to make "source ed" into
"source <av|sox> ed" and set per-source priorities.

We also now treat @env consistently for all per-source commands
(such as soxi/avprobe) so we can be sure we're using the same
installation of sox or libav if using a non-standard PATH, or if we
want to set AV_LOG_FORCE_NOCOLOR
Diffstat (limited to 'lib/dtas/player.rb')
-rw-r--r--lib/dtas/player.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index 2a3420a..f1d3507 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -26,7 +26,7 @@ class DTAS::Player # :nodoc:
     @state_file = nil
     @socket = nil
     @srv = nil
-    @queue = [] # sources
+    @queue = [] # files for sources, or commands
     @paused = false
     @format = DTAS::Format.new
     @srccmd = nil
@@ -40,6 +40,7 @@ class DTAS::Player # :nodoc:
     @sink_buf = DTAS::Buffer.new
     @current = nil
     @watchers = {}
+    @sources = [ DTAS::Source::Sox.new, DTAS::Source::Av.new ]
   end
 
   def echo(msg)
@@ -298,14 +299,14 @@ class DTAS::Player # :nodoc:
   end
 
   def try_file(*args)
-    [ DTAS::Source::Sox, DTAS::Source::Av ].each do |klass|
-      rv = klass.try(*args) and return rv
+    @sources.each do |src|
+      rv = src.try(*args) and return rv
     end
 
     # keep going down the list until we find something
     while source_spec = @queue.shift
-      [ DTAS::Source::Sox, DTAS::Source::Av ].each do |klass|
-        rv = klass.try(*source_spec) and return rv
+      @sources.each do |src|
+        rv = src.try(*source_spec) and return rv
       end
     end
     echo "idle"