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, OriginalFormat, PaddingBits, PixelAspectRatio, ProgressiveDownloadInfo, ProtectionSchemeInfo, ProtectionSystemSpecificHeader, SampleAuxiliaryInformationOffsets, SampleAuxiliaryInformationSizes, SampleDependencyType, SampleDescription, SampleEncryption, SampleEntry, SampleSize, SampleTable, SampleToChunk, SchemeInformation, SchemeType, ShadowSyncSample, SoundMediaHeader, SubSampleInformation, SyncSample, TextMetaDataSampleEntry, TimeToSample, Track, TrackEncryption, 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



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/bmff/box.rb', line 97

def self.get_box(io, parent, box_class = nil)
  offset = io.pos
  size = io.get_uint32
  type = io.get_ascii(4)
  largesize = nil
  if size == 1
    largesize = io.get_uint64
  end
  usertype = nil
  if type == 'uuid'
    usertype = io.get_uuid
  end

  if box_class
    klass = box_class
  else
    if usertype
      klass = get_uuid_box_class(usertype)
    else
      klass = get_box_class(type)
    end
  end
  klass ||= BMFF::Box::Unknown
  box = klass.new
  box.io = io
  box.offset = offset
  box.parent = parent
  box.size = size
  box.type = type
  box.largesize = largesize
  box.usertype = usertype

  box.parse
  return box
end

.get_box_class(type) ⇒ Object



133
134
135
# File 'lib/bmff/box.rb', line 133

def self.get_box_class(type)
  Map.get_box_class(type)
end

.get_uuid_box_class(uuid) ⇒ Object



137
138
139
# File 'lib/bmff/box.rb', line 137

def self.get_uuid_box_class(uuid)
  Map.get_uuid_box_class(uuid)
end