Class: FormatParser::MOVParser

Inherits:
Object
  • Object
show all
Includes:
IOUtils, ISOBaseMediaFileFormat::Utils
Defined in:
lib/parsers/mov_parser.rb

Defined Under Namespace

Classes: Decoder

Constant Summary collapse

MAGIC_BYTES =
'ftypqt  '
MOV_MIME_TYPE =
'video/quicktime'

Constants included from ISOBaseMediaFileFormat::Utils

ISOBaseMediaFileFormat::Utils::IDENTITY_MATRIX

Constants included from IOUtils

IOUtils::INTEGER_DIRECTIVES

Instance Method Summary collapse

Methods included from ISOBaseMediaFileFormat::Utils

#dimensions, #duration, #frame_rate, #video_codecs

Methods included from IOUtils

#read_bytes, #read_fixed_point, #read_int, #safe_read, #safe_skip, #skip_bytes

Instance Method Details

#call(io) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/parsers/mov_parser.rb', line 15

def call(io)
  @buf = FormatParser::IOConstraint.new(io)

  return unless matches_mov_definition?

  box_tree = Measurometer.instrument('format_parser.mov_parser.decoder.build_box_tree') do
    Decoder.new.build_box_tree(0xffffffff, @buf)
  end

  width, height = dimensions(box_tree)

  FormatParser::Video.new(
    format: :mov,
    width_px: width,
    height_px: height,
    frame_rate: frame_rate(box_tree),
    media_duration_seconds: duration(box_tree),
    content_type: MOV_MIME_TYPE,
    codecs: video_codecs(box_tree),
    intrinsics: box_tree
  )
end

#likely_match?(filename) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/parsers/mov_parser.rb', line 11

def likely_match?(filename)
  /\.(mov|moov|qt)$/i.match?(filename)
end