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