7 #include <packager/media/base/stream_info.h>
11 #include <absl/log/log.h>
12 #include <absl/strings/str_format.h>
14 #include <packager/macros/logging.h>
15 #include <packager/media/base/timestamp.h>
20 std::string StreamTypeToString(StreamType type) {
32 NOTIMPLEMENTED() <<
"Unhandled StreamType with value "
33 <<
static_cast<int>(type);
37 StreamInfo::StreamInfo(StreamType stream_type,
42 const std::string& codec_string,
43 const uint8_t* codec_config,
44 size_t codec_config_size,
45 const std::string& language,
47 : stream_type_(stream_type),
49 time_scale_(time_scale),
52 codec_string_(codec_string),
54 is_encrypted_(is_encrypted) {
55 if (codec_config_size > 0) {
56 codec_config_.assign(codec_config, codec_config + codec_config_size);
60 StreamInfo::~StreamInfo() {}
62 std::string StreamInfo::ToString()
const {
64 if (duration_ == kInfiniteDuration) {
65 duration =
"Infinite";
67 duration = absl::StrFormat(
"%" PRIu64
" (%.1f seconds)", duration_,
68 static_cast<double>(duration_) / time_scale_);
71 return absl::StrFormat(
72 "type: %s\n codec_string: %s\n time_scale: %d\n duration: "
73 "%s\n is_encrypted: %s\n",
74 StreamTypeToString(stream_type_).c_str(), codec_string_.c_str(),
75 time_scale_, duration.c_str(), is_encrypted_ ?
"true" :
"false");
All the methods that are virtual are virtual for mocking.