Tawara  0.1.0
track_entry.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, 2012, Geoffrey Biggs, geoffrey.biggs@aist.go.jp
5  * RT-Synthesis Research Group
6  * Intelligent Systems Research Institute,
7  * National Institute of Advanced Industrial Science and Technology (AIST),
8  * Japan
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided
20  * with the distribution.
21  * * Neither the name of Geoffrey Biggs nor AIST, nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #if !defined(TAWARA_TRACK_ENTRY_H_)
40 #define TAWARA_TRACK_ENTRY_H_
41 
42 #include <boost/operators.hpp>
43 #include <boost/shared_ptr.hpp>
44 #include <string>
45 #include <tawara/binary_element.h>
46 #include <tawara/float_element.h>
47 #include <tawara/master_element.h>
48 #include <tawara/string_element.h>
49 #include <tawara/track_operation.h>
50 #include <tawara/uint_element.h>
51 #include <tawara/win_dll.h>
52 
55 
56 namespace tawara
57 {
70  public boost::equality_comparable<TrackEntry>
71  {
72  public:
79  TrackEntry(uint64_t number, uint64_t uid,
80  std::string const& codec);
81 
83  virtual ~TrackEntry() {}
84 
90  uint64_t number() const { return number_; }
96  void number(uint64_t number);
97 
104  uint64_t uid() const { return uid_; }
110  void uid(uint64_t uid);
111 
118  uint8_t type() const { return type_; }
124  void type(uint8_t type);
125 
132  bool enabled() const { return enabled_; }
134  void enabled(bool enabled) { enabled_ = enabled; }
135 
142  bool forced() const { return forced_; }
144  void forced(bool forced) { forced_ = forced; }
145 
158  bool lacing() const { return lacing_; }
160  void lacing(bool lacing) { lacing_ = lacing; }
161 
172  uint64_t min_cache() const { return min_cache_; }
174  void min_cache(uint64_t min_cache) { min_cache_ = min_cache; }
175 
188  uint64_t max_cache() const { return max_cache_; }
190  void max_cache(uint64_t max_cache) { max_cache_ = max_cache; }
191 
198  uint64_t default_duration() const { return default_dur_; }
203  void default_duration(uint64_t default_duration)
204  { default_dur_ = default_duration; }
205 
213  double timecode_scale() const { return timecode_scale_; }
219  void timecode_scale(double timecode_scale);
220 
227  uint64_t max_block_add_id() const
228  { return max_block_add_id_; }
230  void max_block_add_id(uint64_t max_id)
231  { max_block_add_id_ = max_id; }
232 
234  std::string name() const { return name_; }
236  void name(std::string name) { name_ = name; }
237 
243  std::string codec_id() const { return codec_id_; }
249  void codec_id(std::string id);
250 
256  std::vector<char> codec_private() const
257  { return codec_private_; }
259  void codec_private(std::vector<char> const& data)
260  { codec_private_ = data; }
261 
266  std::string codec_name() const { return codec_name_; }
268  void codec_name(std::string name) { codec_name_ = name; }
269 
278  uint64_t attachment_link() const
279  { return attachment_link_; }
285  void attachment_link(uint64_t uid) { attachment_link_ = uid; }
286 
288  bool decode_all() const { return decode_all_; }
290  void decode_all(bool decode_all) { decode_all_ = decode_all; }
291 
297  std::vector<uint64_t> overlays() const;
299  void overlays(std::vector<uint64_t> const& uids);
300 
307  bool is_virtual() const { return operation_; }
315  TrackOperationBase::Ptr operation() const { return operation_; }
317  void operation(TrackOperationBase::Ptr const& operation)
318  { operation_ = operation; }
319 
321  virtual std::streamsize write_body(std::ostream& output);
322 
324  typedef boost::shared_ptr<TrackEntry> Ptr;
326  typedef boost::shared_ptr<TrackEntry const> ConstPtr;
327 
329  friend bool operator==(TrackEntry const& lhs,
330  TrackEntry const& rhs);
331 
332  protected:
350  std::vector<UIntElement> overlays_;
352 
354  virtual std::streamsize body_size() const;
355 
357  virtual std::streamsize read_body(std::istream& input,
358  std::streamsize size);
359 
361  void reset();
366  std::streamsize read_operation(std::istream& input);
367  }; // class TrackEntry
368 
369  bool operator==(TrackEntry const& lhs, TrackEntry const& rhs);
370 }; // namespace tawara;
371 
373 // group elements
374 
375 #endif // TAWARA_TRACK_ENTRY_H_
376 
UIntElement default_dur_
Definition: track_entry.h:341
uint64_t attachment_link() const
Get the UID of a linked attachment.
Definition: track_entry.h:278
Float primitive element.
Definition: float_element.h:64
boost::shared_ptr< TrackEntry > Ptr
The type of a shared pointer to a TrackEntry.
Definition: track_entry.h:324
std::string codec_id() const
Get the track&#39;s codec&#39;s ID.
Definition: track_entry.h:243
UIntElement number_
Definition: track_entry.h:333
UIntElement lacing_
Definition: track_entry.h:338
BinaryElement codec_private_
Definition: track_entry.h:346
void codec_private(std::vector< char > const &data)
Set the codec-private data.
Definition: track_entry.h:259
UIntElement max_block_add_id_
Definition: track_entry.h:343
bool decode_all() const
Check if this track&#39;s codec can decode damaged data.
Definition: track_entry.h:288
uint64_t max_cache() const
Get the maximum cache size.
Definition: track_entry.h:188
std::vector< UIntElement > overlays_
Definition: track_entry.h:350
UIntElement max_cache_
Definition: track_entry.h:340
uint64_t max_block_add_id() const
Get the maximum BlockAdditions ID.
Definition: track_entry.h:227
std::streamsize size(ID id)
Get the number of bytes required by an ID.
#define TAWARA_EXPORT
Definition: win_dll.h:51
const ID TrackEntry(0xAE)
UIntElement attachment_link_
Definition: track_entry.h:348
UIntElement type_
Definition: track_entry.h:335
double timecode_scale() const
Get the track&#39;s timecode scale.
Definition: track_entry.h:213
uint8_t type() const
Get the track type.
Definition: track_entry.h:118
void codec_name(std::string name)
Set the track&#39;s codec&#39;s name.
Definition: track_entry.h:268
The MasterElement interface.
std::vector< char > codec_private() const
Get the codec-private data.
Definition: track_entry.h:256
void min_cache(uint64_t min_cache)
Set the minimum cache size.
Definition: track_entry.h:174
virtual ~TrackEntry()
Destructor.
Definition: track_entry.h:83
uint64_t number() const
Get the track number.
Definition: track_entry.h:90
Binary primitive element.
TrackOperationBase::Ptr operation_
Definition: track_entry.h:351
StringElement name_
Definition: track_entry.h:344
void max_block_add_id(uint64_t max_id)
Set the maximum BlockAdditions ID.
Definition: track_entry.h:230
uint64_t min_cache() const
Get the minimum cache size.
Definition: track_entry.h:172
void name(std::string name)
Set the track&#39;s name.
Definition: track_entry.h:236
bool operator==(AttachedFile const &lhs, AttachedFile const &rhs)
Equality operator for the AttachedFile object.
UIntElement enabled_
Definition: track_entry.h:336
bool enabled() const
Check if the track is enabled.
Definition: track_entry.h:132
UIntElement forced_
Definition: track_entry.h:337
void lacing(bool lacing)
Set if the track can use lacing.
Definition: track_entry.h:160
boost::shared_ptr< TrackEntry const > ConstPtr
The type of a shared pointer to a constant TrackEntry.
Definition: track_entry.h:326
Unsigned integer primitive element.
Definition: uint_element.h:57
String primitive element.
UIntElement decode_all_
Definition: track_entry.h:349
void default_duration(uint64_t default_duration)
Set the default duration of blocks in the track.
Definition: track_entry.h:203
UIntElement min_cache_
Definition: track_entry.h:339
bool is_virtual() const
Check if this track is virtual.
Definition: track_entry.h:307
void forced(bool forced)
Set if the track is forced.
Definition: track_entry.h:144
bool forced() const
Check if the track is forced.
Definition: track_entry.h:142
void max_cache(uint64_t max_cache)
Set the maximum cache size.
Definition: track_entry.h:190
bool lacing() const
Check if the track can use lacing.
Definition: track_entry.h:158
TrackOperationBase::Ptr operation() const
Get the operation used to create this track.
Definition: track_entry.h:315
std::string codec_name() const
Get the track&#39;s codec&#39;s name.
Definition: track_entry.h:266
StringElement codec_id_
Definition: track_entry.h:345
StringElement codec_name_
Definition: track_entry.h:347
boost::shared_ptr< TrackOperationBase > Ptr
Base type of a track operation pointer.
uint64_t default_duration() const
Get the default duration of blocks in the track.
Definition: track_entry.h:198
void decode_all(bool decode_all)
Set if this track&#39;s codec can decode damaged data.
Definition: track_entry.h:290
void enabled(bool enabled)
Set if the track is enabled.
Definition: track_entry.h:134
FloatElement timecode_scale_
Definition: track_entry.h:342
uint64_t uid() const
Get the track UID.
Definition: track_entry.h:104
A track entry provides the meta-data for a single track.
Definition: track_entry.h:69
void operation(TrackOperationBase::Ptr const &operation)
Set the operation used to create this track.
Definition: track_entry.h:317
UIntElement uid_
Definition: track_entry.h:334
std::string name() const
Get the track&#39;s name.
Definition: track_entry.h:234
void attachment_link(uint64_t uid)
Set the UID of a linked attachment.
Definition: track_entry.h:285