7 #include "packager/media/base/stream_info.h"
11 #include "packager/base/logging.h"
12 #include "packager/base/strings/stringprintf.h"
13 #include "packager/media/base/timestamp.h"
18 std::string StreamTypeToString(StreamType type) {
30 NOTREACHED() <<
"Unhandled StreamType with value " <<
static_cast<int>(type);
34 StreamInfo::StreamInfo(StreamType stream_type,
39 const std::string& codec_string,
40 const uint8_t* codec_config,
41 size_t codec_config_size,
42 const std::string& language,
44 : stream_type_(stream_type),
46 time_scale_(time_scale),
49 codec_string_(codec_string),
51 is_encrypted_(is_encrypted) {
52 if (codec_config_size > 0) {
53 codec_config_.assign(codec_config, codec_config + codec_config_size);
57 StreamInfo::~StreamInfo() {}
61 if (duration_ == kInfiniteDuration) {
62 duration =
"Infinite";
64 duration = base::StringPrintf(
"%" PRIu64
" (%.1f seconds)", duration_,
65 static_cast<double>(duration_) / time_scale_);
68 return base::StringPrintf(
69 "type: %s\n codec_string: %s\n time_scale: %d\n duration: "
70 "%s\n is_encrypted: %s\n",
71 StreamTypeToString(stream_type_).c_str(), codec_string_.c_str(),
72 time_scale_, duration.c_str(), is_encrypted_ ?
"true" :
"false");