Class: Ffprober::Wrapper
- Inherits:
-
Object
- Object
- Ffprober::Wrapper
- Defined in:
- lib/ffprober/wrapper.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Instance Method Summary collapse
- #audio_streams ⇒ Object
- #chapters ⇒ Object
- #data_streams ⇒ Object
- #format ⇒ Object
-
#initialize(json) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #subtitle_streams ⇒ Object
- #video_streams ⇒ Object
Constructor Details
#initialize(json) ⇒ Wrapper
Returns a new instance of Wrapper.
7 8 9 10 |
# File 'lib/ffprober/wrapper.rb', line 7 def initialize(json) raise FfprobeError, json[:error] if json[:error] @json = json end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
5 6 7 |
# File 'lib/ffprober/wrapper.rb', line 5 def json @json end |
Instance Method Details
#audio_streams ⇒ Object
22 23 24 25 26 |
# File 'lib/ffprober/wrapper.rb', line 22 def audio_streams @audio_streams ||= stream_by_codec('audio').map do |data| AudioStream.new(data) end end |
#chapters ⇒ Object
34 35 36 |
# File 'lib/ffprober/wrapper.rb', line 34 def chapters @chapters ||= json[:chapters].map { |chapter| Chapter.new(chapter) } end |
#data_streams ⇒ Object
28 29 30 31 32 |
# File 'lib/ffprober/wrapper.rb', line 28 def data_streams @data_streams ||= stream_by_codec('data').map do |data| DataStream.new(data) end end |
#format ⇒ Object
12 13 14 |
# File 'lib/ffprober/wrapper.rb', line 12 def format @format ||= Format.new(json[:format]) end |
#subtitle_streams ⇒ Object
38 39 40 41 42 |
# File 'lib/ffprober/wrapper.rb', line 38 def subtitle_streams @subtitle_streams ||= stream_by_codec('subtitle').map do |stream| SubtitleStream.new(stream) end end |
#video_streams ⇒ Object
16 17 18 19 20 |
# File 'lib/ffprober/wrapper.rb', line 16 def video_streams @video_streams ||= stream_by_codec('video').map do |data| VideoStream.new(data) end end |