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, PixelAspectRatio, SampleEntry, SampleTable, 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
- #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 |
Instance Method Details
#actual_size ⇒ Object
14 15 16 17 18 |
# File 'lib/bmff/box/base.rb', line 14 def actual_size return largesize if size == 1 return nil if size == 0 return size end |
#container? ⇒ Boolean
63 64 65 |
# File 'lib/bmff/box/base.rb', line 63 def container? false end |
#eob? ⇒ Boolean
end of box?
28 29 30 31 32 33 34 |
# File 'lib/bmff/box/base.rb', line 28 def eob? if actual_size return io.pos >= offset + actual_size else return io.eof? end end |
#parse ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/bmff/box/base.rb', line 44 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
54 55 56 57 58 59 60 61 |
# File 'lib/bmff/box/base.rb', line 54 def parse_data if size == 1 @largesize = io.get_uint64 end if type == 'uuid' @usertype = io.get_uuid end end |
#remaining_size ⇒ Object
20 21 22 23 24 25 |
# File 'lib/bmff/box/base.rb', line 20 def remaining_size if actual_size return (offset + actual_size) - io.pos end nil end |
#seek_to_end ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/bmff/box/base.rb', line 36 def seek_to_end if actual_size io.pos = offset + actual_size else io.seek(0, IO::SEEK_END) end end |