7 #include "packager/media/base/video_stream_info.h"
9 #include "packager/base/logging.h"
10 #include "packager/base/strings/string_number_conversions.h"
11 #include "packager/base/strings/string_util.h"
12 #include "packager/base/strings/stringprintf.h"
13 #include "packager/media/base/limits.h"
19 std::string VideoCodecToString(Codec codec) {
27 case kCodecH265DolbyVision:
28 return "H265 Dolby Vision";
34 NOTIMPLEMENTED() <<
"Unknown Video Codec: " << codec;
35 return "UnknownCodec";
41 VideoStreamInfo::VideoStreamInfo(
int track_id,
45 H26xStreamFormat h26x_stream_format,
46 const std::string& codec_string,
47 const uint8_t* codec_config,
48 size_t codec_config_size,
52 uint32_t pixel_height,
53 uint8_t transfer_characteristics,
54 uint32_t trick_play_factor,
55 uint8_t nalu_length_size,
56 const std::string& language,
68 h26x_stream_format_(h26x_stream_format),
71 pixel_width_(pixel_width),
72 pixel_height_(pixel_height),
73 transfer_characteristics_(transfer_characteristics),
74 trick_play_factor_(trick_play_factor),
75 nalu_length_size_(nalu_length_size) {}
77 VideoStreamInfo::~VideoStreamInfo() {}
80 return codec() != kUnknownCodec && width_ > 0 &&
81 width_ <= limits::kMaxDimension && height_ > 0 &&
82 height_ <= limits::kMaxDimension &&
83 (nalu_length_size_ <= 2 || nalu_length_size_ == 4);
87 return base::StringPrintf(
88 "%s codec: %s\n width: %d\n height: %d\n pixel_aspect_ratio: %d:%d\n "
89 "trick_play_factor: %d\n nalu_length_size: %d\n",
91 width_, height_, pixel_width_, pixel_height_, trick_play_factor_,