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.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #audio? ⇒ Boolean
- #height ⇒ Object
-
#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.
- #video? ⇒ Boolean
- #width ⇒ Object
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 |
# File 'lib/web_video/stream.rb', line 10 def initialize( = {}) .symbolize_keys! @type = [:type].to_s.downcase @codec = [:codec] @details = [:details] @resolution = extract_resolution_from_details(@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 |
#resolution ⇒ Object
Returns the value of attribute resolution.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def resolution @resolution end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/web_video/stream.rb', line 3 def type @type end |
Instance Method Details
#audio? ⇒ Boolean
23 24 25 |
# File 'lib/web_video/stream.rb', line 23 def audio? @type == 'audio' end |
#height ⇒ Object
31 32 33 |
# File 'lib/web_video/stream.rb', line 31 def height @resolution ? @resolution[/\d+$/] : nil end |
#video? ⇒ Boolean
19 20 21 |
# File 'lib/web_video/stream.rb', line 19 def video? @type == 'video' end |
#width ⇒ Object
27 28 29 |
# File 'lib/web_video/stream.rb', line 27 def width @resolution ? @resolution[/^\d+/] : nil end |