DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
text_sample.cc
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/text_sample.h"
8 
9 #include "packager/base/logging.h"
10 
11 namespace shaka {
12 namespace media {
13 
14 uint64_t TextSample::EndTime() const {
15  return start_time_ + duration_;
16 }
17 
18 void TextSample::SetTime(uint64_t start_time, uint64_t end_time) {
19  DCHECK_LT(start_time, end_time);
20  start_time_ = start_time;
21  duration_ = end_time - start_time;
22 }
23 
24 void TextSample::AppendPayload(const std::string& payload) {
25  if (payload_.length()) {
26  payload_ += "\n";
27  }
28  payload_ += payload;
29 }
30 
31 } // namespace media
32 } // namespace shaka