Class: VCSRuby::LibAVVideoStream
- Inherits:
-
Object
- Object
- VCSRuby::LibAVVideoStream
- Defined in:
- lib/libAV/libav_video_stream.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #aspect_ratio ⇒ Object
- #bit_rate ⇒ Object
- #codec(short = false) ⇒ Object
- #color_space ⇒ Object
- #frame_rate ⇒ Object
- #height ⇒ Object
-
#initialize(video_stream) ⇒ LibAVVideoStream
constructor
A new instance of LibAVVideoStream.
- #width ⇒ Object
Constructor Details
#initialize(video_stream) ⇒ LibAVVideoStream
Returns a new instance of LibAVVideoStream.
11 12 13 |
# File 'lib/libAV/libav_video_stream.rb', line 11 def initialize video_stream @raw = video_stream end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/libAV/libav_video_stream.rb', line 9 def raw @raw end |
Instance Method Details
#aspect_ratio ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/libAV/libav_video_stream.rb', line 52 def aspect_ratio return nil if @raw['display_aspect_ratio'] == nil colon = ":" if @raw['display_aspect_ratio'].include? colon w,h = @raw['display_aspect_ratio'].split(colon).map { |n| n.to_i } Rational(w,h) else @raw['display_aspect_ratio'].to_f end end |
#bit_rate ⇒ Object
39 40 41 |
# File 'lib/libAV/libav_video_stream.rb', line 39 def bit_rate @raw['bit_rate'].to_i end |
#codec(short = false) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/libAV/libav_video_stream.rb', line 23 def codec short = false if short @raw['codec_name'] else @raw['codec_long_name'] end end |
#color_space ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/libAV/libav_video_stream.rb', line 31 def color_space if ["unknown", "", nil].include? @raw['color_space'] @raw['pix_fmt'] else @raw['color_space'] end end |
#frame_rate ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/libAV/libav_video_stream.rb', line 44 def frame_rate if @raw['r_frame_rate'] @raw['r_frame_rate'].to_r elsif @raw['avg_frame_rate'] @raw['avg_frame_rate'].to_r end end |
#height ⇒ Object
19 20 21 |
# File 'lib/libAV/libav_video_stream.rb', line 19 def height @raw['height'].to_i end |
#width ⇒ Object
15 16 17 |
# File 'lib/libAV/libav_video_stream.rb', line 15 def width @raw['width'].to_i end |