Sha256: 9a146ad4b9b932ae228c5e4924d3fb4d9b589f0a35fa3a33480207413f37f138

Contents?: true

Size: 621 Bytes

Versions: 5

Compression:

Stored size: 621 Bytes

Contents

require_relative 'boxes_reader'

module FileData
  # Finds Mpeg4 boxes within a stream
  class BoxPath
    def self.get_root_path(stream, *box_path)
      get_path(Helpers::StreamView.new(stream), *box_path)
    end

    # def self.get_box_path(box, *box_path)
    #   get_path(box.content_stream, *box_path)
    # end

    def self.get_path(stream_view, *box_path)
      match = BoxesReader.read(stream_view).find { |x| x.type == box_path[0] }

      if match.nil?
        nil
      elsif box_path.length == 1
        match
      else
        get_path(match.content_stream, *box_path[1..-1])
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
file_data-6.0.0 lib/file_data/formats/mpeg4/box_path.rb
file_data-5.2.3 lib/file_data/formats/mpeg4/box_path.rb
file_data-5.2.2 lib/file_data/formats/mpeg4/box_path.rb
file_data-5.2.1 lib/file_data/formats/mpeg4/box_path.rb
file_data-5.2.0 lib/file_data/formats/mpeg4/box_path.rb