Shaka Packager SDK
Loading...
Searching...
No Matches
text_stream_info.cc
1// Copyright 2015 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_stream_info.h>
8
9#include <absl/strings/str_format.h>
10
11namespace shaka {
12namespace media {
13
15 int32_t time_scale,
16 int64_t duration,
17 Codec codec,
18 const std::string& codec_string,
19 const std::string& codec_config,
20 uint16_t width,
21 uint16_t height,
22 const std::string& language)
23 : StreamInfo(kStreamText,
24 track_id,
25 time_scale,
26 duration,
27 codec,
28 codec_string,
29 reinterpret_cast<const uint8_t*>(codec_config.data()),
30 codec_config.size(),
31 language,
32 false),
33 width_(width),
34 height_(height) {}
35
36TextStreamInfo::~TextStreamInfo() {}
37
39 return true;
40}
41
42std::string TextStreamInfo::ToString() const {
43 std::string ret = StreamInfo::ToString();
44 if (!sub_streams_.empty()) {
45 ret += " Sub Streams:";
46 for (auto& pair : sub_streams_) {
47 ret += absl::StrFormat("\n ID: %u, Lang: %s", pair.first,
48 pair.second.language.c_str());
49 }
50 }
51 return ret + "\n";
52}
53
54std::unique_ptr<StreamInfo> TextStreamInfo::Clone() const {
55 return std::unique_ptr<StreamInfo>(new TextStreamInfo(*this));
56}
57
58} // namespace media
59} // namespace shaka
Abstract class holds stream information.
Definition stream_info.h:71
virtual std::string ToString() const
TextStreamInfo(int track_id, int32_t time_scale, int64_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.