Class: FileData::BoxPath

Inherits:
Object
  • Object
show all
Defined in:
lib/file_data/formats/mpeg4/box_path.rb

Overview

Finds Mpeg4 boxes within a stream

Class Method Summary collapse

Class Method Details

.get_path(stream_view, *box_path) ⇒ Object

def self.get_box_path(box, *box_path)

get_path(box.content_stream, *box_path)

end



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/file_data/formats/mpeg4/box_path.rb', line 14

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

.get_root_path(stream, *box_path) ⇒ Object



6
7
8
# File 'lib/file_data/formats/mpeg4/box_path.rb', line 6

def self.get_root_path(stream, *box_path)
  get_path(Helpers::StreamView.new(stream), *box_path)
end