DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs
stream_info.cc
1 // Copyright 2014 Google Inc. 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/stream_info.h"
8 
9 #include <inttypes.h>
10 
11 #include "packager/base/logging.h"
12 #include "packager/base/strings/stringprintf.h"
13 
14 namespace edash_packager {
15 namespace media {
16 
17 StreamInfo::StreamInfo(StreamType stream_type,
18  int track_id,
19  uint32_t time_scale,
20  uint64_t duration,
21  const std::string& codec_string,
22  const std::string& language,
23  const uint8_t* extra_data,
24  size_t extra_data_size,
25  bool is_encrypted)
26  : stream_type_(stream_type),
27  track_id_(track_id),
28  time_scale_(time_scale),
29  duration_(duration),
30  codec_string_(codec_string),
31  language_(language),
32  is_encrypted_(is_encrypted) {
33  if (extra_data_size > 0) {
34  extra_data_.assign(extra_data, extra_data + extra_data_size);
35  }
36 }
37 
38 StreamInfo::~StreamInfo() {}
39 
40 std::string StreamInfo::ToString() const {
41  return base::StringPrintf(
42  "type: %s\n codec_string: %s\n time_scale: %d\n duration: "
43  "%" PRIu64 " (%.1f seconds)\n is_encrypted: %s\n",
44  (stream_type_ == kStreamAudio ? "Audio" : "Video"),
45  codec_string_.c_str(),
46  time_scale_, duration_,
47  static_cast<double>(duration_) / time_scale_,
48  is_encrypted_ ? "true" : "false");
49 }
50 
51 } // namespace media
52 } // namespace edash_packager
virtual std::string ToString() const
Definition: stream_info.cc:40