web_video 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/web_video/adapters/ffmpeg_adapter.rb +1 -1
- data/lib/web_video/stream.rb +13 -13
- data/lib/web_video/version.rb +1 -1
- metadata +4 -4
@@ -60,7 +60,7 @@ module WebVideo
|
|
60
60
|
metadata[:bitrate] = $1 if ffmpeg_output =~ /\,\s+bitrate\:\s+(.*)$/i
|
61
61
|
|
62
62
|
ffmpeg_output.scan(/Stream\s+#0.(\d+)(\[.+\])?(\(.+\))?:\s(.*):\s([^,]*),\s(.*)/i).each do |match|
|
63
|
-
metadata[:streams] << WebVideo::Stream.new(:type => match[
|
63
|
+
metadata[:streams] << WebVideo::Stream.new(:type => match[3], :codec => match[4], :details => match[5])
|
64
64
|
end
|
65
65
|
|
66
66
|
return metadata
|
data/lib/web_video/stream.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module WebVideo
|
2
2
|
class Stream
|
3
|
-
attr_accessor :type, :codec, :details, :
|
3
|
+
attr_accessor :type, :codec, :details, :width, :height
|
4
4
|
|
5
5
|
#
|
6
6
|
# stream = Stream.new :type => 'Video', :codec => 'mpeg4', :details => 'yuv420p, 640x480 [PAR 1:1 DAR 4:3], 30 tbr, 30 tbn, 30 tbc'
|
@@ -13,7 +13,8 @@ module WebVideo
|
|
13
13
|
@type = options[:type].to_s.downcase
|
14
14
|
@codec = options[:codec]
|
15
15
|
@details = options[:details]
|
16
|
-
|
16
|
+
|
17
|
+
extract_resolution_from_details
|
17
18
|
end
|
18
19
|
|
19
20
|
def video?
|
@@ -24,20 +25,19 @@ module WebVideo
|
|
24
25
|
@type == 'audio'
|
25
26
|
end
|
26
27
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def height
|
32
|
-
@resolution ? @resolution[/\d+$/] : nil
|
28
|
+
def resolution
|
29
|
+
if width && height
|
30
|
+
"#{width}x#{height}"
|
31
|
+
end
|
33
32
|
end
|
34
33
|
|
35
34
|
private
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
|
36
|
+
def extract_resolution_from_details
|
37
|
+
if @details =~ /[\s+\,](\d+)x(\d+)[\s+\,]/
|
38
|
+
@width = $1.to_i
|
39
|
+
@height = $2.to_i
|
40
|
+
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
data/lib/web_video/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_video
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 2
|
10
|
+
version: 1.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-06 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|