Tide 0.1.0
Public Member Functions | Friends

tide::SimpleBlock Class Reference

The SimpleBlock element, a simplified version of Blocks. More...

#include <tide/simple_block.h>

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

List of all members.

Public Member Functions

 SimpleBlock (uint64_t track_number, int16_t timecode, LacingType lacing=LACING_NONE)
 Create a new SimpleBlock element.
bool keyframe () const
 Check if this block is a keyframe or not.
void keyframe (bool keyframe)
 Set if this block is a keyframe.
bool discardable () const
 Check if this block can be discarded during playback.
void discardable (bool discardable)
 Set if this block can be discarded during playback.
virtual uint64_t track_number () const
 The block's track number.
virtual void track_number (uint64_t track_number)
 Set the block's track number.
virtual int16_t timecode () const
 The timecode of this block.
virtual void timecode (int16_t timecode)
 Set the block's timecode.
virtual bool invisible () const
 If this block is invisible.
virtual void invisible (bool invisible)
 Set if this block is invisible.
virtual LacingType lacing () const
 Get the lacing type in use.
virtual void lacing (LacingType lacing)
 Set the lacing type in use.
virtual value_typeat (size_type pos)
 Get the frame at the given position, with bounds checking.
virtual value_type const & at (size_type pos) const
 Get the frame at the given position, with bounds checking.
virtual value_typeoperator[] (size_type pos)
 Get a reference to a frame.
virtual value_type const & operator[] (size_type pos) const
 Get a reference to a frame.
virtual iterator begin ()
 Get an iterator to the first frame.
virtual const_iterator begin () const
 Get an iterator to the first frame.
virtual iterator end ()
 Get an iterator to the position past the last frame.
virtual const_iterator end () const
 Get an iterator to the position past the last frame.
virtual reverse_iterator rbegin ()
 Get a reverse iterator to the last frame.
virtual const_reverse_iterator rbegin () const
 Get a reverse iterator to the last frame.
virtual reverse_iterator rend ()
 Get a reverse iterator to the position before the first frame.
virtual const_reverse_iterator rend () const
 Get a reverse iterator to the position before the first frame.
virtual bool empty () const
 Check if there are no frames.
virtual size_type count () const
 Get the number of frames.
virtual size_type max_count () const
 Get the maximum number of frames.
virtual void clear ()
 Remove all frames.
virtual void erase (iterator position)
 Erase the frame at the specified iterator.
virtual void erase (iterator first, iterator last)
 Erase a range of frames.
virtual void push_back (value_type const &value)
 Add a frame to this block.
virtual void resize (size_type count)
 Resizes the frames storage.
virtual void swap (SimpleBlock &other)
 Swaps the contents of this block with another.

Friends

bool operator== (SimpleBlock const &lhs, SimpleBlock const &rhs)
 Equality operator.

Detailed Description

The SimpleBlock element, a simplified version of Blocks.

The SimpleBlock element is used to store a block of data without any extra information, such as reference frames or private codec data. The block is stored as a binary element, with the internal format of the binary data specified by the Simple Block format, which this element implementation interprets.

Definition at line 48 of file simple_block.h.


Constructor & Destructor Documentation

tide::SimpleBlock::SimpleBlock ( uint64_t  track_number,
int16_t  timecode,
LacingType  lacing = LACING_NONE 
)

Create a new SimpleBlock element.

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

Member Function Documentation

