Sha256: 406e3e82fe4f5bee1b34ffb3325f0787114b073bc073db7c3c80f30900065b4a
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
module Ffprober class Wrapper attr_reader :json def initialize(json) @json = json end def format @format ||= Ffprober::Format.new(json[:format]) end def video_streams @video_streams ||= stream_by_codec("video").map { |data| Ffprober::VideoStream.new(data) } end def audio_streams @audio_streams ||= stream_by_codec("audio").map { |data| Ffprober::AudioStream.new(data) } end def data_streams @data_streams ||= stream_by_codec("data").map { |data| Ffprober::DataStream.new(data) } end def chapters @chapters ||= json[:chapters].map { |chapter| Ffprober::Chapter.new(chapter) } end def subtitle_streams @subtitle_streams ||= stream_by_codec("subtitle").map { |stream| Ffprober::SubtitleStream.new(stream) } end private def stream_by_codec(codec_type) streams.select { |stream| stream[:codec_type] == codec_type } end def streams json[:streams] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffprober-0.5.1 | lib/ffprober/wrapper.rb |