Class: FFProbe::Result
- Inherits:
-
Object
- Object
- FFProbe::Result
- Defined in:
- lib/ffprobe/result.rb
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#file ⇒ Object
Returns the value of attribute file.
-
#frames ⇒ Object
Returns the value of attribute frames.
-
#packets ⇒ Object
Returns the value of attribute packets.
-
#pretty ⇒ Object
(also: #pretty?)
Returns the value of attribute pretty.
-
#streams ⇒ Object
Returns the value of attribute streams.
-
#success ⇒ Object
(also: #success?)
Returns the value of attribute success.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#units ⇒ Object
(also: #units?)
Returns the value of attribute units.
Class Method Summary collapse
Instance Method Summary collapse
- #audio? ⇒ Boolean
- #has_audio? ⇒ Boolean
- #has_video? ⇒ Boolean
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #video? ⇒ Boolean
Constructor Details
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
36 37 38 |
# File 'lib/ffprobe/result.rb', line 36 def extra @extra end |
#file ⇒ Object
Returns the value of attribute file.
31 32 33 |
# File 'lib/ffprobe/result.rb', line 31 def file @file end |
#frames ⇒ Object
Returns the value of attribute frames.
32 33 34 |
# File 'lib/ffprobe/result.rb', line 32 def frames @frames end |
#packets ⇒ Object
Returns the value of attribute packets.
33 34 35 |
# File 'lib/ffprobe/result.rb', line 33 def packets @packets end |
#pretty ⇒ Object Also known as: pretty?
Returns the value of attribute pretty.
38 39 40 |
# File 'lib/ffprobe/result.rb', line 38 def pretty @pretty end |
#streams ⇒ Object
Returns the value of attribute streams.
34 35 36 |
# File 'lib/ffprobe/result.rb', line 34 def streams @streams end |
#success ⇒ Object Also known as: success?
Returns the value of attribute success.
41 42 43 |
# File 'lib/ffprobe/result.rb', line 41 def success @success end |
#tags ⇒ Object
Returns the value of attribute tags.
35 36 37 |
# File 'lib/ffprobe/result.rb', line 35 def @tags end |
#units ⇒ Object Also known as: units?
Returns the value of attribute units.
44 45 46 |
# File 'lib/ffprobe/result.rb', line 44 def units @units end |
Class Method Details
.from_hash(hash, units = false) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ffprobe/result.rb', line 9 def self.from_hash(hash,units=false) target = new target.units = units hash.each do |key,value| case key when :FILE target.file = FileInfo.from_hash(value[0], units) when :FRAME target.frames += value.map {|f| FrameInfo.from_hash(f, units) } when :PACKET target.packets += value.map {|p| PacketInfo.from_hash(p, units) } when :STREAM target.streams += value.map {|s| StreamInfo.from_hash(s, units) } when :TAGS target. = TagsInfo.from_hash(value[0], units) when :EXTRA target.extra = Array.new(value) end end target end |
Instance Method Details
#audio? ⇒ Boolean
68 69 70 |
# File 'lib/ffprobe/result.rb', line 68 def audio? @streams.length == 1 && has_audio? end |
#has_audio? ⇒ Boolean
64 65 66 |
# File 'lib/ffprobe/result.rb', line 64 def has_audio? @streams.first {|s| s.codec_type == "audio" } end |
#has_video? ⇒ Boolean
56 57 58 |
# File 'lib/ffprobe/result.rb', line 56 def has_video? @streams.first {|s| s.codec_type == "video" } end |
#video? ⇒ Boolean
60 61 62 |
# File 'lib/ffprobe/result.rb', line 60 def video? @streams.length == 1 && has_video? end |