virtual value_type& tide::SimpleBlock::at ( size_type  pos) [inline, 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.

Implements tide::Block.

Definition at line 150 of file simple_block.h.

virtual value_type const& tide::SimpleBlock::at ( size_type  pos) const [inline, 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.

Implements tide::Block.

Definition at line 157 of file simple_block.h.

virtual iterator tide::SimpleBlock::begin ( ) [inline, virtual]

Get an iterator to the first frame.

Implements tide::Block.

Definition at line 178 of file simple_block.h.

virtual const_iterator tide::SimpleBlock::begin ( ) const [inline, virtual]

Get an iterator to the first frame.

Implements tide::Block.

Definition at line 180 of file simple_block.h.

virtual void tide::SimpleBlock::clear ( ) [inline, virtual]

Remove all frames.

Implements tide::Block.

Definition at line 218 of file simple_block.h.

virtual size_type tide::SimpleBlock::count ( ) const [inline, virtual]

Get the number of frames.

Implements tide::Block.

Definition at line 207 of file simple_block.h.

void tide::SimpleBlock::discardable ( bool  discardable) [inline]

Set if this block can be discarded during playback.

How this flag is used is codec-dependent.

Some frames of data can be discarded without affecting the decoding of subsequent frames. In simple codecs, which do not have a continuously-updating state, every frame may be considered discardable. For codecs that need to know which frames matter when dropping frames to keep up with timing requirements, this flag is important.

Definition at line 91 of file simple_block.h.

bool tide::SimpleBlock::discardable ( ) const [inline]

Check if this block can be discarded during playback.

Definition at line 79 of file simple_block.h.

virtual bool tide::SimpleBlock::empty ( ) const [inline, virtual]

Check if there are no frames.

Empty blocks cannot be written. If this returns true, an error will occur when write() is called.

Implements tide::Block.

Definition at line 205 of file simple_block.h.

virtual iterator tide::SimpleBlock::end ( ) [inline, virtual]

Get an iterator to the position past the last frame.

Implements tide::Block.

Definition at line 182 of file simple_block.h.

virtual const_iterator tide::SimpleBlock::end ( ) const [inline, virtual]

Get an iterator to the position past the last frame.

Implements tide::Block.

Definition at line 184 of file simple_block.h.

virtual void tide::SimpleBlock::erase ( iterator  position) [inline, virtual]

Erase the frame at the specified iterator.

Parameters:
[in]positionThe position to erase at.

Implements tide::Block.

Definition at line 224 of file simple_block.h.

virtual void tide::SimpleBlock::erase ( iterator  first,
iterator  last 
) [inline, virtual]

Erase a range of frames.

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

Implements tide::Block.

Definition at line 230 of file simple_block.h.

virtual bool tide::SimpleBlock::invisible ( ) const [inline, virtual]

If this block is invisible.

Invisible blocks should be decoded by the codec (thus updating codec state) but not used for playback.

Implements tide::Block.

Definition at line 125 of file simple_block.h.

virtual void tide::SimpleBlock::invisible ( bool  invisible) [inline, virtual]

Set if this block is invisible.

Implements tide::Block.

Definition at line 127 of file simple_block.h.

void tide::SimpleBlock::keyframe ( bool  keyframe) [inline]

Set if this block is a keyframe.

How this flag is used is codec-dependent.

Keyframe blocks are generally of high importance to the codec, as they provide a complete, independent frame of data that does not rely on other frames to be decoded. In some codecs they may allow the codec to completely re-initialise its state, which is useful if previous frames have been corrupted. In the simple codecs, which do not perform inter-frame encoding, keyframes are irrelevant and so every frame has equal status, making this flag irrelevant.

Definition at line 76 of file simple_block.h.

bool tide::SimpleBlock::keyframe ( ) const [inline]

Check if this block is a keyframe or not.

Definition at line 62 of file simple_block.h.

virtual LacingType tide::SimpleBlock::lacing ( ) const [inline, 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.

Implements tide::Block.

Definition at line 139 of file simple_block.h.

virtual void tide::SimpleBlock::lacing ( LacingType  lacing) [inline, virtual]

Set the lacing type in use.

Implements tide::Block.

Definition at line 141 of file simple_block.h.

virtual size_type tide::SimpleBlock::max_count ( ) const [inline, 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.

Implements tide::Block.

Definition at line 215 of file simple_block.h.

virtual value_type const& tide::SimpleBlock::operator[] ( size_type  pos) const [inline, 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.

Implements tide::Block.

Definition at line 174 of file simple_block.h.

virtual value_type& tide::SimpleBlock::operator[] ( size_type  pos) [inline, 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.

Implements tide::Block.

Definition at line 166 of file simple_block.h.

virtual void tide::SimpleBlock::push_back ( value_type const &  value) [inline, 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.

Implements tide::Block.

Definition at line 245 of file simple_block.h.

virtual reverse_iterator tide::SimpleBlock::rbegin ( ) [inline, virtual]

Get a reverse iterator to the last frame.

Implements tide::Block.

Definition at line 186 of file simple_block.h.

virtual const_reverse_iterator tide::SimpleBlock::rbegin ( ) const [inline, virtual]

Get a reverse iterator to the last frame.

Implements tide::Block.

Definition at line 188 of file simple_block.h.

virtual const_reverse_iterator tide::SimpleBlock::rend ( ) const [inline, virtual]

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

Implements tide::Block.

Definition at line 197 of file simple_block.h.

virtual reverse_iterator tide::SimpleBlock::rend ( ) [inline, virtual]

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

Implements tide::Block.

Definition at line 193 of file simple_block.h.

virtual void tide::SimpleBlock::resize ( size_type  count) [inline, 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.

Implements tide::Block.

Definition at line 263 of file simple_block.h.

virtual void tide::SimpleBlock::swap ( SimpleBlock other) [virtual]

Swaps the contents of this block with another.

Parameters:
[in]otherThe other block to swap with.
virtual void tide::SimpleBlock::timecode ( int16_t  timecode) [inline, virtual]

Set the block's timecode.

Implements tide::Block.

Definition at line 117 of file simple_block.h.

virtual int16_t tide::SimpleBlock::timecode ( ) const [inline, 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.

Implements tide::Block.

Definition at line 115 of file simple_block.h.

virtual void tide::SimpleBlock::track_number ( uint64_t  track_number) [inline, virtual]

Set the block's track number.

Implements tide::Block.

Definition at line 106 of file simple_block.h.

virtual uint64_t tide::SimpleBlock::track_number ( ) const [inline, 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.

Implements tide::Block.

Definition at line 103 of file simple_block.h.


Friends And Related Function Documentation

bool operator== ( SimpleBlock const &  lhs,
SimpleBlock const &  rhs 
) [friend]

Equality operator.


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