Shaka Packager SDK
text_sample.cc
1 // Copyright 2017 Google LLC. 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 <algorithm>
10 #include <functional>
11 
12 #include <absl/log/log.h>
13 
14 namespace shaka {
15 namespace media {
16 
17 bool TextFragment::is_empty() const {
18  return std::all_of(sub_fragments.begin(), sub_fragments.end(),
19  std::mem_fn(&TextFragment::is_empty)) &&
20  body.empty() && image.empty();
21 }
22 
23 TextSample::TextSample(const std::string& id,
24  int64_t start_time,
25  int64_t end_time,
26  const TextSettings& settings,
27  const TextFragment& body)
28  : id_(id),
29  start_time_(start_time),
30  duration_(end_time - start_time),
31  settings_(settings),
32  body_(body) {}
33 
34 int64_t TextSample::EndTime() const {
35  return start_time_ + duration_;
36 }
37 
38 } // namespace media
39 } // namespace shaka
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66
std::vector< uint8_t > image
PNG image data.
Definition: text_sample.h:112