From 3d96e3d4a3ad7fbf45b38c81478f04cffb329e25 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 26 Aug 2013 02:00:05 +0000 Subject: cleanup multi-source handling between sox and av This should better prepare us to make "source ed" into "source 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 --- lib/dtas/player.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/dtas/player.rb') 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" -- cgit v1.2.3-24-ge0c7