Shaka Packager SDK
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::AppendStyle(const std::string& style) {
25  if (settings_.length()) {
26  settings_ += " ";
27  }
28  settings_ += style;
29 }
30 
31 void TextSample::AppendPayload(const std::string& payload) {
32  if (payload_.length()) {
33  payload_ += "\n";
34  }
35  payload_ += payload;
36 }
37 
38 } // namespace media
39 } // namespace shaka
All the methods that are virtual are virtual for mocking.