Tawara
0.1.0
|
#include <tawara/block.h>
Public Types | |
enum | LacingType { LACING_NONE, LACING_EBML, LACING_FIXED } |
Lacing types. More... | |
typedef boost::shared_ptr< Block > | Ptr |
Pointer to a block. More... | |
typedef boost::shared_ptr < Block const > | ConstPtr |
Constant pointer to a block. More... | |
typedef std::vector< char > | Frame |
The type of a single frame of data. More... | |
typedef boost::shared_ptr< Frame > | FramePtr |
A pointer to a frame of data. More... | |
typedef std::vector< FramePtr > ::value_type | value_type |
The value type of this container. More... | |
typedef std::vector< FramePtr > ::size_type | size_type |
The size type of this container. More... | |
typedef std::vector< FramePtr > ::reference | reference |
The reference type. More... | |
typedef std::vector< FramePtr > ::const_reference | const_reference |
The constant reference type. More... | |
typedef std::vector< FramePtr > ::iterator | iterator |
The random access iterator type. More... | |
typedef std::vector< FramePtr > ::const_iterator | const_iterator |
The constant random access iterator type. More... | |
typedef std::vector< FramePtr > ::reverse_iterator | reverse_iterator |
The reversed random access iterator type. More... | |
typedef std::vector< FramePtr > ::const_reverse_iterator | const_reverse_iterator |
The constant reversed random access iterator type. More... | |
Public Member Functions | |
Block (uint64_t track_number, int16_t timecode, LacingType lacing=LACING_NONE) | |
Constructor. More... | |
virtual | ~Block ()=0 |
Desctructor. More... | |
virtual uint64_t | track_number () const =0 |
The block's track number. More... | |
virtual void | track_number (uint64_t track_number)=0 |
Set the block's track number. More... | |
virtual int16_t | timecode () const =0 |
The timecode of this block. More... | |
virtual void | timecode (int16_t timecode)=0 |
Set the block's timecode. More... | |
virtual bool | invisible () const =0 |
If this block is invisible. More... | |
virtual void | invisible (bool invisible)=0 |
Set if this block is invisible. More... | |
virtual LacingType | lacing () const =0 |
Get the lacing type in use. More... | |
virtual void | lacing (LacingType lacing)=0 |
Set the lacing type in use. More... | |
virtual value_type & | at (size_type pos)=0 |
Get the frame at the given position, with bounds checking. More... | |
virtual value_type const & | at (size_type pos) const =0 |
Get the frame at the given position, with bounds checking. More... | |
virtual value_type & | operator[] (size_type pos)=0 |
Get a reference to a frame. More... | |
virtual value_type const & | operator[] (size_type pos) const =0 |
Get a reference to a frame. More... | |
virtual iterator | begin ()=0 |
Get an iterator to the first frame. More... | |
virtual const_iterator | begin () const =0 |
Get an iterator to the first frame. More... | |
virtual iterator | end ()=0 |
Get an iterator to the position past the last frame. More... | |
virtual const_iterator | end () const =0 |
Get an iterator to the position past the last frame. More... | |
virtual reverse_iterator | rbegin ()=0 |
Get a reverse iterator to the last frame. More... | |
virtual const_reverse_iterator | rbegin () const =0 |
Get a reverse iterator to the last frame. More... | |
virtual reverse_iterator | rend ()=0 |
Get a reverse iterator to the position before the first frame. More... | |
virtual const_reverse_iterator | rend () const =0 |
Get a reverse iterator to the position before the first frame. More... | |
virtual bool | empty () const =0 |
Check if there are no frames. More... | |
virtual size_type | count () const =0 |
Get the number of frames. More... | |
virtual size_type | max_count () const =0 |
Get the maximum number of frames. More... | |
virtual void | clear ()=0 |
Remove all frames. More... | |
virtual void | erase (iterator position)=0 |
Erase the frame at the specified iterator. More... | |
virtual void | erase (iterator first, iterator last)=0 |
Erase a range of frames. More... | |
virtual void | push_back (value_type const &value)=0 |
Add a frame to this block. More... | |
virtual void | resize (size_type count)=0 |
Resizes the frames storage. More... | |
virtual void | swap (Block &other) |
Swaps the contents of this block with another. More... | |
Block interface.
The Block interface defines the functionality of a Tawara block. A block is the storage for one (or sometimes more than one, if lacing is used) frame of data.
typedef std::vector<FramePtr>::const_iterator tawara::Block::const_iterator |
typedef std::vector<FramePtr>::const_reference tawara::Block::const_reference |
typedef std::vector<FramePtr>::const_reverse_iterator tawara::Block::const_reverse_iterator |
typedef boost::shared_ptr<Block const> tawara::Block::ConstPtr |
typedef std::vector<char> tawara::Block::Frame |
typedef boost::shared_ptr<Frame> tawara::Block::FramePtr |
typedef std::vector<FramePtr>::iterator tawara::Block::iterator |
typedef boost::shared_ptr<Block> tawara::Block::Ptr |
typedef std::vector<FramePtr>::reference tawara::Block::reference |
typedef std::vector<FramePtr>::reverse_iterator tawara::Block::reverse_iterator |
typedef std::vector<FramePtr>::size_type tawara::Block::size_type |
typedef std::vector<FramePtr>::value_type tawara::Block::value_type |
|
inline |
|
pure virtual |
Desctructor.
|
pure virtual |
Get the frame at the given position, with bounds checking.
std::out_of_range | if the position is invalid. |
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get the frame at the given position, with bounds checking.
std::out_of_range | if the position is invalid. |
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get an iterator to the first frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get an iterator to the first frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Remove all frames.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get the number of frames.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Check if there are no frames.
Empty blocks cannot be written. If this returns true, an error will occur when write() is called.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get an iterator to the position past the last frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get an iterator to the position past the last frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Erase the frame at the specified iterator.
[in] | position | The position to erase at. |
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
Erase a range of frames.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
If this block is invisible.
Invisible blocks should be decoded by the codec (thus updating codec state) but not used for playback.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Set if this block is invisible.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get the lacing type in use.
The data in a block is typically a single frame, but sometimes multiple frames may be stored. This is called "lacing," and is usually used to reduce overhead when the size of the data itself is small. However, lacing also reduces seekability of the file, so laces should usually be kept small. A common number is up to three frames in a lace.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Set the lacing type in use.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get the maximum number of frames.
If lacing is not enabled, this will always return 1.
If lacing is enabled, this will be the maximum number of frames that can be stored in a lace within a single block.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get a reference to a frame.
No bounds checking is performed.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get a reference to a frame.
No bounds checking is performed.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Add a frame to this block.
When lacing is enabled, this will append an additional frame to the block to be stored.
When lacing is not enabled, the value of frame_count() must be zero or an error will occur.
MaxLaceSizeExceeded | if the new size is incompatible with the lacing type. |
EmptyFrame | if the frame data is empty. |
Implemented in tawara::BlockGroup, and tawara::SimpleBlock.
|
pure virtual |
Get a reverse iterator to the last frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get a reverse iterator to the last frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get a reverse iterator to the position before the first frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Get a reverse iterator to the position before the first frame.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Resizes the frames storage.
When lacing is not enabled, the new size must be 1 or an error will occur.
If the current size is less than the new size, additional empty frames will be added. These should be filled with data before calling write() or an error will occur.
If the current size is greater than the new size, frames past the new end will be dropped.
MaxLaceSizeExceeded | if the new size is incompatible with the lacing type. |
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
inlinevirtual |
|
pure virtual |
The timecode of this block.
Each block has a timecode relative to its containing cluster. It is measured in the units specified by the containing segment's TimecodeScale, and is a 16-bit signed integer.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Set the block's timecode.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
The block's track number.
This property specifies the track that this block belongs to. The data stored in the block should be interpreted by the codec for its track.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.
|
pure virtual |
Set the block's track number.
Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.