2023-12-01 17:32:19 +00:00
|
|
|
// Copyright 2015 Google LLC. All rights reserved.
|
2015-11-19 23:58:29 +00:00
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
#include <packager/media/base/text_stream_info.h>
|
2015-11-19 23:58:29 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
#include <absl/strings/str_format.h>
|
2020-12-11 20:58:26 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2015-11-19 23:58:29 +00:00
|
|
|
namespace media {
|
|
|
|
|
2021-08-04 18:56:44 +00:00
|
|
|
TextStreamInfo::TextStreamInfo(int track_id,
|
|
|
|
int32_t time_scale,
|
|
|
|
int64_t duration,
|
2017-02-14 21:40:09 +00:00
|
|
|
Codec codec,
|
2015-11-19 23:58:29 +00:00
|
|
|
const std::string& codec_string,
|
2021-08-04 18:56:44 +00:00
|
|
|
const std::string& codec_config,
|
|
|
|
uint16_t width,
|
|
|
|
uint16_t height,
|
|
|
|
const std::string& language)
|
|
|
|
: StreamInfo(kStreamText,
|
|
|
|
track_id,
|
|
|
|
time_scale,
|
|
|
|
duration,
|
|
|
|
codec,
|
2015-11-19 23:58:29 +00:00
|
|
|
codec_string,
|
2016-06-27 19:30:32 +00:00
|
|
|
reinterpret_cast<const uint8_t*>(codec_config.data()),
|
2021-08-04 18:56:44 +00:00
|
|
|
codec_config.size(),
|
|
|
|
language,
|
|
|
|
false),
|
2015-11-19 23:58:29 +00:00
|
|
|
width_(width),
|
|
|
|
height_(height) {}
|
|
|
|
|
|
|
|
TextStreamInfo::~TextStreamInfo() {}
|
|
|
|
|
|
|
|
bool TextStreamInfo::IsValidConfig() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:58:26 +00:00
|
|
|
std::string TextStreamInfo::ToString() const {
|
|
|
|
std::string ret = StreamInfo::ToString();
|
|
|
|
if (!sub_streams_.empty()) {
|
|
|
|
ret += " Sub Streams:";
|
|
|
|
for (auto& pair : sub_streams_) {
|
2023-12-01 17:32:19 +00:00
|
|
|
ret += absl::StrFormat("\n ID: %u, Lang: %s", pair.first,
|
|
|
|
pair.second.language.c_str());
|
2020-12-11 20:58:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret + "\n";
|
|
|
|
}
|
|
|
|
|
2017-09-12 17:24:24 +00:00
|
|
|
std::unique_ptr<StreamInfo> TextStreamInfo::Clone() const {
|
|
|
|
return std::unique_ptr<StreamInfo>(new TextStreamInfo(*this));
|
|
|
|
}
|
|
|
|
|
2015-11-19 23:58:29 +00:00
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|