Tawara  0.1.0
Public Types | Public Member Functions | List of all members
tawara::Block Class Referenceabstract

Block interface. More...

#include <tawara/block.h>

Inheritance diagram for tawara::Block:
Inheritance graph
[legend]
Collaboration diagram for tawara::Block:
Collaboration graph
[legend]

Public Types

enum  LacingType { LACING_NONE, LACING_EBML, LACING_FIXED }
 Lacing types. More...
 
typedef boost::shared_ptr< BlockPtr
 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< FrameFramePtr
 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_typeat (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_typeoperator[] (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...
 

Detailed Description

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.

Definition at line 59 of file block.h.

Member Typedef Documentation

The constant random access iterator type.

Definition at line 93 of file block.h.

The constant reference type.

Definition at line 89 of file block.h.

The constant reversed random access iterator type.

Definition at line 98 of file block.h.

typedef boost::shared_ptr<Block const> tawara::Block::ConstPtr

Constant pointer to a block.

Definition at line 66 of file block.h.

typedef std::vector<char> tawara::Block::Frame

The type of a single frame of data.

Definition at line 79 of file block.h.

typedef boost::shared_ptr<Frame> tawara::Block::FramePtr

A pointer to a frame of data.

Definition at line 81 of file block.h.

typedef std::vector<FramePtr>::iterator tawara::Block::iterator

The random access iterator type.

Definition at line 91 of file block.h.

typedef boost::shared_ptr<Block> tawara::Block::Ptr

Pointer to a block.

Definition at line 64 of file block.h.

The reference type.

Definition at line 87 of file block.h.

The reversed random access iterator type.

Definition at line 95 of file block.h.

The size type of this container.

Definition at line 85 of file block.h.

The value type of this container.

Definition at line 83 of file block.h.

Member Enumeration Documentation

Lacing types.

Enumerator
LACING_NONE 

No lacing.

LACING_EBML 

EBML-style lacing.

LACING_FIXED 

Fixed-size lacing.

Definition at line 69 of file block.h.

Constructor & Destructor Documentation

tawara::Block::Block ( uint64_t  track_number,
int16_t  timecode,
LacingType  lacing = LACING_NONE 
)
inline

Constructor.

Parameters
[in]track_numberThe track number this block belongs to.
[in]timecodeThe timecode of this block.
[in]lacingThe type of lacing to use.

Definition at line 106 of file block.h.

virtual tawara::Block::~Block ( )
pure virtual

Desctructor.

Member Function Documentation

virtual value_type& tawara::Block::at ( size_type  pos)
pure virtual

Get the frame at the given position, with bounds checking.

Returns
A reference to the specified frame's data.
Exceptions
std::out_of_rangeif the position is invalid.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual value_type const& tawara::Block::at ( size_type  pos) const
pure virtual

Get the frame at the given position, with bounds checking.

Returns
A reference to the specified frame's data.
Exceptions
std::out_of_rangeif the position is invalid.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual iterator tawara::Block::begin ( )
pure virtual

Get an iterator to the first frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual const_iterator tawara::Block::begin ( ) const
pure virtual

Get an iterator to the first frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::clear ( )
pure virtual

Remove all frames.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual size_type tawara::Block::count ( ) const
pure virtual

Get the number of frames.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual bool tawara::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 tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual iterator tawara::Block::end ( )
pure virtual

Get an iterator to the position past the last frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual const_iterator tawara::Block::end ( ) const
pure virtual

Get an iterator to the position past the last frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::erase ( iterator  position)
pure virtual

Erase the frame at the specified iterator.

Parameters
[in]positionThe position to erase at.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::erase ( iterator  first,
iterator  last 
)
pure virtual

Erase a range of frames.

Parameters
[in]firstThe start of the range.
[in]lastThe end of the range.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual bool tawara::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 tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::invisible ( bool  invisible)
pure virtual

Set if this block is invisible.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual LacingType tawara::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 tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::lacing ( LacingType  lacing)
pure virtual

Set the lacing type in use.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual size_type tawara::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 tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual value_type& tawara::Block::operator[] ( size_type  pos)
pure virtual

Get a reference to a frame.

No bounds checking is performed.

Returns
A reference to the binary data of a frame stored in this block.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual value_type const& tawara::Block::operator[] ( size_type  pos) const
pure virtual

Get a reference to a frame.

No bounds checking is performed.

Returns
A reference to the binary data of a frame stored in this block.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::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.

Exceptions
MaxLaceSizeExceededif the new size is incompatible with the lacing type.
EmptyFrameif the frame data is empty.

Implemented in tawara::BlockGroup, and tawara::SimpleBlock.

virtual reverse_iterator tawara::Block::rbegin ( )
pure virtual

Get a reverse iterator to the last frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual const_reverse_iterator tawara::Block::rbegin ( ) const
pure virtual

Get a reverse iterator to the last frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual reverse_iterator tawara::Block::rend ( )
pure virtual

Get a reverse iterator to the position before the first frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual const_reverse_iterator tawara::Block::rend ( ) const
pure virtual

Get a reverse iterator to the position before the first frame.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::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.

Exceptions
MaxLaceSizeExceededif the new size is incompatible with the lacing type.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::swap ( Block other)
inlinevirtual

Swaps the contents of this block with another.

Parameters
[in]otherThe other block to swap with.

Definition at line 273 of file block.h.

virtual int16_t tawara::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 tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::timecode ( int16_t  timecode)
pure virtual

Set the block's timecode.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual uint64_t tawara::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 tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.

virtual void tawara::Block::track_number ( uint64_t  track_number)
pure virtual

Set the block's track number.

Implemented in tawara::BlockGroup, tawara::SimpleBlock, and tawara::BlockImpl.


The documentation for this class was generated from the following file: