Class: Player

Inherits:
Hash
  • Object
show all
Defined in:
lib/player/player.rb

Overview

Player 仮想クラスMplayer等で継承して使う

Direct Known Subclasses

FFMpeg, Mplayer, RtmpDump

Instance Method Summary collapse

Instance Method Details

#commandObject



6
# File 'lib/player/player.rb', line 6

def command; end

#duration(file) ⇒ Object

音声ファイル file の長さ(sec)を返す



22
23
24
25
26
27
# File 'lib/player/player.rb', line 22

def duration(file)
	stdout, stderr, status = Open3.capture3("ffprobe #{file}")
	stderr =~ /Duration: (\d{2}):(\d{2}):(\d{2}.\d{2})/m
	hour, min, sec = [$1, $2, $3].map(&:to_f)
	hour*60*60 + min*60 + sec
end

#optionsObject



11
12
13
# File 'lib/player/player.rb', line 11

def options
	map{ |k,v| "--#{k} #{v}"}*' '
end

#playObject



7
# File 'lib/player/player.rb', line 7

def play; end

#rec(file, sec, quiet = true) ⇒ Object



8
# File 'lib/player/player.rb', line 8

def rec(file, sec, quiet = true); end

#to_sObject



16
17
18
# File 'lib/player/player.rb', line 16

def to_s
	%Q(#{command} #{options} )
end