Shaka Packager SDK
text_sample.h
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 #ifndef PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
8 #define PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
9 
10 #include <stdint.h>
11 
12 #include <string>
13 
14 namespace shaka {
15 namespace media {
16 
17 class TextSample {
18  public:
19  TextSample() = default;
20 
21  const std::string& id() const { return id_; }
22  uint64_t start_time() const { return start_time_; }
23  uint64_t duration() const { return duration_; }
24  const std::string& settings() const { return settings_; }
25  const std::string& payload() const { return payload_; }
26  uint64_t EndTime() const;
27 
28  void set_id(const std::string& id) { id_ = id; }
29  void SetTime(uint64_t start_time, uint64_t end_time);
30  void AppendStyle(const std::string& style);
31  void AppendPayload(const std::string& payload);
32 
33  private:
34  // Allow the compiler generated copy constructor and assignment operator
35  // intentionally. Since the text data is typically small, the performance
36  // impact is minimal.
37 
38  std::string id_;
39  uint64_t start_time_ = 0;
40  uint64_t duration_ = 0;
41  std::string settings_;
42  std::string payload_;
43 };
44 
45 } // namespace media
46 } // namespace shaka
47 
48 #endif // PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
All the methods that are virtual are virtual for mocking.