dtas 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/Documentation/.gitignore +2 -2
- data/Documentation/GNUmakefile +2 -2
- data/Documentation/dtas-archive.txt +8 -7
- data/Documentation/dtas-console.txt +6 -3
- data/Documentation/dtas-ctl.txt +2 -2
- data/Documentation/dtas-cueedit.txt +2 -2
- data/Documentation/dtas-enq.txt +2 -2
- data/Documentation/dtas-env.txt +2 -2
- data/Documentation/dtas-msinkctl.txt +2 -2
- data/Documentation/dtas-player.txt +2 -2
- data/Documentation/dtas-player_effects.txt +2 -2
- data/Documentation/dtas-player_protocol.txt +3 -3
- data/Documentation/dtas-player_sink_examples.txt +2 -4
- data/Documentation/dtas-sinkedit.txt +2 -2
- data/Documentation/dtas-sourceedit.txt +2 -2
- data/Documentation/dtas-splitfx.txt +3 -24
- data/Documentation/dtas-tl.txt +7 -6
- data/Documentation/dtas-xdelay.txt +2 -2
- data/Documentation/update-footer.rb +4 -3
- data/GIT-VERSION-GEN +6 -5
- data/GNUmakefile +2 -2
- data/HACKING +2 -2
- data/INSTALL +9 -10
- data/README +5 -5
- data/Rakefile +75 -15
- data/TODO +2 -2
- data/bin/dtas-archive +3 -2
- data/bin/dtas-console +63 -22
- data/bin/dtas-ctl +3 -2
- data/bin/dtas-cueedit +3 -2
- data/bin/dtas-enq +3 -2
- data/bin/dtas-mlib +25 -3
- data/bin/dtas-msinkctl +3 -2
- data/bin/dtas-partstats +3 -2
- data/bin/dtas-player +3 -2
- data/bin/dtas-readahead +6 -5
- data/bin/dtas-sinkedit +3 -2
- data/bin/dtas-sourceedit +3 -2
- data/bin/dtas-splitfx +3 -2
- data/bin/dtas-tl +29 -16
- data/bin/dtas-xdelay +3 -2
- data/dtas-linux.gemspec +3 -3
- data/dtas-mpris.gemspec +4 -4
- data/dtas.gemspec +3 -2
- data/lib/dtas.rb +14 -7
- data/lib/dtas/buffer.rb +3 -2
- data/lib/dtas/buffer/read_write.rb +4 -3
- data/lib/dtas/buffer/splice.rb +3 -2
- data/lib/dtas/command.rb +3 -2
- data/lib/dtas/compat_onenine.rb +2 -2
- data/lib/dtas/cue_index.rb +4 -3
- data/lib/dtas/disclaimer.rb +3 -2
- data/lib/dtas/edit_client.rb +4 -3
- data/lib/dtas/fadefx.rb +4 -3
- data/lib/dtas/format.rb +3 -13
- data/lib/dtas/mlib.rb +19 -10
- data/lib/dtas/mlib/migrations/0001_initial.rb +2 -2
- data/lib/dtas/nonblock.rb +2 -2
- data/lib/dtas/parse_freq.rb +4 -4
- data/lib/dtas/parse_time.rb +4 -3
- data/lib/dtas/partstats.rb +6 -5
- data/lib/dtas/pipe.rb +3 -2
- data/lib/dtas/player.rb +4 -3
- data/lib/dtas/player/client_handler.rb +21 -9
- data/lib/dtas/process.rb +5 -4
- data/lib/dtas/replaygain.rb +7 -6
- data/lib/dtas/rg_state.rb +38 -14
- data/lib/dtas/serialize.rb +3 -2
- data/lib/dtas/sigevent.rb +3 -2
- data/lib/dtas/sigevent/efd.rb +2 -2
- data/lib/dtas/sigevent/pipe.rb +4 -3
- data/lib/dtas/sink.rb +3 -2
- data/lib/dtas/source.rb +3 -2
- data/lib/dtas/source/av.rb +3 -2
- data/lib/dtas/source/av_ff_common.rb +6 -5
- data/lib/dtas/source/cmd.rb +3 -2
- data/lib/dtas/source/common.rb +2 -2
- data/lib/dtas/source/ff.rb +3 -2
- data/lib/dtas/source/file.rb +7 -6
- data/lib/dtas/source/mp3gain.rb +3 -2
- data/lib/dtas/source/sox.rb +7 -5
- data/lib/dtas/source/splitfx.rb +8 -4
- data/lib/dtas/spawn_fix.rb +2 -2
- data/lib/dtas/splitfx.rb +5 -4
- data/lib/dtas/state_file.rb +3 -2
- data/lib/dtas/tfx.rb +6 -5
- data/lib/dtas/track.rb +4 -3
- data/lib/dtas/tracklist.rb +8 -8
- data/lib/dtas/unix_accepted.rb +3 -2
- data/lib/dtas/unix_client.rb +3 -2
- data/lib/dtas/unix_server.rb +3 -2
- data/lib/dtas/util.rb +3 -2
- data/lib/dtas/watchable.rb +10 -8
- data/lib/dtas/writable_iter.rb +3 -2
- data/lib/dtas/xs.rb +3 -2
- data/perl/dtas-graph +2 -2
- data/test/covshow.rb +3 -2
- data/test/helper.rb +3 -2
- data/test/player_integration.rb +3 -2
- data/test/test_buffer.rb +3 -2
- data/test/test_env.rb +3 -2
- data/test/test_fadefx.rb +3 -2
- data/test/test_format.rb +3 -2
- data/test/test_format_change.rb +3 -2
- data/test/test_mlib.rb +3 -2
- data/test/test_parse_freq.rb +3 -3
- data/test/test_player.rb +3 -2
- data/test/test_player_client_handler.rb +4 -3
- data/test/test_player_integration.rb +8 -2
- data/test/test_process.rb +5 -4
- data/test/test_rg_integration.rb +3 -2
- data/test/test_rg_state.rb +3 -2
- data/test/test_sink.rb +3 -2
- data/test/test_sink_pipe_size.rb +3 -2
- data/test/test_sink_tee_integration.rb +3 -2
- data/test/test_source_av.rb +6 -5
- data/test/test_source_sox.rb +7 -6
- data/test/test_splitfx.rb +3 -2
- data/test/test_tfx.rb +3 -2
- data/test/test_tracklist.rb +3 -2
- data/test/test_unixserver.rb +3 -2
- data/test/test_util.rb +3 -2
- metadata +3 -3
data/lib/dtas/parse_time.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Copyright (C) 2013-
|
3
|
-
# License:
|
2
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
3
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
4
|
+
# frozen_string_literal: true
|
4
5
|
require_relative '../dtas'
|
5
6
|
|
6
|
-
module DTAS::ParseTime
|
7
|
+
module DTAS::ParseTime # :nodoc:
|
7
8
|
# convert a string time to seconds, returning a Floot or Integer
|
8
9
|
def parse_time(time)
|
9
10
|
case time
|
data/lib/dtas/partstats.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
-
# Copyright (C) 2013-
|
3
|
-
# License:
|
2
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
3
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
4
|
+
# frozen_string_literal: true
|
4
5
|
require_relative '../dtas'
|
5
6
|
require_relative 'xs'
|
6
7
|
require_relative 'process'
|
@@ -8,14 +9,14 @@
|
|
8
9
|
|
9
10
|
# backend for the dtas-partstats(1) command
|
10
11
|
# Unlike the stuff for dtas-player, dtas-partstats is fairly tied to sox
|
11
|
-
class DTAS::PartStats
|
12
|
+
class DTAS::PartStats # :nodoc:
|
12
13
|
CMD = 'sox "$INFILE" -n $TRIMFX $SOXFX stats $STATSOPTS'
|
13
14
|
include DTAS::Process
|
14
15
|
include DTAS::SpawnFix
|
15
16
|
attr_reader :key_idx
|
16
17
|
attr_reader :key_width
|
17
18
|
|
18
|
-
class TrimPart < Struct.new(:tbeg, :tlen, :rate)
|
19
|
+
class TrimPart < Struct.new(:tbeg, :tlen, :rate) # :nodoc:
|
19
20
|
def sec
|
20
21
|
tbeg / rate
|
21
22
|
end
|
@@ -73,7 +74,7 @@ def run(opts = {})
|
|
73
74
|
fails = []
|
74
75
|
do_spawn = lambda do |trim_part|
|
75
76
|
pid, rpipe = partstats_spawn(trim_part, opts)
|
76
|
-
rset[rpipe] = [ trim_part,
|
77
|
+
rset[rpipe] = [ trim_part, ''.b ]
|
77
78
|
pids[pid] = [ trim_part, rpipe ]
|
78
79
|
end
|
79
80
|
|
data/lib/dtas/pipe.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
begin
|
4
5
|
require 'io/splice'
|
5
6
|
rescue LoadError
|
data/lib/dtas/player.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'yaml'
|
4
5
|
require 'shellwords'
|
5
6
|
require_relative '../dtas'
|
@@ -76,7 +77,7 @@ def __wall(msg)
|
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
79
|
-
$stdout.write(msg
|
80
|
+
$stdout.write("#{msg}\n")
|
80
81
|
end
|
81
82
|
|
82
83
|
# used for state file
|
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../xs'
|
4
5
|
require_relative '../parse_time'
|
5
6
|
|
@@ -139,7 +140,7 @@ def dpc_sink(io, msg)
|
|
139
140
|
|
140
141
|
# multiple changes may be made at once
|
141
142
|
msg[2..-1].each do |kv|
|
142
|
-
k, v = kv.split(
|
143
|
+
k, v = kv.split('=', 2)
|
143
144
|
case k
|
144
145
|
when %r{\Aenv\.([^=]+)\z}
|
145
146
|
sink.env[$1] = v
|
@@ -244,7 +245,7 @@ def dpc_rg(io, msg)
|
|
244
245
|
return io.emit(@rg.to_hsh.to_yaml) if msg.empty?
|
245
246
|
before = @rg.to_hsh
|
246
247
|
msg.each do |kv|
|
247
|
-
k, v = kv.split(
|
248
|
+
k, v = kv.split('=', 2)
|
248
249
|
case k
|
249
250
|
when "mode"
|
250
251
|
case v
|
@@ -259,7 +260,7 @@ def dpc_rg(io, msg)
|
|
259
260
|
rv = set_bool(io, kv, v) { |b| @rg.fallback_track = b }
|
260
261
|
rv == true or return rv
|
261
262
|
when %r{(?:gain_threshold|norm_threshold|
|
262
|
-
preamp|norm_level|fallback_gain)[+-]?\z}x
|
263
|
+
preamp|norm_level|fallback_gain|volume)[+-]?\z}x
|
263
264
|
rv = adjust_numeric(io, @rg, k, v)
|
264
265
|
rv == true or return rv
|
265
266
|
end
|
@@ -301,7 +302,10 @@ def dpc_current(io, msg)
|
|
301
302
|
tmp["current_inflight"] = @sink_buf.inflight
|
302
303
|
tmp["format"] = @format.to_hash.delete_if { |_,v| v.nil? }
|
303
304
|
tmp["bypass"] = @bypass.sort!
|
304
|
-
tmp[
|
305
|
+
t = @trim and tmp['trim'] = t.join(' ')
|
306
|
+
if tmp['paused'] = @paused
|
307
|
+
first = @queue[0] and tmp['current_paused'] = first
|
308
|
+
end
|
305
309
|
rg = @rg.to_hsh
|
306
310
|
tmp["rg"] = rg unless rg.empty?
|
307
311
|
if @targets[0]
|
@@ -599,12 +603,15 @@ def _dpc_tl_add(io, msg)
|
|
599
603
|
|
600
604
|
def _dpc_tl_repeat(io, msg)
|
601
605
|
prev = @tl.repeat.to_s
|
606
|
+
do_wall = true
|
602
607
|
case msg.shift
|
603
608
|
when 'true' then @tl.repeat = true
|
604
609
|
when 'false' then @tl.repeat = false
|
605
610
|
when '1' then @tl.repeat = 1
|
606
611
|
when nil
|
612
|
+
do_wall = false
|
607
613
|
end
|
614
|
+
__wall("tl repeat #{@tl.repeat}") if do_wall
|
608
615
|
io.emit("tl repeat #{prev}")
|
609
616
|
end
|
610
617
|
|
@@ -615,7 +622,10 @@ def _dpc_tl_shuffle(io, msg)
|
|
615
622
|
when 'debug' then return io.emit(@tl.shuffle.to_yaml) # TODO: remove
|
616
623
|
when nil
|
617
624
|
else
|
618
|
-
set_bool(io, 'tl shuffle', v)
|
625
|
+
set_bool(io, 'tl shuffle', v) do |b|
|
626
|
+
@tl.shuffle = b
|
627
|
+
__wall("tl shuffle #{b}")
|
628
|
+
end
|
619
629
|
end
|
620
630
|
io.emit("tl shuffle #{prev}")
|
621
631
|
end
|
@@ -655,7 +665,7 @@ def _dpc_tl_get(io, msg)
|
|
655
665
|
|
656
666
|
def _dpc_tl_tracks(io, msg)
|
657
667
|
tracks = @tl.tracks
|
658
|
-
io.emit("#{tracks.size}
|
668
|
+
io.emit("#{tracks.size} #{tracks.map!(&:to_s).join(' ')}")
|
659
669
|
end
|
660
670
|
|
661
671
|
def _dpc_tl_goto(io, msg)
|
@@ -790,7 +800,9 @@ def dpc_trim(io, msg)
|
|
790
800
|
else
|
791
801
|
return io.emit('ERR usage: trim [off|TBEG [TLEN]]')
|
792
802
|
end
|
793
|
-
|
803
|
+
t = t ? t.map(&:to_s).join(' ') : 'off'
|
804
|
+
__wall("trim #{t}")
|
805
|
+
io.emit(t)
|
794
806
|
end
|
795
807
|
end
|
796
808
|
# :startdoc:
|
data/lib/dtas/process.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'io/wait'
|
4
5
|
require 'shellwords'
|
5
6
|
require_relative '../dtas'
|
@@ -87,7 +88,7 @@ def qx(env, cmd = {}, opts = {})
|
|
87
88
|
cmd, opts = env, cmd
|
88
89
|
env = {}
|
89
90
|
end
|
90
|
-
buf = ''
|
91
|
+
buf = ''.b
|
91
92
|
r, w = DTAS::Nonblock.pipe
|
92
93
|
opts = opts.merge(out: w)
|
93
94
|
r.binmode
|
@@ -102,7 +103,7 @@ def qx(env, cmd = {}, opts = {})
|
|
102
103
|
w.close
|
103
104
|
if err_str
|
104
105
|
we.close
|
105
|
-
res =
|
106
|
+
res = ''.b
|
106
107
|
want = { r => res, re => err_str }
|
107
108
|
begin
|
108
109
|
readable = IO.select(want.keys) or next
|
data/lib/dtas/replaygain.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
5
|
# Represents ReplayGain metadata for a DTAS::Source, only used by -player
|
5
6
|
# cleanup/validate values to prevent malicious files from making us
|
@@ -39,7 +40,7 @@ def to_env
|
|
39
40
|
def initialize(comments)
|
40
41
|
comments or return
|
41
42
|
|
42
|
-
# the
|
43
|
+
# the ReplayGain standard specifies 89.0 dB, but maybe some apps are
|
43
44
|
# different...
|
44
45
|
@reference_loudness = check_gain(comments["REPLAYGAIN_REFERENCE_LOUDNESS"])
|
45
46
|
|
@@ -49,8 +50,8 @@ def initialize(comments)
|
|
49
50
|
@album_peak = check_float(comments["REPLAYGAIN_ALBUM_PEAK"])
|
50
51
|
end
|
51
52
|
|
52
|
-
def self.new(comments)
|
53
|
-
tmp = super
|
54
|
-
tmp.
|
53
|
+
def self.new(comments, field)
|
54
|
+
tmp = super(comments)
|
55
|
+
tmp.__send__(field) ? tmp : nil
|
55
56
|
end
|
56
57
|
end
|
data/lib/dtas/rg_state.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
#
|
4
5
|
# provides support for generating appropriate effects for ReplayGain
|
5
6
|
# MAYBE: account for non-standard reference loudness (89.0 dB is standard)
|
@@ -19,6 +20,7 @@ class DTAS::RGState # :nodoc:
|
|
19
20
|
}
|
20
21
|
|
21
22
|
RG_DEFAULT = {
|
23
|
+
"volume" => 1.0,
|
22
24
|
# skip the effect if the adjustment is too small to be noticeable
|
23
25
|
"gain_threshold" => 0.00000001, # in dB
|
24
26
|
"norm_threshold" => 0.00000001,
|
@@ -34,6 +36,13 @@ class DTAS::RGState # :nodoc:
|
|
34
36
|
SIVS = RG_DEFAULT.keys
|
35
37
|
SIVS.each { |iv| attr_accessor iv }
|
36
38
|
|
39
|
+
undef_method :volume=
|
40
|
+
|
41
|
+
def volume=(val)
|
42
|
+
val = 0 if val.to_i < 0
|
43
|
+
@volume = val.round(4)
|
44
|
+
end
|
45
|
+
|
37
46
|
def initialize
|
38
47
|
RG_DEFAULT.each do |k,v|
|
39
48
|
instance_variable_set("@#{k}", v)
|
@@ -50,24 +59,38 @@ def to_hash
|
|
50
59
|
ivars_to_hash(SIVS)
|
51
60
|
end
|
52
61
|
|
62
|
+
def vol_db
|
63
|
+
linear_to_db(@volume)
|
64
|
+
end
|
65
|
+
|
53
66
|
def to_hsh
|
54
67
|
# no point in dumping default values, it's just a waste of space
|
55
68
|
to_hash.delete_if { |k,v| RG_DEFAULT[k] == v }
|
56
69
|
end
|
57
70
|
|
71
|
+
def to_sox_gain(val)
|
72
|
+
case val.infinite?
|
73
|
+
when -1 then return 'gain -192'
|
74
|
+
when 1 then return 'gain 192'
|
75
|
+
else
|
76
|
+
sprintf('gain %0.8g', val).freeze
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
58
80
|
# returns a dB argument to the "gain" effect, nil if nothing found
|
59
81
|
def rg_vol_gain(val)
|
60
|
-
val = val.to_f + @preamp
|
82
|
+
val = val.to_f + @preamp + vol_db
|
61
83
|
return if val.abs < @gain_threshold
|
62
|
-
|
84
|
+
to_sox_gain(val)
|
63
85
|
end
|
64
86
|
|
65
87
|
# returns a DB argument to the "gain" effect
|
66
88
|
def rg_vol_norm(val)
|
67
|
-
|
68
|
-
|
69
|
-
diff
|
70
|
-
|
89
|
+
n = @norm_level == 1.0 ? @volume : @norm_level
|
90
|
+
diff = n - val.to_f
|
91
|
+
return if (n - diff).abs < @norm_threshold
|
92
|
+
diff += n
|
93
|
+
to_sox_gain(linear_to_db(diff))
|
71
94
|
end
|
72
95
|
|
73
96
|
# The ReplayGain fallback adjustment value (in dB), in case a file is
|
@@ -75,20 +98,21 @@ def rg_vol_norm(val)
|
|
75
98
|
# eardrums and amplifiers in case a file without then necessary ReplayGain
|
76
99
|
# tag slips into the queue
|
77
100
|
def rg_fallback_effect(reason)
|
78
|
-
@fallback_gain
|
79
|
-
val = @fallback_gain + @preamp
|
101
|
+
val = (@fallback_gain || 0) + @preamp + vol_db
|
80
102
|
return if val.abs < @gain_threshold
|
81
103
|
warn(reason) if $DEBUG
|
82
|
-
|
104
|
+
to_sox_gain(val)
|
83
105
|
end
|
84
106
|
|
85
107
|
# returns an array (for command-line argument) for the effect needed
|
86
108
|
# to apply ReplayGain
|
87
109
|
# this may return nil
|
88
110
|
def effect(source)
|
89
|
-
|
90
|
-
|
91
|
-
|
111
|
+
unless @mode
|
112
|
+
return @volume == 1.0 ? nil : to_sox_gain(vol_db)
|
113
|
+
end
|
114
|
+
rg = source.replaygain(@mode) or
|
115
|
+
return rg_fallback_effect("ReplayGain tags missing for #@mode")
|
92
116
|
val = rg.__send__(@mode)
|
93
117
|
if ! val && @fallback_track && @mode =~ /\Aalbum_(\w+)/
|
94
118
|
tag = "track_#$1"
|
data/lib/dtas/serialize.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
5
|
# used to serialize player state to the state file
|
5
6
|
module DTAS::Serialize # :nodoc:
|
data/lib/dtas/sigevent.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
begin
|
4
5
|
raise LoadError, "no eventfd with _DTAS_POSIX" if ENV["_DTAS_POSIX"]
|
5
6
|
require 'sleepy_penguin'
|
data/lib/dtas/sigevent/efd.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
|
4
4
|
# used in various places for safe wakeups from IO.select via signals
|
5
5
|
# This requires a modern Linux system and the "sleepy_penguin" RubyGem
|
data/lib/dtas/sigevent/pipe.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
5
|
# used in various places for safe wakeups from IO.select via signals
|
5
6
|
# A fallback for non-Linux systems lacking the "sleepy_penguin" RubyGem
|
@@ -9,7 +10,7 @@ class DTAS::Sigevent # :nodoc:
|
|
9
10
|
|
10
11
|
def initialize
|
11
12
|
@to_io, @wr = DTAS::Nonblock.pipe
|
12
|
-
@rbuf = ''
|
13
|
+
@rbuf = ''.b
|
13
14
|
end
|
14
15
|
|
15
16
|
def signal
|
data/lib/dtas/sink.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'yaml'
|
4
5
|
require_relative '../dtas'
|
5
6
|
require_relative 'pipe'
|
data/lib/dtas/source.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../dtas'
|
4
5
|
|
5
6
|
module DTAS::Source # :nodoc:
|
data/lib/dtas/source/av.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../../dtas'
|
4
5
|
require_relative 'av_ff_common'
|
5
6
|
|
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../../dtas'
|
4
5
|
require_relative '../source'
|
5
6
|
require_relative '../replaygain'
|
@@ -75,7 +76,7 @@ def av_ff_ok?
|
|
75
76
|
cmd.concat(%W(-show_streams -show_format #@infile))
|
76
77
|
break if cmd == prev_cmd
|
77
78
|
|
78
|
-
err = ""
|
79
|
+
err = "".b
|
79
80
|
s = qx(@env, cmd, err_str: err, no_raise: true)
|
80
81
|
return false unless probe_ok?(s, err)
|
81
82
|
s.scan(%r{^\[STREAM\]\n(.*?)\n\[/STREAM\]\n}mn) do |_|
|
@@ -93,10 +94,10 @@ def av_ff_ok?
|
|
93
94
|
end while incomplete.compact[0]
|
94
95
|
|
95
96
|
s.scan(%r{^\[FORMAT\]\n(.*?)\n\[/FORMAT\]\n}m) do |_|
|
96
|
-
f = $1
|
97
|
+
f = $1.dup
|
97
98
|
f =~ /^duration=([\d\.]+)\s*$/nm and @duration = $1.to_f
|
98
99
|
# TODO: multi-line/multi-value/repeated tags
|
99
|
-
f.gsub!(/^TAG:([^=]+)=(.*)$/ni) { |_| @comments[$1.upcase] = $2 }
|
100
|
+
f.gsub!(/^TAG:([^=]+)=(.*)$/ni) { |_| @comments[$1.upcase.freeze] = $2 }
|
100
101
|
end
|
101
102
|
! @astreams.compact.empty?
|
102
103
|
end
|
data/lib/dtas/source/cmd.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../../dtas'
|
4
5
|
require_relative '../source'
|
5
6
|
require_relative '../command'
|