Tawara
0.1.0
|
A track entry provides the meta-data for a single track. More...
#include <tawara/track_entry.h>
Public Types | |
typedef boost::shared_ptr < TrackEntry > | Ptr |
The type of a shared pointer to a TrackEntry. More... | |
typedef boost::shared_ptr < TrackEntry const > | ConstPtr |
The type of a shared pointer to a constant TrackEntry. More... | |
Public Member Functions | |
TrackEntry (uint64_t number, uint64_t uid, std::string const &codec) | |
Construct a new TrackEntry. More... | |
virtual | ~TrackEntry () |
Destructor. More... | |
uint64_t | number () const |
Get the track number. More... | |
void | number (uint64_t number) |
Set the track number. More... | |
uint64_t | uid () const |
Get the track UID. More... | |
void | uid (uint64_t uid) |
Set the track UID. More... | |
uint8_t | type () const |
Get the track type. More... | |
void | type (uint8_t type) |
Set the track type. More... | |
bool | enabled () const |
Check if the track is enabled. More... | |
void | enabled (bool enabled) |
Set if the track is enabled. More... | |
bool | forced () const |
Check if the track is forced. More... | |
void | forced (bool forced) |
Set if the track is forced. More... | |
bool | lacing () const |
Check if the track can use lacing. More... | |
void | lacing (bool lacing) |
Set if the track can use lacing. More... | |
uint64_t | min_cache () const |
Get the minimum cache size. More... | |
void | min_cache (uint64_t min_cache) |
Set the minimum cache size. More... | |
uint64_t | max_cache () const |
Get the maximum cache size. More... | |
void | max_cache (uint64_t max_cache) |
Set the maximum cache size. More... | |
uint64_t | default_duration () const |
Get the default duration of blocks in the track. More... | |
void | default_duration (uint64_t default_duration) |
Set the default duration of blocks in the track. More... | |
double | timecode_scale () const |
Get the track's timecode scale. More... | |
void | timecode_scale (double timecode_scale) |
Set the track's timecode scale. More... | |
uint64_t | max_block_add_id () const |
Get the maximum BlockAdditions ID. More... | |
void | max_block_add_id (uint64_t max_id) |
Set the maximum BlockAdditions ID. More... | |
std::string | name () const |
Get the track's name. More... | |
void | name (std::string name) |
Set the track's name. More... | |
std::string | codec_id () const |
Get the track's codec's ID. More... | |
void | codec_id (std::string id) |
Set the track's codec's ID. More... | |
std::vector< char > | codec_private () const |
Get the codec-private data. More... | |
void | codec_private (std::vector< char > const &data) |
Set the codec-private data. More... | |
std::string | codec_name () const |
Get the track's codec's name. More... | |
void | codec_name (std::string name) |
Set the track's codec's name. More... | |
uint64_t | attachment_link () const |
Get the UID of a linked attachment. More... | |
void | attachment_link (uint64_t uid) |
Set the UID of a linked attachment. More... | |
bool | decode_all () const |
Check if this track's codec can decode damaged data. More... | |
void | decode_all (bool decode_all) |
Set if this track's codec can decode damaged data. More... | |
std::vector< uint64_t > | overlays () const |
Get the UIDs of overlay tracks. More... | |
void | overlays (std::vector< uint64_t > const &uids) |
Set the list of overlay track UIDs. More... | |
bool | is_virtual () const |
Check if this track is virtual. More... | |
TrackOperationBase::Ptr | operation () const |
Get the operation used to create this track. More... | |
void | operation (TrackOperationBase::Ptr const &operation) |
Set the operation used to create this track. More... | |
virtual std::streamsize | write_body (std::ostream &output) |
Element body writing. More... | |
![]() | |
MasterElement (uint32_t id, bool crc=false) | |
Create a new MasterElement. More... | |
virtual | ~MasterElement () |
Destructor. More... | |
![]() | |
Element (tawara::ids::ID id) | |
Create a new Element. More... | |
virtual | ~Element () |
Destructor. More... | |
uint32_t | id () const |
Get the element's ID. More... | |
std::streampos | offset () const |
Get the element's offset in the byte stream. More... | |
virtual std::streamsize | size () const |
Get the total size of the element. More... | |
virtual std::streamsize | write (std::ostream &output) |
Element writing. More... | |
virtual std::streamsize | read (std::istream &input) |
Element reading. More... | |
Protected Member Functions | |
virtual std::streamsize | body_size () const |
Get the size of the body of this element. More... | |
virtual std::streamsize | read_body (std::istream &input, std::streamsize size) |
Element body loading. More... | |
void | reset () |
Resets all child elements to clean values. More... | |
std::streamsize | read_operation (std::istream &input) |
Reads the operation child element. More... | |
![]() | |
std::streamsize | write_id (std::ostream &output) |
Element ID writing. More... | |
virtual std::streamsize | write_size (std::ostream &output) |
Element size writing. More... | |
Protected Attributes | |
UIntElement | number_ |
UIntElement | uid_ |
UIntElement | type_ |
UIntElement | enabled_ |
UIntElement | forced_ |
UIntElement | lacing_ |
UIntElement | min_cache_ |
UIntElement | max_cache_ |
UIntElement | default_dur_ |
FloatElement | timecode_scale_ |
UIntElement | max_block_add_id_ |
StringElement | name_ |
StringElement | codec_id_ |
BinaryElement | codec_private_ |
StringElement | codec_name_ |
UIntElement | attachment_link_ |
UIntElement | decode_all_ |
std::vector< UIntElement > | overlays_ |
TrackOperationBase::Ptr | operation_ |
![]() | |
tawara::ids::ID | id_ |
std::streampos | offset_ |
Friends | |
bool | operator== (TrackEntry const &lhs, TrackEntry const &rhs) |
Equality operator. More... | |
A track entry provides the meta-data for a single track.
All the necessary information to understand the data for a track is stored in the TrackEntry element. This includes things such as the codec used, private data stored by the codec (such as invariant sensor information), and playback settings.
Some tracks may be virtual, which means that they don't have any data of their own. Instead, they use data from other tracks, combined using one or more specified operations.
Definition at line 69 of file track_entry.h.
typedef boost::shared_ptr<TrackEntry const> tawara::TrackEntry::ConstPtr |
The type of a shared pointer to a constant TrackEntry.
Definition at line 326 of file track_entry.h.
typedef boost::shared_ptr<TrackEntry> tawara::TrackEntry::Ptr |
The type of a shared pointer to a TrackEntry.
Definition at line 324 of file track_entry.h.
tawara::TrackEntry::TrackEntry | ( | uint64_t | number, |
uint64_t | uid, | ||
std::string const & | codec | ||
) |
Construct a new TrackEntry.
[in] | number | The track number. Must not be zero. |
[in] | uid | The track's unique identifier. Must not be zero. |
[in] | codec | The ID of the codec used in this track. |
|
inlinevirtual |
Destructor.
Definition at line 83 of file track_entry.h.
|
inline |
Get the UID of a linked attachment.
If the codec uses data stored in an attachment (for example, a binary providing the codec implementation), this UID must specify the relevant attachment.
This value, if specified, must not be zero.
Definition at line 278 of file track_entry.h.
|
inline |
Set the UID of a linked attachment.
Set to 0 to remove a linked attachment. No element will be written.
Definition at line 285 of file track_entry.h.
|
protectedvirtual |
Get the size of the body of this element.
Implements tawara::Element.
|
inline |
Get the track's codec's ID.
The codec ID is vital for determining how to understand the track's data.
Definition at line 243 of file track_entry.h.
void tawara::TrackEntry::codec_id | ( | std::string | id | ) |
Set the track's codec's ID.
ValueOutOfRange | if a value outside the allowable range is set. |
|
inline |
Get the track's codec's name.
This name should be human-readable.
Definition at line 266 of file track_entry.h.
|
inline |
Set the track's codec's name.
Definition at line 268 of file track_entry.h.
|
inline |
Get the codec-private data.
Some codecs store data that does not vary by frame in this element.
Definition at line 256 of file track_entry.h.
|
inline |
Set the codec-private data.
Definition at line 259 of file track_entry.h.
|
inline |
Check if this track's codec can decode damaged data.
Definition at line 288 of file track_entry.h.
|
inline |
Set if this track's codec can decode damaged data.
Definition at line 290 of file track_entry.h.
|
inline |
Get the default duration of blocks in the track.
This value, specified in nanoseconds, is used to give the length of each block in the track if individual timecodes are not used. If specified, it must not be zero.
Definition at line 198 of file track_entry.h.
|
inline |
Set the default duration of blocks in the track.
Set to 0 to disable. No element will be written.
Definition at line 203 of file track_entry.h.
|
inline |
Check if the track is enabled.
Disabled tracks are typically not played back.
The default is true.
Definition at line 132 of file track_entry.h.
|
inline |
Set if the track is enabled.
Definition at line 134 of file track_entry.h.
|
inline |
Check if the track is forced.
A forced track MUST be played back.
The default is false.
Definition at line 142 of file track_entry.h.
|
inline |
Set if the track is forced.
Definition at line 144 of file track_entry.h.
|
inline |
Check if this track is virtual.
If this track has a TrackOperation, it is virtual and so its data comes from the blocks of its source tracks. If the track is not virtual, it has its own blocks.
Definition at line 307 of file track_entry.h.
|
inline |
Check if the track can use lacing.
If the track can use lacing, it means that it may store multiple frames of data in a single block. This is used to reduce overhead when the size of an individual frame is small relative to the size of Tawara data around it.
A value of true does not imply that the track must use lacing, only that it may.
The default is true.
Definition at line 158 of file track_entry.h.
|
inline |
Set if the track can use lacing.
Definition at line 160 of file track_entry.h.
|
inline |
Get the maximum BlockAdditions ID.
A value of 0 means there are no BlockAdditions for this track.
The default is 0.
Definition at line 227 of file track_entry.h.
|
inline |
Set the maximum BlockAdditions ID.
Definition at line 230 of file track_entry.h.
|
inline |
Get the maximum cache size.
This value gives the maximum cache size necessary to satisfy reference block requirements. This value heavily depends on the needs on the codec used for data. For example, a codec that may reference up to 10 blocks to decode the current block would require a value of 10 here.
A value of 0 indicates that no caching is necessary.
The default is 0.
Definition at line 188 of file track_entry.h.
|
inline |
Set the maximum cache size.
Definition at line 190 of file track_entry.h.
|
inline |
Get the minimum cache size.
This value gives the minimum number of blocks that should be cached before beginning playback. Generally, this value depends on the needs of the codec used for the data.
A value of 0 indicates that no caching is necessary.
The default is 0.
Definition at line 172 of file track_entry.h.
|
inline |
Set the minimum cache size.
Definition at line 174 of file track_entry.h.
|
inline |
Get the track's name.
Definition at line 234 of file track_entry.h.
|
inline |
Set the track's name.
Definition at line 236 of file track_entry.h.
|
inline |
Get the track number.
The track's number is used to identify which track a block belongs to. It must not be zero.
Definition at line 90 of file track_entry.h.
void tawara::TrackEntry::number | ( | uint64_t | number | ) |
Set the track number.
ValueOutOfRange | if a value outside the allowable range is set. |
|
inline |
Get the operation used to create this track.
If this track is virtual, this operation specifies how to combine the blocks of the source tracks.
If this value is empty, then the track is not virtual.
Definition at line 315 of file track_entry.h.
|
inline |
Set the operation used to create this track.
Definition at line 317 of file track_entry.h.
std::vector<uint64_t> tawara::TrackEntry::overlays | ( | ) | const |
Get the UIDs of overlay tracks.
When this track has a gap in its data, the first track in the overlay list with available data will be used instead.
void tawara::TrackEntry::overlays | ( | std::vector< uint64_t > const & | uids | ) |
Set the list of overlay track UIDs.
|
protectedvirtual |
Element body loading.
Implements tawara::Element.
|
protected |
Reads the operation child element.
[in] | input | The input stream to read from. |
|
protected |
Resets all child elements to clean values.
|
inline |
Get the track's timecode scale.
This value speeds up or slows down the track with respect to other tracks. 1.0 means play back at the normal speed.
It must be greater than zero.
Definition at line 213 of file track_entry.h.
void tawara::TrackEntry::timecode_scale | ( | double | timecode_scale | ) |
Set the track's timecode scale.
ValueOutOfRange | if a value outside the allowable range is set. |
|
inline |
Get the track type.
The track's type may be one of the values allowed by the specification. Usually, 0x70 will be used, indicating a data track.
Definition at line 118 of file track_entry.h.
void tawara::TrackEntry::type | ( | uint8_t | type | ) |
Set the track type.
ValueOutOfRange | if a value outside the allowable range is set. |
|
inline |
Get the track UID.
The track's UID is used to uniquely identify it. Generally, when making a direct stream copy of the track, the UID should be preserved. It must not be zero.
Definition at line 104 of file track_entry.h.
void tawara::TrackEntry::uid | ( | uint64_t | uid | ) |
Set the track UID.
ValueOutOfRange | if a value outside the allowable range is set. |
|
virtual |
Element body writing.
Implements tawara::Element.
|
friend |
Equality operator.
|
protected |
Definition at line 348 of file track_entry.h.
|
protected |
Definition at line 345 of file track_entry.h.
|
protected |
Definition at line 347 of file track_entry.h.
|
protected |
Definition at line 346 of file track_entry.h.
|
protected |
Definition at line 349 of file track_entry.h.
|
protected |
Definition at line 341 of file track_entry.h.
|
protected |
Definition at line 336 of file track_entry.h.
|
protected |
Definition at line 337 of file track_entry.h.
|
protected |
Definition at line 338 of file track_entry.h.
|
protected |
Definition at line 343 of file track_entry.h.
|
protected |
Definition at line 340 of file track_entry.h.
|
protected |
Definition at line 339 of file track_entry.h.
|
protected |
Definition at line 344 of file track_entry.h.
|
protected |
Definition at line 333 of file track_entry.h.
|
protected |
Definition at line 351 of file track_entry.h.
|
protected |
Definition at line 350 of file track_entry.h.
|
protected |
Definition at line 342 of file track_entry.h.
|
protected |
Definition at line 335 of file track_entry.h.
|
protected |
Definition at line 334 of file track_entry.h.