about summary refs log tree commit homepage
path: root/lib/dtas/source/sox.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-25 01:03:18 +0000
committerEric Wong <e@80x24.org>2016-01-25 01:09:05 +0000
commit70b81da26a525486c288176e5764c875c752d0b8 (patch)
treeff451fe1efbdd3f1d76ec571c63e9045eab7e28e /lib/dtas/source/sox.rb
parent7bfed9258bfeae89bab5939be749d07592b9f49c (diff)
downloaddtas-70b81da26a525486c288176e5764c875c752d0b8.tar.gz
Almost, we will need to get a list of all suffixes supported
by ffprobe or avprobe.  This could prove tricky..
Diffstat (limited to 'lib/dtas/source/sox.rb')
-rw-r--r--lib/dtas/source/sox.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb
index 9d128a6..db1ace2 100644
--- a/lib/dtas/source/sox.rb
+++ b/lib/dtas/source/sox.rb
@@ -53,6 +53,10 @@ class DTAS::Source::Sox # :nodoc:
     @format ||= DTAS::Format.from_file(@env, @infile)
   end
 
+  def duration
+    samples / format.rate.to_f
+  end
+
   # This is the number of samples according to the samples in the source
   # file itself, not the decoded output
   def samples