ruby-ogginfo 0.6.10 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +4 -0
  2. data/lib/ogginfo.rb +16 -3
  3. metadata +8 -8
@@ -1,3 +1,7 @@
1
+ === 0.6.11 / 2012-07-16
2
+
3
+ * more robust compute_length() method (works on broken OGGs)
4
+
1
5
  === 0.6.10 / 2012-05-18
2
6
 
3
7
  * doesn't show binary dump in raise messages anymore
@@ -25,7 +25,7 @@ end
25
25
  class OggInfoError < StandardError ; end
26
26
 
27
27
  class OggInfo
28
- VERSION = "0.6.10"
28
+ VERSION = "0.6.11"
29
29
  extend Forwardable
30
30
  include Ogg
31
31
 
@@ -132,8 +132,21 @@ private
132
132
  def compute_length(input)
133
133
  reader = Reader.new(input)
134
134
  last_page = nil
135
- reader.each_pages({ :skip_body => true, :skip_checksum => true }) { |page| last_page = page }
136
- return last_page.granule_pos.to_f / @samplerate
135
+
136
+ begin
137
+ reader.each_pages(:skip_body => true, :skip_checksum => true) do |page|
138
+ if page.granule_pos
139
+ last_page = page
140
+ end
141
+ end
142
+ rescue Ogg::StreamError
143
+ end
144
+
145
+ if last_page
146
+ return last_page.granule_pos.to_f / @samplerate
147
+ else
148
+ return 0
149
+ end
137
150
  end
138
151
 
139
152
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ogginfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.10
4
+ version: 0.6.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-18 00:00:00.000000000Z
13
+ date: 2012-07-16 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdoc
17
- requirement: &77405180 !ruby/object:Gem::Requirement
17
+ requirement: &79555720 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '3.10'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *77405180
25
+ version_requirements: *79555720
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rcov
28
- requirement: &77404490 !ruby/object:Gem::Requirement
28
+ requirement: &79545490 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0.9'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *77404490
36
+ version_requirements: *79545490
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: hoe
39
- requirement: &77403630 !ruby/object:Gem::Requirement
39
+ requirement: &79543440 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '3.0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *77403630
47
+ version_requirements: *79543440
48
48
  description: ! 'ruby-ogginfo gives you access to low level information on ogg files
49
49
 
50
50
  (bitrate, length, samplerate, encoder, etc... ), as well as tag.