Tide 0.1.0
Public Types | Public Member Functions

tide::Block Class Reference

Block interface. More...

#include <tide/block.h>

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

List of all members.

Public Types

enum  LacingType { LACING_NONE, LACING_EBML, LACING_FIXED }
 

Lacing types.

More...
typedef boost::shared_ptr< BlockPtr
 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< FrameFramePtr
 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_typeat (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_typeoperator[] (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.

Detailed Description

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.

Definition at line 48 of file block.h.


Member Typedef Documentation

The constant random access iterator type.

Definition at line 82 of file block.h.

The constant reference type.

Definition at line 78 of file block.h.

The constant reversed random access iterator type.

Definition at line 87 of file block.h.

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

Constant pointer to a block.

Definition at line 55 of file block.h.

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

The type of a single frame of data.

Definition at line 68 of file block.h.

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

A pointer to a frame of data.

Definition at line 70 of file block.h.

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

The random access iterator type.

Definition at line 80 of file block.h.

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

Pointer to a block.

Reimplemented in tide::BlockElement.

Definition at line 53 of file block.h.

typedef std::vector<FramePtr>::reference tide::Block::reference

The reference type.

Definition at line 76 of file block.h.

The reversed random access iterator type.

Definition at line 84 of file block.h.

typedef std::vector<FramePtr>::size_type tide::Block::size_type

The size type of this container.

Definition at line 74 of file block.h.

The value type of this container.

Reimplemented in tide::BlockImpl.

Definition at line 72 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 58 of file block.h.


Constructor & Destructor Documentation

tide::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 95 of file block.h.

virtual tide::Block::~Block ( ) [pure virtual]

Desctructor.


Member Function Documentation

virtual value_type& tide::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 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.

Returns:
A reference to the specified frame's data.
Exceptions:
std::out_of_rangeif 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.

Parameters:
[in]positionThe position to erase at.

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

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

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

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.

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

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.

Exceptions:
MaxLaceSizeExceededif the new size is incompatible with the lacing type.
EmptyFrameif 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.

Exceptions:
MaxLaceSizeExceededif 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]

Swaps the contents of this block with another.

Parameters:
[in]otherThe other block to swap with.

Definition at line 262 of file block.h.

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines