Class: BMFF::Box::Base
- Inherits:
-
Object
- Object
- BMFF::Box::Base
- Defined in:
- lib/bmff/box/base.rb
Overview
vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
Direct Known Subclasses
BitRate, CleanAperture, ColourInformation, DataInformation, Edit, FileType, FreeSpace, Full, Media, MediaData, MediaInformation, Movie, MovieExtends, MovieFragment, MovieFragmentRandomAccess, OriginalFormat, PixelAspectRatio, ProtectionSchemeInfo, SampleEntry, SampleTable, SchemeInformation, Track, TrackFragment, TrackGroup, TrackReference, TrackReferenceType, Unknown, UserData
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
-
#largesize ⇒ Object
Returns the value of attribute largesize.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
Returns the value of attribute type.
-
#usertype ⇒ Object
Returns the value of attribute usertype.
Class Method Summary collapse
Instance Method Summary collapse
- #actual_size ⇒ Object
- #container? ⇒ Boolean
-
#eob? ⇒ Boolean
end of box?.
- #parse ⇒ Object
- #parse_data ⇒ Object
- #remaining_size ⇒ Object
- #root ⇒ Object
- #seek_to_end ⇒ Object
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def io @io end |
#largesize ⇒ Object
Returns the value of attribute largesize.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def largesize @largesize end |
#offset ⇒ Object
Returns the value of attribute offset.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def offset @offset end |
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def parent @parent end |
#size ⇒ Object
Returns the value of attribute size.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def size @size end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def type @type end |
#usertype ⇒ Object
Returns the value of attribute usertype.
5 6 7 |
# File 'lib/bmff/box/base.rb', line 5 def usertype @usertype end |
Class Method Details
.register_box(*boxtypes) ⇒ Object
8 9 10 11 12 |
# File 'lib/bmff/box/base.rb', line 8 def self.register_box(*boxtypes) boxtypes.each do |boxtype| BMFF::Box::Map.register_box(boxtype, self) end end |
.register_uuid_box(uuid) ⇒ Object
14 15 16 |
# File 'lib/bmff/box/base.rb', line 14 def self.register_uuid_box(uuid) BMFF::Box::Map.register_uuid_box(uuid, self) end |
Instance Method Details
#actual_size ⇒ Object
18 19 20 21 22 |
# File 'lib/bmff/box/base.rb', line 18 def actual_size return largesize if size == 1 return nil if size == 0 return size end |
#container? ⇒ Boolean
61 62 63 |
# File 'lib/bmff/box/base.rb', line 61 def container? false end |
#eob? ⇒ Boolean
end of box?
32 33 34 35 36 37 38 |
# File 'lib/bmff/box/base.rb', line 32 def eob? if actual_size return io.pos >= offset + actual_size else return io.eof? end end |
#parse ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/bmff/box/base.rb', line 48 def parse parse_data if actual_size if io.pos > offset + actual_size raise RangeError, "Given box size is smaller than expected." end end seek_to_end end |
#parse_data ⇒ Object
58 59 |
# File 'lib/bmff/box/base.rb', line 58 def parse_data end |
#remaining_size ⇒ Object
24 25 26 27 28 29 |
# File 'lib/bmff/box/base.rb', line 24 def remaining_size if actual_size return (offset + actual_size) - io.pos end nil end |
#root ⇒ Object
65 66 67 68 69 |
# File 'lib/bmff/box/base.rb', line 65 def root ancestor = parent ancestor = ancestor.parent while ancestor.respond_to?(:parent) && ancestor.parent ancestor end |
#seek_to_end ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/bmff/box/base.rb', line 40 def seek_to_end if actual_size io.pos = offset + actual_size else io.seek(0, IO::SEEK_END) end end |