Tawara  0.1.0
segment_info.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_SEGMENT_INFO_H_)
40 #define TAWARA_SEGMENT_INFO_H_
41 
42 #include <tawara/binary_element.h>
43 #include <tawara/date_element.h>
44 #include <tawara/el_ids.h>
45 #include <tawara/float_element.h>
46 #include <tawara/master_element.h>
47 #include <tawara/string_element.h>
48 #include <tawara/uint_element.h>
49 #include <tawara/win_dll.h>
50 #include <vector>
51 
54 
55 namespace tawara
56 {
82  {
83  public:
85  SegmentInfo();
86 
88  virtual ~SegmentInfo() {}
89 
96  std::vector<char> uid() const { return uid_.value(); }
102  void uid(std::vector<char> const& uid);
103 
105  std::string filename() const { return seg_fn_.value(); }
112  void filename(std::string const& filename);
113 
125  std::vector<char> prev_uid() const { return prev_uid_.value(); }
127  void prev_uid(std::vector<char> const& uid);
133  std::string prev_filename() const { return prev_fn_.value(); }
139  void prev_filename(std::string const& filename);
140 
152  std::vector<char> next_uid() const { return next_uid_.value(); }
158  void next_uid(std::vector<char> const& uid);
160  std::string next_filename() const { return next_fn_.value(); }
166  void next_filename(std::string const& filename);
167 
169  std::vector<char> segment_family() const
170  { return seg_fam_.value(); }
176  void segment_family(std::vector<char> const& segment_family);
177 
187  uint64_t timecode_scale() const { return tc_scale_.value(); }
189  void timecode_scale(uint64_t scale);
190 
201  double duration() const { return duration_.value(); }
203  void duration(double duration);
204 
211  int64_t date() const { return date_.value(); }
213  void date(int64_t date);
214 
220  std::string title() const { return title_.value(); }
226  void title(std::string const& title);
227 
229  std::string muxing_app() const { return muxer_.value(); }
235  void muxing_app(std::string const& muxing_app);
236 
238  std::string writing_app() const { return writer_.value(); }
244  void writing_app(std::string const& writing_app);
245 
247  virtual std::streamsize write_body(std::ostream& output);
248 
249  protected:
251  bool have_uid_;
264  // TimecodeScale is a mandatory element, so no boolean is needed
276 
278  virtual std::streamsize body_size() const;
279 
281  virtual std::streamsize read_body(std::istream& input,
282  std::streamsize size);
283 
285  void reset();
286  }; // class SegmentInfo
287 }; // namespace tawara
288 
290 
291 #endif // TAWARA_SEGMENT_INFO_H_
292 
Float primitive element.
Definition: float_element.h:64
std::string next_filename() const
Get the next segment's file name.
Definition: segment_info.h:160
BinaryElement seg_fam_
Definition: segment_info.h:262
int64_t date() const
Get the segment's date.
Definition: segment_info.h:211
BinaryElement next_uid_
Definition: segment_info.h:258
std::vector< char > prev_uid() const
Get the previous segment's UID.
Definition: segment_info.h:125
std::vector< char > segment_family() const
Get the segment's family UID.
Definition: segment_info.h:169
std::streamsize size(ID id)
Get the number of bytes required by an ID.
#define TAWARA_EXPORT
Definition: win_dll.h:51
StringElement writer_
Definition: segment_info.h:274
BinaryElement prev_uid_
Definition: segment_info.h:254
StringElement seg_fn_
Definition: segment_info.h:252
StringElement title_
Definition: segment_info.h:270
uint64_t timecode_scale() const
Get the timecode scale.
Definition: segment_info.h:187
std::string muxing_app() const
Get the name of the muxing application/library.
Definition: segment_info.h:229
std::string prev_filename() const
Get the previous segment's file name.
Definition: segment_info.h:133
The MasterElement interface.
StringElement muxer_
Definition: segment_info.h:272
The SegmentInfo element, containing the meta-data for a segment.
Definition: segment_info.h:81
Date primitive element.
Definition: date_element.h:57
StringElement next_fn_
Definition: segment_info.h:260
Binary primitive element.
std::string writing_app() const
Get the name of the writing application.
Definition: segment_info.h:238
std::vector< char > next_uid() const
Get the next segment's UID.
Definition: segment_info.h:152
double duration() const
Get the segment's duration.
Definition: segment_info.h:201
std::vector< char > uid() const
Get the UID of this segment.
Definition: segment_info.h:96
FloatElement duration_
Definition: segment_info.h:266
Unsigned integer primitive element.
Definition: uint_element.h:57
String primitive element.
std::string title() const
Get the segment's title.
Definition: segment_info.h:220
std::string filename() const
Get the segment's file name.
Definition: segment_info.h:105
StringElement prev_fn_
Definition: segment_info.h:256
virtual ~SegmentInfo()
Destructor.
Definition: segment_info.h:88
BinaryElement uid_
Definition: segment_info.h:250
UIntElement tc_scale_
Definition: segment_info.h:265