From 0f9bfb784b7bbccf86b7d7d241982ba4e703efd4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 25 Aug 2013 11:40:19 +0000 Subject: preliminary support for avconv/avprobe from libav 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). --- lib/dtas/player.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'lib/dtas/player.rb') 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? -- cgit v1.2.3-24-ge0c7