Shaka Packager SDK
text_stream_info.cc
1 // Copyright 2015 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_stream_info.h"
8 
9 #include "packager/base/strings/stringprintf.h"
10 
11 namespace shaka {
12 namespace media {
13 
14 TextStreamInfo::TextStreamInfo(int track_id, uint32_t time_scale,
15  uint64_t duration,
16  Codec codec,
17  const std::string& codec_string,
18  const std::string& codec_config, uint16_t width,
19  uint16_t height, const std::string& language)
20  : StreamInfo(kStreamText, track_id, time_scale, duration, codec,
21  codec_string,
22  reinterpret_cast<const uint8_t*>(codec_config.data()),
23  codec_config.size(), language, false),
24  width_(width),
25  height_(height) {}
26 
27 TextStreamInfo::~TextStreamInfo() {}
28 
30  return true;
31 }
32 
33 std::string TextStreamInfo::ToString() const {
34  std::string ret = StreamInfo::ToString();
35  if (!sub_streams_.empty()) {
36  ret += " Sub Streams:";
37  for (auto& pair : sub_streams_) {
38  ret += base::StringPrintf("\n ID: %u, Lang: %s", pair.first,
39  pair.second.language.c_str());
40  }
41  }
42  return ret + "\n";
43 }
44 
45 std::unique_ptr<StreamInfo> TextStreamInfo::Clone() const {
46  return std::unique_ptr<StreamInfo>(new TextStreamInfo(*this));
47 }
48 
49 } // namespace media
50 } // namespace shaka
Abstract class holds stream information.
Definition: stream_info.h:65
virtual std::string ToString() const
Definition: stream_info.cc:59
TextStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const std::string &codec_config, uint16_t width, uint16_t height, const std::string &language)
std::string ToString() const override
std::unique_ptr< StreamInfo > Clone() const override
bool IsValidConfig() const override
All the methods that are virtual are virtual for mocking.