wahwah 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wahwah/riff_tag.rb +6 -0
- data/lib/wahwah/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ae84eaac046bfc70016dd80a23f1c246066d70264c064fd048127946a40bd51
|
|
4
|
+
data.tar.gz: bea598207d92e57cac06bfc948b1ea86a70b68b7ffd61c2231a5b2f75d193785
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc3e3ad5fb44882840f7fe1d21d77aa722a0bc5b13ef41b1d8243f6dc24ec83ac83ce2765e5941f09e7e097b458810235f11235d6b9b997623b9910082d8e023
|
|
7
|
+
data.tar.gz: 4f5fd37cbe0eadfec74eae4b73952bd9fe03b5a8ce67569c4662f54e142a33a163c94722257b6d461286b537b7c59cd0c52b33728659f606d1a1219b10332e00
|
data/lib/wahwah/riff_tag.rb
CHANGED
|
@@ -95,6 +95,12 @@ module WahWah
|
|
|
95
95
|
def parse_fmt_chunk(chunk)
|
|
96
96
|
_, @channel, @sample_rate, _, _, @bit_depth = chunk.data.unpack("vvVVvv")
|
|
97
97
|
@bitrate = @sample_rate * @channel * @bit_depth / 1000
|
|
98
|
+
|
|
99
|
+
# There is a rare situation where the data chunk is not included in the top RIFF chunk.
|
|
100
|
+
# In this case, the duration can not be got from the data chunk, some player even cannot play the file.
|
|
101
|
+
# So try to estimate the duration from the file size and bitrate.
|
|
102
|
+
# This may be inaccurate, but at least can get approximate duration.
|
|
103
|
+
@duration = (@file_size * 8) / (@bitrate * 1000).to_f if @duration.nil?
|
|
98
104
|
end
|
|
99
105
|
|
|
100
106
|
def parse_data_chunk(chunk)
|
data/lib/wahwah/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wahwah
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- aidewoode
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-08-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|