Class: WebVideo::Stream
- Inherits:
-
Object
- Object
- WebVideo::Stream
- Defined in:
- lib/web_video/stream.rb
Instance Attribute Summary collapse
-
#codec ⇒ Object
Returns the value of attribute codec.
-
#details ⇒ Object
Returns the value of attribute details.
-
#height ⇒ Object
Returns the value of attribute height.
-
#type ⇒ Object
Returns the value of attribute type.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #audio? ⇒ Boolean
-
#initialize(options = {}) ⇒ Stream
constructor
stream = Stream.new :type => ‘Video’, :codec => ‘mpeg4’, :details => ‘yuv420p, 640x480 [PAR 1:1 DAR 4:3], 30 tbr, 30 tbn, 30 tbc’ stream.video? # => true stream.audio? # => false.
- #resolution ⇒ Object
- #video? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Stream
stream = Stream.new :type => ‘Video’, :codec => ‘mpeg4’, :details => ‘yuv420p, 640x480 [PAR 1:1 DAR 4:3], 30 tbr, 30 tbn, 30 tbc’ stream.video? # => true stream.audio? # => false
10 11 12 13 14 15 16 17 18 |
# File 'lib/web_video/stream.rb', line 10 def initialize( = {}) .symbolize_keys! @type = [:type].to_s.downcase @codec = [:codec] @details = [:details] extract_resolution_from_details end |
Instance Attribute Details
#codec ⇒ Object
Returns the value of attribute codec.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def codec @codec end |
#details ⇒ Object
Returns the value of attribute details.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def details @details end |
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def height @height end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def type @type end |
#width ⇒ Object
Returns the value of attribute width.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def width @width end |
Instance Method Details
#audio? ⇒ Boolean
24 25 26 |
# File 'lib/web_video/stream.rb', line 24 def audio? @type == 'audio' end |
#resolution ⇒ Object
28 29 30 31 32 |
# File 'lib/web_video/stream.rb', line 28 def resolution if width && height "#{width}x#{height}" end end |
#video? ⇒ Boolean
20 21 22 |
# File 'lib/web_video/stream.rb', line 20 def video? @type == 'video' end |