Tide 0.1.0
|
#include <tide/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. | |
typedef boost::shared_ptr < Block const > | ConstPtr |
Constant pointer to a block. | |
typedef std::vector< char > | Frame |
The type of a single frame of data. | |
typedef boost::shared_ptr< Frame > | FramePtr |
A pointer to a frame of data. | |
typedef std::vector< FramePtr > ::value_type | value_type |
The value type of this container. | |
typedef std::vector< FramePtr > ::size_type | size_type |
The size type of this container. | |
typedef std::vector< FramePtr > ::reference | reference |
The reference type. | |
typedef std::vector< FramePtr > ::const_reference | const_reference |
The constant reference type. | |
typedef std::vector< FramePtr > ::iterator | iterator |
The random access iterator type. | |
typedef std::vector< FramePtr > ::const_iterator | const_iterator |
The constant random access iterator type. | |
typedef std::vector< FramePtr > ::reverse_iterator | reverse_iterator |
The reversed random access iterator type. | |
typedef std::vector< FramePtr > ::const_reverse_iterator | const_reverse_iterator |
The constant reversed random access iterator type. | |
Public Member Functions | |
Block (uint64_t track_number, int16_t timecode, LacingType lacing=LACING_NONE) | |
Constructor. | |
virtual | ~Block ()=0 |
Desctructor. | |
virtual uint64_t | track_number () const =0 |
The block's track number. | |
virtual void | track_number (uint64_t track_number)=0 |
Set the block's track number. | |
virtual int16_t | timecode () const =0 |
The timecode of this block. | |
virtual void | timecode (int16_t timecode)=0 |
Set the block's timecode. | |
virtual bool | invisible () const =0 |
If this block is invisible. | |
virtual void | invisible (bool invisible)=0 |
Set if this block is invisible. | |
virtual LacingType | lacing () const =0 |
Get the lacing type in use. | |
virtual void | lacing (LacingType lacing)=0 |
Set the lacing type in use. | |
virtual value_type & | at (size_type pos)=0 |
Get the frame at the given position, with bounds checking. | |
virtual value_type const & | at (size_type pos) const =0 |
Get the frame at the given position, with bounds checking. | |
virtual value_type & | operator[] (size_type pos)=0 |
Get a reference to a frame. | |
virtual value_type const & | operator[] (size_type pos) const =0 |
Get a reference to a frame. | |
virtual iterator | begin ()=0 |
Get an iterator to the first frame. | |
virtual const_iterator | begin () const =0 |
Get an iterator to the first frame. | |
virtual iterator | end ()=0 |
Get an iterator to the position past the last frame. | |
virtual const_iterator | end () const =0 |
Get an iterator to the position past the last frame. | |
virtual reverse_iterator | rbegin ()=0 |
Get a reverse iterator to the last frame. | |
virtual const_reverse_iterator | rbegin () const =0 |
Get a reverse iterator to the last frame. | |
virtual reverse_iterator | rend ()=0 |
Get a reverse iterator to the position before the first frame. | |
virtual const_reverse_iterator | rend () const =0 |
Get a reverse iterator to the position before the first frame. | |
virtual bool | empty () const =0 |
Check if there are no frames. | |
virtual size_type | count () const =0 |
Get the number of frames. | |
virtual size_type | max_count () const =0 |
Get the maximum number of frames. | |
virtual void | clear ()=0 |
Remove all frames. | |
virtual void | erase (iterator position)=0 |
Erase the frame at the specified iterator. | |
virtual void | erase (iterator first, iterator last)=0 |
Erase a range of frames. | |
virtual void | push_back (value_type const &value)=0 |
Add a frame to this block. | |
virtual void | resize (size_type count)=0 |
Resizes the frames storage. | |
virtual void | swap (Block &other) |
Swaps the contents of this block with another. |
Block interface.
The Block interface defines the functionality of a Tide 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 tide::Block::const_iterator |
typedef std::vector<FramePtr>::const_reference tide::Block::const_reference |
typedef std::vector<FramePtr>::const_reverse_iterator tide::Block::const_reverse_iterator |
typedef boost::shared_ptr<Block const> tide::Block::ConstPtr |
typedef std::vector<char> tide::Block::Frame |
typedef boost::shared_ptr<Frame> tide::Block::FramePtr |
typedef std::vector<FramePtr>::iterator tide::Block::iterator |
typedef boost::shared_ptr<Block> tide::Block::Ptr |
typedef std::vector<FramePtr>::reference tide::Block::reference |
typedef std::vector<FramePtr>::reverse_iterator tide::Block::reverse_iterator |
typedef std::vector<FramePtr>::size_type tide::Block::size_type |
typedef std::vector<FramePtr>::value_type tide::Block::value_type |
The value type of this container.
Reimplemented in tide::BlockImpl.
tide::Block::Block | ( | uint64_t | track_number, |
int16_t | timecode, | ||
LacingType | lacing = LACING_NONE |
||
) | [inline] |
virtual tide::Block::~Block | ( | ) | [pure virtual] |
Desctructor.
virtual value_type& tide::Block::at | ( | size_type | pos | ) | [pure virtual] |
Get the frame at the given position, with bounds checking.
std::out_of_range | if the position is invalid. |
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual value_type const& tide::Block::at | ( | size_type | pos | ) | const [pure virtual] |
Get the frame at the given position, with bounds checking.
std::out_of_range | if the position is invalid. |
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual iterator tide::Block::begin | ( | ) | [pure virtual] |
Get an iterator to the first frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual const_iterator tide::Block::begin | ( | ) | const [pure virtual] |
Get an iterator to the first frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::clear | ( | ) | [pure virtual] |
Remove all frames.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual size_type tide::Block::count | ( | ) | const [pure virtual] |
Get the number of frames.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual bool tide::Block::empty | ( | ) | const [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual const_iterator tide::Block::end | ( | ) | const [pure virtual] |
Get an iterator to the position past the last frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual iterator tide::Block::end | ( | ) | [pure virtual] |
Get an iterator to the position past the last frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::erase | ( | iterator | position | ) | [pure virtual] |
Erase the frame at the specified iterator.
[in] | position | The position to erase at. |
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
Erase a range of frames.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual bool tide::Block::invisible | ( | ) | const [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::invisible | ( | bool | invisible | ) | [pure virtual] |
Set if this block is invisible.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::lacing | ( | LacingType | lacing | ) | [pure virtual] |
Set the lacing type in use.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual LacingType tide::Block::lacing | ( | ) | const [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual size_type tide::Block::max_count | ( | ) | const [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual value_type& tide::Block::operator[] | ( | size_type | pos | ) | [pure virtual] |
Get a reference to a frame.
No bounds checking is performed.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual value_type const& tide::Block::operator[] | ( | size_type | pos | ) | const [pure virtual] |
Get a reference to a frame.
No bounds checking is performed.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::push_back | ( | value_type const & | value | ) | [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual reverse_iterator tide::Block::rbegin | ( | ) | [pure virtual] |
Get a reverse iterator to the last frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual const_reverse_iterator tide::Block::rbegin | ( | ) | const [pure virtual] |
Get a reverse iterator to the last frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual reverse_iterator tide::Block::rend | ( | ) | [pure virtual] |
Get a reverse iterator to the position before the first frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual const_reverse_iterator tide::Block::rend | ( | ) | const [pure virtual] |
Get a reverse iterator to the position before the first frame.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::resize | ( | size_type | count | ) | [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::swap | ( | Block & | other | ) | [inline, virtual] |
virtual int16_t tide::Block::timecode | ( | ) | const [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::timecode | ( | int16_t | timecode | ) | [pure virtual] |
Set the block's timecode.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual uint64_t tide::Block::track_number | ( | ) | const [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 tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.
virtual void tide::Block::track_number | ( | uint64_t | track_number | ) | [pure virtual] |
Set the block's track number.
Implemented in tide::BlockGroup, tide::BlockImpl, and tide::SimpleBlock.