From 70b81da26a525486c288176e5764c875c752d0b8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 25 Jan 2016 01:03:18 +0000 Subject: mlib: support all formats of player Almost, we will need to get a list of all suffixes supported by ffprobe or avprobe. This could prove tricky.. --- lib/dtas/source/sox.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/dtas/source/sox.rb') 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 -- cgit v1.2.3-24-ge0c7