OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/video_decoder_config.h" | 5 #include "media/base/video_decoder_config.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 (profile() == config.profile()) && | 91 (profile() == config.profile()) && |
92 (coded_size() == config.coded_size()) && | 92 (coded_size() == config.coded_size()) && |
93 (visible_rect() == config.visible_rect()) && | 93 (visible_rect() == config.visible_rect()) && |
94 (natural_size() == config.natural_size()) && | 94 (natural_size() == config.natural_size()) && |
95 (extra_data() == config.extra_data()) && | 95 (extra_data() == config.extra_data()) && |
96 (is_encrypted() == config.is_encrypted())); | 96 (is_encrypted() == config.is_encrypted())); |
97 } | 97 } |
98 | 98 |
99 std::string VideoDecoderConfig::AsHumanReadableString() const { | 99 std::string VideoDecoderConfig::AsHumanReadableString() const { |
100 std::ostringstream s; | 100 std::ostringstream s; |
101 s << "codec: " << GetHumanReadableCodecName() | 101 s << "codec: " << GetCodecName(codec()) << " format: " << format() |
102 << " format: " << format() | 102 << " profile: " << GetProfileName(profile()) << " coded size: [" |
103 << " profile: " << profile() | 103 << coded_size().width() << "," << coded_size().height() << "]" |
104 << " coded size: [" << coded_size().width() | 104 << " visible rect: [" << visible_rect().x() << "," << visible_rect().y() |
105 << "," << coded_size().height() << "]" | 105 << "," << visible_rect().width() << "," << visible_rect().height() << "]" |
106 << " visible rect: [" << visible_rect().x() | 106 << " natural size: [" << natural_size().width() << "," |
107 << "," << visible_rect().y() | 107 << natural_size().height() << "]" |
108 << "," << visible_rect().width() | |
109 << "," << visible_rect().height() << "]" | |
110 << " natural size: [" << natural_size().width() | |
111 << "," << natural_size().height() << "]" | |
112 << " has extra data? " << (extra_data().empty() ? "false" : "true") | 108 << " has extra data? " << (extra_data().empty() ? "false" : "true") |
113 << " encrypted? " << (is_encrypted() ? "true" : "false"); | 109 << " encrypted? " << (is_encrypted() ? "true" : "false"); |
114 return s.str(); | 110 return s.str(); |
115 } | 111 } |
116 | 112 |
117 // The names come from src/third_party/ffmpeg/libavcodec/codec_desc.c | |
118 std::string VideoDecoderConfig::GetHumanReadableCodecName() const { | |
119 switch (codec()) { | |
120 case kUnknownVideoCodec: | |
121 return "unknown"; | |
122 case kCodecH264: | |
123 return "h264"; | |
124 case kCodecHEVC: | |
125 return "hevc"; | |
126 case kCodecVC1: | |
127 return "vc1"; | |
128 case kCodecMPEG2: | |
129 return "mpeg2video"; | |
130 case kCodecMPEG4: | |
131 return "mpeg4"; | |
132 case kCodecTheora: | |
133 return "theora"; | |
134 case kCodecVP8: | |
135 return "vp8"; | |
136 case kCodecVP9: | |
137 return "vp9"; | |
138 } | |
139 NOTREACHED(); | |
140 return ""; | |
141 } | |
142 | |
143 } // namespace media | 113 } // namespace media |
OLD | NEW |