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/source/sox.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/dtas/source/sox.rb') diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb index 64ce095..954c1a5 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -8,16 +8,23 @@ require_relative '../replaygain' # this is usually one input file class DTAS::Source::Sox # :nodoc: require_relative 'file' - require_relative 'mp3gain' include DTAS::Source::File - include DTAS::Source::Mp3gain SOX_DEFAULTS = COMMAND_DEFAULTS.merge( "command" => 'exec sox "$INFILE" $SOXFMT - $TRIMFX $RGFX', "comments" => nil, ) + + def self.try(infile, offset = nil) + err = "" + DTAS::Process.qx(%W(soxi #{infile}), err: err) + return if err =~ /soxi FAIL formats:/ + new(infile, offset) + rescue + end + def initialize(infile, offset = nil) command_init(SOX_DEFAULTS) source_file_init(infile, offset) @@ -79,11 +86,6 @@ class DTAS::Source::Sox # :nodoc: tmp end - def replaygain - @rg = DTAS::ReplayGain.new(comments) || - DTAS::ReplayGain.new(mp3gain_comments) - end - def spawn(format, rg_state, opts) raise "BUG: #{self.inspect}#spawn called twice" if @to_io e = format.to_env -- cgit v1.2.3-24-ge0c7