39 #if !defined(TAWARA_CUES_H_)
40 #define TAWARA_CUES_H_
42 #include <boost/operators.hpp>
43 #include <boost/shared_ptr.hpp>
61 public boost::equality_comparable<CueTrackPosition>
75 uint64_t
track()
const {
return track_; }
77 void track(uint64_t track);
87 { cluster_pos_ = cluster_pos; }
96 void block_num(uint64_t block_num);
106 { codec_state_ = codec_state; }
115 {
return ref_blocks_; }
133 virtual std::streamsize body_size()
const;
136 virtual std::streamsize write_body(std::ostream& output);
139 virtual std::streamsize read_body(std::istream& input,
140 std::streamsize
size);
143 std::streamsize read_cue_reference(std::istream& input,
144 std::streamsize
size);
167 public boost::equality_comparable<CuePoint>
188 typedef storage_type_::const_reverse_iterator
191 typedef boost::shared_ptr<CuePoint>
Ptr;
217 virtual value_type&
at(size_type pos)
218 {
return positions_.at(pos); }
225 virtual value_type
const&
at(size_type pos)
const
226 {
return positions_.at(pos); }
232 {
return positions_[pos]; }
237 {
return positions_[pos]; }
240 virtual iterator
begin() {
return positions_.begin(); }
242 virtual const_iterator
begin()
const {
return positions_.begin(); }
244 virtual iterator
end() {
return positions_.end(); }
246 virtual const_iterator
end()
const {
return positions_.end(); }
248 virtual reverse_iterator
rbegin() {
return positions_.rbegin(); }
251 {
return positions_.rbegin(); }
255 virtual reverse_iterator
rend() {
return positions_.rend(); }
260 {
return positions_.rend(); }
267 virtual bool empty()
const {
return positions_.empty(); }
269 virtual size_type
count()
const {
return positions_.size(); }
272 {
return positions_.max_size(); }
275 virtual void clear() { positions_.clear(); }
281 virtual void erase(iterator position)
282 { positions_.erase(position); }
288 virtual void erase(iterator first, iterator last)
289 { positions_.erase(first, last); }
293 { positions_.push_back(value); }
296 virtual void resize(size_type count) { positions_.resize(count); }
318 virtual std::streamsize body_size()
const;
321 virtual std::streamsize write_body(std::ostream& output);
328 virtual std::streamsize read_body(std::istream& input,
329 std::streamsize
size);
354 public boost::equality_comparable<Cues>
385 typedef storage_type_::const_reverse_iterator
393 mapped_type&
at(key_type
const& pos)
394 {
return cues_.
at(pos); }
400 mapped_type
const&
at(key_type
const& pos)
const
401 {
return cues_.
at(pos); }
409 {
return cues_[key]; }
416 {
return cues_.find(key)->second; }
419 iterator
begin() {
return cues_.begin(); }
421 const_iterator
begin()
const {
return cues_.begin(); }
423 iterator
end() {
return cues_.end(); }
425 const_iterator
end()
const {
return cues_.end(); }
427 reverse_iterator
rbegin() {
return cues_.rbegin(); }
433 reverse_iterator
rend() {
return cues_.rend(); }
440 bool empty()
const {
return cues_.empty(); }
442 size_type
count()
const {
return cues_.size(); }
444 size_type
max_count()
const {
return cues_.max_size(); }
461 std::pair<iterator, bool>
insert(mapped_type
const& value)
462 {
return cues_.insert(std::make_pair(value.
timecode(), value)); }
468 void insert(const_iterator first, const_iterator last)
469 { cues_.insert(first, last); }
475 { cues_.erase(position); }
481 void erase(iterator first, iterator last)
482 { cues_.erase(first, last); }
488 size_type
erase(key_type
const& number)
489 {
return cues_.erase(number); }
502 iterator
find(key_type
const& number)
503 {
return cues_.find(number); }
510 const_iterator
find(key_type
const& number)
const
511 {
return cues_.find(number); }
524 virtual std::streamsize body_size()
const;
527 virtual std::streamsize write_body(std::ostream& output);
530 virtual std::streamsize read_body(std::istream& input,
531 std::streamsize
size);
541 #endif // TAWARA_CUES_H_
void erase(iterator first, iterator last)
Erase a range of CuePoints.
virtual iterator end()
Get an iterator to the position past the last cue.
storage_type_::const_reverse_iterator const_reverse_iterator
The constant reversed random access iterator type.
virtual void erase(iterator position)
Erase the CueTrackPosition at the specified iterator.
uint64_t timecode() const
Get the timecode of this cue point.
uint64_t track() const
The track number this element contains positions for.
void timecode(uint64_t timecode)
Set the timecode.
storage_type_::const_reverse_iterator const_reverse_iterator
The constant reversed random access iterator type.
uint64_t key_type
The key type (Key) of this container.
const_reverse_iterator rend() const
Get a reverse iterator to the position before the first CuePoint.
virtual iterator begin()
Get an iterator to the first cue.
virtual const_reverse_iterator rbegin() const
Get a reverse iterator to the last cue.
storage_type_::reverse_iterator reverse_iterator
The reversed random access iterator type.
mapped_type & at(key_type const &pos)
Get the CuePoint with the given timecode.
storage_type_::value_type value_type
The value type of this container.
std::streamsize size(ID id)
Get the number of bytes required by an ID.
virtual reverse_iterator rbegin()
Get a reverse iterator to the last cue.
iterator end()
Get an iterator to the position past the last CuePoint.
storage_type_::iterator iterator
The random access iterator type.
virtual value_type & operator[](size_type pos)
Get a reference to a CueTracksPosition.
storage_type_::const_reference const_reference
The constant reference type.
virtual size_type count() const
Get the number of cue positions.
size_type erase(key_type const &number)
Erase the CuePoint with the given timecode.
storage_type_::const_iterator const_iterator
The constant random access iterator type.
storage_type_::size_type size_type
The size type of this container.
storage_type_::const_reference const_reference
The constant reference type.
virtual size_type max_count() const
Get the maximum number of cue positions.
virtual void resize(size_type count)
Resizes the vector.
void erase(iterator position)
Erase the CuePoint at the specified iterator.
The MasterElement interface.
virtual void swap(CuePoint &other)
Swaps the contents of this CuePoint element with another.
storage_type_::iterator iterator
The random access iterator type.
The Cues element provides a list of indexes into the blocks for specific timecodes.
virtual const_iterator end() const
Get an iterator to the position past the last cue.
storage_type_::const_iterator const_iterator
The constant random access iterator type.
size_type count() const
Get the number of CuePoints.
virtual const_reverse_iterator rend() const
Get a reverse iterator to the position before the first cue.
std::vector< uint64_t > & reference_times()
Get the vector of reference block timecodes.
const ID CueTrackPosition(0xB7)
iterator begin()
Get an iterator to the first CuePoint.
bool operator==(AttachedFile const &lhs, AttachedFile const &rhs)
Equality operator for the AttachedFile object.
const_iterator end() const
Get an iterator to the position past the last CuePoint.
size_type max_count() const
Get the maximum number of CuePoints.
std::vector< CueTrackPosition > storage_type_
The storage type.
Unsigned integer primitive element.
const_iterator find(key_type const &number) const
Search for the CuePoint with the given timecode.
reverse_iterator rbegin()
Get a reverse iterator to the last CuePoint.
virtual const_iterator begin() const
Get an iterator to the first cue.
mapped_type const & operator[](key_type const &key) const
Gets a reference to the CuePoint with the given timecode, without range checking. ...
CuePoint mapped_type
The mapped type (T) of this container.
std::vector< uint64_t > ref_blocks_
virtual void clear()
Remove all cue positions.
iterator find(key_type const &number)
Search for the CuePoint with the given timecode.
virtual void push_back(value_type const &value)
Add a CueTrackPosition.
mapped_type & operator[](key_type const &key)
Gets a reference to the CuePoint with the given timecode, without range checking. ...
uint64_t block_num() const
Get the number of the relevant block.
void cluster_pos(uint64_t cluster_pos)
Set the cluster position.
The position in the segment of the data for a single track.
storage_type_::size_type size_type
The size type of this container.
const ID Cues(0x1C53BB6B)
virtual reverse_iterator rend()
Get a reverse iterator to the position before the first cue.
storage_type_::value_type value_type
The value type of this container.
A CuePoint is an index from a timecode to one or more cluster/block positions.
bool empty() const
Check if there are no CuePoints.
boost::shared_ptr< CuePoint > Ptr
The pointer to this type.
void insert(const_iterator first, const_iterator last)
Insert a range of CuePoints.
void clear()
Remove all CuePoints.
storage_type_::reference reference
The reference type.
uint64_t codec_state() const
Get the index of the relevant codec state.
reverse_iterator rend()
Get a reverse iterator to the position before the first CuePoint.
virtual void erase(iterator first, iterator last)
Erase a range of CueTrackPosition.
std::pair< iterator, bool > insert(mapped_type const &value)
Insert a new CuePoint.
std::map< key_type, mapped_type > storage_type_
The type of the internal storage.
virtual value_type const & at(size_type pos) const
Get the CueTracksPosition at the given position, with bounds checking.
const_reverse_iterator rbegin() const
Get a reverse iterator to the last CuePoint.
uint64_t cluster_pos() const
Get the cluster position.
void codec_state(uint64_t codec_state)
Set the index of the codec state.
void swap(Cues &other)
Swaps the contents of this Cues element with another.
storage_type_::reverse_iterator reverse_iterator
The reversed random access iterator type.
virtual value_type const & operator[](size_type pos) const
Get a reference to a CueTracksPosition.
virtual bool empty() const
Check if there are no cue positions.
mapped_type const & at(key_type const &pos) const
Get the CuePoint with the given timecode.
const_iterator begin() const
Get an iterator to the first CuePoint.
storage_type_::reference reference
The reference type.
virtual value_type & at(size_type pos)
Get the CueTracksPosition at the given position, with bounds checking.