From 157b75aa71bb2d9e7140cd72f29451fa234a902a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 25 Aug 2013 09:36:22 +0000 Subject: format: decouple from soxi We'll be supporting reading the format from avprobe and ffprobe, so we should avoid tying ourselves to soxi --- lib/dtas/format.rb | 8 -------- lib/dtas/source/sox.rb | 5 ++++- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/dtas/format.rb b/lib/dtas/format.rb index a6e424b..8313796 100644 --- a/lib/dtas/format.rb +++ b/lib/dtas/format.rb @@ -75,14 +75,6 @@ class DTAS::Format # :nodoc: ivars_to_hash(SIVS) end - # FIXME, move to per-source (sox/avconv/ffmpeg) - def from_file(path) - @channels = qx(%W(soxi -c #{path})).to_i - @type = qx(%W(soxi -t #{path})).strip - @rate = qx(%W(soxi -r #{path})).to_i - # we don't need to care for bits, do we? - end - # for the _decoded_ output def bits_per_sample return @bits if @bits diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb index 44b5f17..64ce095 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -36,7 +36,10 @@ class DTAS::Source::Sox # :nodoc: def format @format ||= begin fmt = DTAS::Format.new - fmt.from_file(@infile) + path = @infile + fmt.channels = qx(%W(soxi -c #{path})).to_i + fmt.type = qx(%W(soxi -t #{path})).strip + fmt.rate = qx(%W(soxi -r #{path})).to_i fmt.bits ||= precision fmt end -- cgit v1.2.3-24-ge0c7