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