diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-25 11:40:19 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-25 11:40:19 +0000 |
commit | 0f9bfb784b7bbccf86b7d7d241982ba4e703efd4 (patch) | |
tree | ee8cdbf659457a82ac5d03df77fae8bc00728e68 /lib/dtas/player.rb | |
parent | 157b75aa71bb2d9e7140cd72f29451fa234a902a (diff) | |
download | dtas-0f9bfb784b7bbccf86b7d7d241982ba4e703efd4.tar.gz |
avconv is capable of outputting to the .sox format, greatly simplifying our life as it enables us to easily apply sox effects on a per-source file basis. dtas-sourceedit and the "source" protocol commands will need to change to support internal priorities (like sink).
Diffstat (limited to 'lib/dtas/player.rb')
-rw-r--r-- | lib/dtas/player.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index 57976c2..99c7400 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -6,6 +6,7 @@ require 'shellwords' require_relative '../dtas' require_relative 'source' require_relative 'source/sox' +require_relative 'source/av' require_relative 'source/cmd' require_relative 'sink' require_relative 'unix_server' @@ -297,6 +298,21 @@ class DTAS::Player # :nodoc: end end + def try_file(*args) + [ DTAS::Source::Sox, DTAS::Source::Av ].each do |klass| + rv = klass.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 + end + end + echo "idle" + nil + end + def next_source(source_spec) @current = nil if source_spec @@ -305,16 +321,17 @@ class DTAS::Player # :nodoc: case source_spec when String - @current = DTAS::Source::Sox.new(source_spec) + @current = try_file(source_spec) echo(%W(file #{@current.infile})) when Array - @current = DTAS::Source::Sox.new(*source_spec) + @current = try_file(*source_spec) echo(%W(file #{@current.infile} #{@current.offset_samples}s)) else @current = DTAS::Source::Cmd.new(source_spec["command"]) echo(%W(command #{@current.command_string})) end + # FIXME, support Av overrides if DTAS::Source::Sox === @current @current.command = @srccmd if @srccmd @current.env = @srcenv.dup unless @srcenv.empty? |