2014-02-14 23:21:05 +00:00
|
|
|
// Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// 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
|
2013-09-24 04:17:12 +00:00
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/base/stream_info.h"
|
2013-09-24 04:17:12 +00:00
|
|
|
|
2014-06-20 21:45:09 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/base/logging.h"
|
|
|
|
#include "packager/base/strings/stringprintf.h"
|
2013-09-24 04:17:12 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2013-09-24 04:17:12 +00:00
|
|
|
namespace media {
|
|
|
|
|
|
|
|
StreamInfo::StreamInfo(StreamType stream_type,
|
|
|
|
int track_id,
|
2014-09-30 21:52:21 +00:00
|
|
|
uint32_t time_scale,
|
|
|
|
uint64_t duration,
|
2013-10-14 20:55:48 +00:00
|
|
|
const std::string& codec_string,
|
|
|
|
const std::string& language,
|
2014-09-30 21:52:21 +00:00
|
|
|
const uint8_t* extra_data,
|
2013-09-24 04:17:12 +00:00
|
|
|
size_t extra_data_size,
|
|
|
|
bool is_encrypted)
|
|
|
|
: stream_type_(stream_type),
|
|
|
|
track_id_(track_id),
|
|
|
|
time_scale_(time_scale),
|
2013-10-14 20:55:48 +00:00
|
|
|
duration_(duration),
|
|
|
|
codec_string_(codec_string),
|
|
|
|
language_(language),
|
2013-09-24 04:17:12 +00:00
|
|
|
is_encrypted_(is_encrypted) {
|
2014-07-14 21:35:57 +00:00
|
|
|
if (extra_data_size > 0) {
|
|
|
|
extra_data_.assign(extra_data, extra_data + extra_data_size);
|
|
|
|
}
|
2013-09-24 04:17:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StreamInfo::~StreamInfo() {}
|
|
|
|
|
2013-10-14 20:55:48 +00:00
|
|
|
std::string StreamInfo::ToString() const {
|
2014-03-05 23:15:22 +00:00
|
|
|
return base::StringPrintf(
|
2015-06-17 22:42:56 +00:00
|
|
|
"type: %s\n codec_string: %s\n time_scale: %d\n duration: "
|
2015-09-25 22:48:18 +00:00
|
|
|
"%" PRIu64 " (%.1f seconds)\n is_encrypted: %s\n",
|
2014-03-05 23:15:22 +00:00
|
|
|
(stream_type_ == kStreamAudio ? "Audio" : "Video"),
|
|
|
|
codec_string_.c_str(),
|
2015-06-17 22:42:56 +00:00
|
|
|
time_scale_, duration_,
|
2015-09-25 22:48:18 +00:00
|
|
|
static_cast<double>(duration_) / time_scale_,
|
2014-03-05 23:15:22 +00:00
|
|
|
is_encrypted_ ? "true" : "false");
|
2013-09-24 04:17:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|