mp3file 1.1.2 → 1.1.3
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/mp3file/mp3_file.rb +15 -11
- data/lib/mp3file/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cf86507fcd63fcb962fe2dda0dbd5d2a2ab7663
|
4
|
+
data.tar.gz: b5d0ae9444f9f4d5c010f443c1872ad50f3671c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7559f2f3edbc7d530eab3c92a604cfb74b079130e53c7d036568c63938325e0f8823c33d864ee746710441006edb1d625bb5051a7a3ea83443cb43e5ce048b4a
|
7
|
+
data.tar.gz: 75a97f77e322cac1de9159e4f2106dac88ee675f407816c62782d121bdc8bdd3e4e931a82d7741caecd3106994f1d0f8d2d1ea0a2c2872962b9fd2fbe242d9ef
|
data/lib/mp3file/mp3_file.rb
CHANGED
@@ -198,23 +198,27 @@ module Mp3file
|
|
198
198
|
if uniq_brs.size == 1
|
199
199
|
@bitrate = uniq_brs.first / 1000
|
200
200
|
end
|
201
|
+
@num_frames = frame_headers.size
|
201
202
|
else
|
202
203
|
# Use the Xing header to make the VBR / CBR call. Assume that
|
203
204
|
# Xing headers, when present in a CBR file, are called "Info".
|
204
205
|
@vbr = @xing_header.nil? || @xing_header.name == "Xing"
|
205
206
|
end
|
206
207
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
208
|
+
# Find the number of frames. Prefer the actual frame count we
|
209
|
+
# did (if we scanned all the frames) over the Xing
|
210
|
+
# header. Prefer the Xing header over file size math.
|
211
|
+
@num_frames = @num_frames || (@xing_header && @xing_header.frames) || (@audio_size / @first_header.frame_size)
|
212
|
+
|
213
|
+
# Figure out the total samples and the time duration.
|
214
|
+
@total_samples = @num_frames * @first_header.samples
|
215
|
+
@length = @total_samples.to_f / @samplerate.to_f
|
216
|
+
|
217
|
+
# If the file looks like it's a VBR file, do an averate bitrate
|
218
|
+
# calculation, either using the Xing header's idea of the file
|
219
|
+
# size or the one we found.
|
220
|
+
if @vbr
|
221
|
+
@bitrate = (@xing_header.bytes || @audio_size) / @length.to_f * 8 / 1000
|
218
222
|
end
|
219
223
|
|
220
224
|
@file.close
|
data/lib/mp3file/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mp3file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Watts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|