ffprober 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ffprober/format.rb +4 -7
- data/lib/ffprober/parser.rb +7 -7
- data/lib/ffprober/stream.rb +6 -9
- data/lib/ffprober/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: bcb2bb4dcd2ba2306fd3f32b5b03095dfa3bc8d5
|
4
|
+
data.tar.gz: 5441108c41049b6104757992599a96825b2fb2b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 566b46750ba822e42be96b09c3b0a22d8652230fd6d3ba80c174a11e39294ff2086712d2df17388402b4fb9baa0c596a5030a6bf1496021f7712b44b86d2e2b0
|
7
|
+
data.tar.gz: c0319d56f55b03cbd6817f77ec43c44a6ae7b9836eb1f6d65fd45cb1034ddb5fe8e6cfc8f8d70481d8dce8da04b9c08f876d1e85f7d50cc30e93fb12ff21b66a
|
data/lib/ffprober/format.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
module Ffprober
|
2
2
|
class Format
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
attr_reader :filename, :nb_streams, :format_name,
|
4
|
+
:format_long_name, :start_time, :duration,
|
5
|
+
:size, :bit_rate
|
6
6
|
|
7
7
|
def initialize(object_attribute_hash)
|
8
|
-
object_attribute_hash.
|
9
|
-
writer_m = "#{k}="
|
10
|
-
send(writer_m, v) if respond_to?(writer_m)
|
11
|
-
end
|
8
|
+
object_attribute_hash.each {|k,v| instance_variable_set("@#{k}",v)}
|
12
9
|
end
|
13
10
|
end
|
14
11
|
end
|
data/lib/ffprober/parser.rb
CHANGED
@@ -30,19 +30,19 @@ module Ffprober
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def format
|
33
|
-
Ffprober::Format.new(parsed_json[:format])
|
33
|
+
@format ||= Ffprober::Format.new(parsed_json[:format])
|
34
34
|
end
|
35
35
|
|
36
36
|
def video_streams
|
37
|
-
|
38
|
-
Ffprober::VideoStream.new(s)
|
39
|
-
end
|
37
|
+
@video_streams ||= stream_by_codec('video').map { |s| Ffprober::VideoStream.new(s) }
|
40
38
|
end
|
41
39
|
|
42
40
|
def audio_streams
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
@audio_streams ||= stream_by_codec('audio').map { |s| Ffprober::AudioStream.new(s) }
|
42
|
+
end
|
43
|
+
|
44
|
+
def stream_by_codec(codec_type)
|
45
|
+
streams.select { |stream| stream[:codec_type] == codec_type }
|
46
46
|
end
|
47
47
|
|
48
48
|
def streams
|
data/lib/ffprober/stream.rb
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
module Ffprober
|
2
2
|
class Stream
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
attr_reader :codec_name, :codec_long_name, :codec_type,
|
4
|
+
:codec_time_base, :codec_tag_string, :codec_tag,
|
5
|
+
:r_frame_rate, :avg_frame_rate,
|
6
|
+
:time_base, :start_time, :duration,
|
7
|
+
:nb_frames
|
8
8
|
|
9
9
|
def initialize(object_attribute_hash)
|
10
|
-
object_attribute_hash.
|
11
|
-
writer_m = "#{k}="
|
12
|
-
send(writer_m, v) if respond_to?(writer_m)
|
13
|
-
end
|
10
|
+
object_attribute_hash.each {|k,v| instance_variable_set("@#{k}",v)}
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
data/lib/ffprober/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffprober
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- beanieboi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|