Class: Ffprober::Wrapper
- Inherits:
-
Object
- Object
- Ffprober::Wrapper
- Extended by:
- T::Sig
- 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.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ffprober/wrapper.rb', line 15 def initialize(json) raise FfprobeError, json[:error] if json[:error] @json = json @format = T.let(Format.new(json[:format]), Ffprober::Format) @video_streams = T.let(nil, T.nilable(T::Array[Ffprober::VideoStream])) @audio_streams = T.let(nil, T.nilable(T::Array[Ffprober::AudioStream])) @data_streams = T.let(nil, T.nilable(T::Array[Ffprober::DataStream])) @subtitle_streams = T.let(nil, T.nilable(T::Array[Ffprober::SubtitleStream])) @chapters = T.let(nil, T.nilable(T::Array[Ffprober::Chapter])) end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
11 12 13 |
# File 'lib/ffprober/wrapper.rb', line 11 def format @format end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
8 9 10 |
# File 'lib/ffprober/wrapper.rb', line 8 def json @json end |
Instance Method Details
#audio_streams ⇒ Object
36 37 38 39 40 |
# File 'lib/ffprober/wrapper.rb', line 36 def audio_streams @audio_streams ||= stream_by_codec('audio').map do |data| AudioStream.new(data) end end |
#chapters ⇒ Object
50 51 52 |
# File 'lib/ffprober/wrapper.rb', line 50 def chapters @chapters ||= json[:chapters].map { |chapter| Chapter.new(chapter) } end |
#data_streams ⇒ Object
43 44 45 46 47 |
# File 'lib/ffprober/wrapper.rb', line 43 def data_streams @data_streams ||= stream_by_codec('data').map do |data| DataStream.new(data) end end |
#subtitle_streams ⇒ Object
55 56 57 58 59 |
# File 'lib/ffprober/wrapper.rb', line 55 def subtitle_streams @subtitle_streams ||= stream_by_codec('subtitle').map do |stream| SubtitleStream.new(stream) end end |
#video_streams ⇒ Object
29 30 31 32 33 |
# File 'lib/ffprober/wrapper.rb', line 29 def video_streams @video_streams ||= stream_by_codec('video').map do |data| VideoStream.new(data) end end |