Module: BMFF::Box

Defined in:
lib/bmff/box.rb,
lib/bmff/box.rb

Overview

vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:

Defined Under Namespace

Modules: Container Classes: AudioSampleEntry, Base, BitRate, ChunkLargeOffset, ChunkOffset, CleanAperture, ColourInformation, CompactSampleSize, CompositionOffset, CompositionToDecode, Copyright, DataEntryUrl, DataEntryUrn, DataInformation, DataReference, DegradationPriority, Edit, EditList, FileType, FreeSpace, Full, Handler, HintMediaHeader, HintSampleEntry, LevelAssignment, Map, Media, MediaData, MediaHeader, MediaInformation, MetaDataSampleEntry, Movie, MovieExtends, MovieExtendsHeader, MovieFragment, MovieFragmentHeader, MovieFragmentRandomAccess, MovieFragmentRandomAccessOffset, MovieHeader, NullMediaHeader, PaddingBits, PixelAspectRatio, ProgressiveDownloadInfo, SampleAuxiliaryInformationOffsets, SampleAuxiliaryInformationSizes, SampleDependencyType, SampleDescription, SampleEntry, SampleSize, SampleTable, SampleToChunk, ShadowSyncSample, SoundMediaHeader, SubSampleInformation, SyncSample, TextMetaDataSampleEntry, TimeToSample, Track, TrackExtends, TrackFragment, TrackFragmentBaseMediaDecodeTime, TrackFragmentHeader, TrackFragmentRandomAccess, TrackGroup, TrackGroupType, TrackHeader, TrackReference, TrackReferenceType, TrackRun, TrackSelection, URI, URIInit, URIMetaSampleEntry, Unknown, UserData, VideoMediaHeader, VisualSampleEntry, XMLMetaDataSampleEntry

Class Method Summary collapse

Class Method Details

.get_box(io, parent, box_class = nil) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/bmff/box.rb', line 88

def self.get_box(io, parent, box_class = nil)
  offset = io.pos
  size = io.get_uint32
  type = io.get_ascii(4)

  if box_class
    klass = box_class
  else
    klass = get_box_class(type)
  end
  box = klass.new
  box.io = io
  box.offset = offset
  box.parent = parent
  box.size = size
  box.type = type

  box.parse
  return box
end

.get_box_class(type) ⇒ Object



109
110
111
112
113
114
# File 'lib/bmff/box.rb', line 109

def self.get_box_class(type)
  if klass = Map.get_box_class(type)
    return klass
  end
  return BMFF::Box::Unknown
end