| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <iostream> | 5 #include <iostream> |
| 6 | 6 |
| 7 #include "services/media/framework/formatting.h" | 7 #include "services/media/framework/formatting.h" |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 namespace media { | 10 namespace media { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 std::ostream& operator<<(std::ostream& os, | 67 std::ostream& operator<<(std::ostream& os, |
| 68 const std::unique_ptr<StreamType>& value) { | 68 const std::unique_ptr<StreamType>& value) { |
| 69 if (!value) { | 69 if (!value) { |
| 70 return os << "<nullptr>" << std::endl; | 70 return os << "<nullptr>" << std::endl; |
| 71 } else { | 71 } else { |
| 72 os << std::endl; | 72 os << std::endl; |
| 73 } | 73 } |
| 74 | 74 |
| 75 os << indent; | 75 os << indent; |
| 76 os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 76 os << begl << "Medium medium(): " << value->medium() << std::endl; |
| 77 switch (value->scheme()) { | 77 os << begl << "std::string encoding: " << value->encoding() << std::endl; |
| 78 case StreamType::Scheme::kMultiplexed: | 78 os << begl << "Bytes encoding_parameters: " << value->encoding_parameters() |
| 79 os << begl << "std::unique_ptr<StreamType> multiplex_type: " | 79 << std::endl; |
| 80 << value->multiplexed()->multiplex_type(); | 80 switch (value->medium()) { |
| 81 os << begl << "std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>" | 81 case StreamType::Medium::kAudio: |
| 82 << " substream_types: " << value->multiplexed()->substream_types(); | |
| 83 break; | |
| 84 case StreamType::Scheme::kLpcm: | |
| 85 os << begl | 82 os << begl |
| 86 << "SampleFormat sample_format: " << value->lpcm()->sample_format() | 83 << "SampleFormat sample_format: " << value->audio()->sample_format() |
| 87 << std::endl; | 84 << std::endl; |
| 88 os << begl << "uint32_t channels: " << value->lpcm()->channels() | 85 os << begl << "uint32_t channels: " << value->audio()->channels() |
| 89 << std::endl; | |
| 90 os << begl | |
| 91 << "uint32_t frames_per_second: " << value->lpcm()->frames_per_second() | |
| 92 << std::endl; | |
| 93 break; | |
| 94 case StreamType::Scheme::kCompressedAudio: | |
| 95 os << begl | |
| 96 << "AudioEncoding encoding: " << value->compressed_audio()->encoding() | |
| 97 << std::endl; | |
| 98 os << begl << "SampleFormat sample_format: " | |
| 99 << value->compressed_audio()->sample_format() << std::endl; | |
| 100 os << begl | |
| 101 << "uint32_t channels: " << value->compressed_audio()->channels() | |
| 102 << std::endl; | 86 << std::endl; |
| 103 os << begl << "uint32_t frames_per_second: " | 87 os << begl << "uint32_t frames_per_second: " |
| 104 << value->compressed_audio()->frames_per_second() << std::endl; | 88 << value->audio()->frames_per_second() << std::endl; |
| 105 os << begl << "std::unique_ptr<Bytes> encoding_details: " | |
| 106 << value->compressed_audio()->encoding_details() << std::endl; | |
| 107 break; | 89 break; |
| 108 case StreamType::Scheme::kVideo: | 90 case StreamType::Medium::kVideo: |
| 109 os << begl << "VideoEncoding encoding: " << value->video()->encoding() | |
| 110 << std::endl; | |
| 111 os << begl << "VideoProfile profile: " << value->video()->profile() | 91 os << begl << "VideoProfile profile: " << value->video()->profile() |
| 112 << std::endl; | 92 << std::endl; |
| 113 os << begl | 93 os << begl |
| 114 << "PixelFormat pixel_format: " << value->video()->pixel_format() | 94 << "PixelFormat pixel_format: " << value->video()->pixel_format() |
| 115 << std::endl; | 95 << std::endl; |
| 116 os << begl << "ColorSpace color_space: " << value->video()->color_space() | 96 os << begl << "ColorSpace color_space: " << value->video()->color_space() |
| 117 << std::endl; | 97 << std::endl; |
| 118 os << begl << "uint32_t width: " << value->video()->width() << std::endl; | 98 os << begl << "uint32_t width: " << value->video()->width() << std::endl; |
| 119 os << begl << "uint32_t height: " << value->video()->height() | 99 os << begl << "uint32_t height: " << value->video()->height() |
| 120 << std::endl; | 100 << std::endl; |
| 121 os << begl << "uint32_t coded_width: " << value->video()->coded_width() | 101 os << begl << "uint32_t coded_width: " << value->video()->coded_width() |
| 122 << std::endl; | 102 << std::endl; |
| 123 os << begl << "uint32_t coded_height: " << value->video()->coded_height() | 103 os << begl << "uint32_t coded_height: " << value->video()->coded_height() |
| 124 << std::endl; | 104 << std::endl; |
| 125 os << begl << "std::unique_ptr<Bytes> encoding_details: " | |
| 126 << value->video()->encoding_details() << std::endl; | |
| 127 break; | 105 break; |
| 128 default: | 106 default: |
| 129 break; | 107 break; |
| 130 } | 108 } |
| 131 | 109 |
| 132 return os << outdent; | 110 return os << outdent; |
| 133 } | 111 } |
| 134 | 112 |
| 135 std::ostream& operator<<(std::ostream& os, | 113 std::ostream& operator<<(std::ostream& os, |
| 136 const std::unique_ptr<StreamTypeSet>& value) { | 114 const std::unique_ptr<StreamTypeSet>& value) { |
| 137 if (!value) { | 115 if (!value) { |
| 138 return os << "<nullptr>" << std::endl; | 116 return os << "<nullptr>" << std::endl; |
| 139 } else { | 117 } else { |
| 140 os << std::endl; | 118 os << std::endl; |
| 141 } | 119 } |
| 142 | 120 |
| 143 os << indent; | 121 os << indent; |
| 144 os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 122 os << begl << "Medium medium(): " << value->medium() << std::endl; |
| 145 switch (value->scheme()) { | 123 os << begl << "std::vector<std::string>&: " << value->encodings() |
| 146 case StreamType::Scheme::kMultiplexed: | 124 << std::endl; |
| 147 os << begl << "std::unique_ptr<StreamTypeSet> multiplex_type_set: " | 125 switch (value->medium()) { |
| 148 << value->multiplexed()->multiplex_type_set(); | 126 case StreamType::Medium::kAudio: |
| 149 os << begl << "std::unique_ptr<std::vector<std::unique_ptr<" | |
| 150 << "StreamTypeSet>>> substream_type_sets: " | |
| 151 << value->multiplexed()->substream_type_sets(); | |
| 152 break; | |
| 153 case StreamType::Scheme::kLpcm: | |
| 154 os << begl | 127 os << begl |
| 155 << "SampleFormat sample_format: " << value->lpcm()->sample_format() | 128 << "SampleFormat sample_format: " << value->audio()->sample_format() |
| 156 << std::endl; | 129 << std::endl; |
| 157 os << begl << "Range<uint32_t> channels: " << value->lpcm()->channels() | 130 os << begl << "Range<uint32_t> channels: " << value->audio()->channels() |
| 158 << std::endl; | 131 << std::endl; |
| 159 os << begl << "Range<uint32_t> frames_per_second: " | 132 os << begl << "Range<uint32_t> frames_per_second: " |
| 160 << value->lpcm()->frames_per_second() << std::endl; | 133 << value->audio()->frames_per_second() << std::endl; |
| 161 break; | 134 break; |
| 162 case StreamType::Scheme::kCompressedAudio: | 135 case StreamType::Medium::kVideo: |
| 163 os << begl | |
| 164 << "AudioEncoding encoding: " << value->compressed_audio()->encoding() | |
| 165 << std::endl; | |
| 166 os << begl << "SampleFormat sample_format: " | |
| 167 << value->compressed_audio()->sample_format() << std::endl; | |
| 168 os << begl << "Range<uint32_t> channels: " | |
| 169 << value->compressed_audio()->channels() << std::endl; | |
| 170 os << begl << "Range<uint32_t> frames_per_second: " | |
| 171 << value->compressed_audio()->frames_per_second() << std::endl; | |
| 172 break; | |
| 173 case StreamType::Scheme::kVideo: | |
| 174 os << begl << "VideoEncoding encoding: " << value->video()->encoding() | |
| 175 << std::endl; | |
| 176 os << begl << "Range<uint32_t> width: " << value->video()->width() | 136 os << begl << "Range<uint32_t> width: " << value->video()->width() |
| 177 << std::endl; | 137 << std::endl; |
| 178 os << begl << "Range<uint32_t> height: " << value->video()->height() | 138 os << begl << "Range<uint32_t> height: " << value->video()->height() |
| 179 << std::endl; | 139 << std::endl; |
| 180 break; | 140 break; |
| 181 default: | 141 default: |
| 182 break; | 142 break; |
| 183 } | 143 } |
| 184 | 144 |
| 185 return os << outdent; | 145 return os << outdent; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 216 } | 176 } |
| 217 | 177 |
| 218 int index = 0; | 178 int index = 0; |
| 219 for (const std::unique_ptr<StreamTypeSet>& element : *value) { | 179 for (const std::unique_ptr<StreamTypeSet>& element : *value) { |
| 220 os << "[" << index++ << "]: " << element; | 180 os << "[" << index++ << "]: " << element; |
| 221 } | 181 } |
| 222 | 182 |
| 223 return os; | 183 return os; |
| 224 } | 184 } |
| 225 | 185 |
| 226 std::ostream& operator<<(std::ostream& os, StreamType::Scheme value) { | 186 std::ostream& operator<<(std::ostream& os, StreamType::Medium value) { |
| 227 switch (value) { | 187 switch (value) { |
| 228 case StreamType::Scheme::kUnknown: | 188 case StreamType::Medium::kAudio: |
| 229 return os << "kUnknown"; | 189 return os << "kAudio"; |
| 230 case StreamType::Scheme::kNone: | 190 case StreamType::Medium::kVideo: |
| 231 return os << "kNone"; | |
| 232 case StreamType::Scheme::kAnyElementary: | |
| 233 return os << "kAnyElementary"; | |
| 234 case StreamType::Scheme::kAnyAudio: | |
| 235 return os << "kAnyAudio"; | |
| 236 case StreamType::Scheme::kAnyVideo: | |
| 237 return os << "kAnyVideo"; | |
| 238 case StreamType::Scheme::kAnySubpicture: | |
| 239 return os << "kAnySubpicture"; | |
| 240 case StreamType::Scheme::kAnyText: | |
| 241 return os << "kAnyText"; | |
| 242 case StreamType::Scheme::kAnyMultiplexed: | |
| 243 return os << "kAnyMultiplexed"; | |
| 244 case StreamType::Scheme::kAny: | |
| 245 return os << "kAny"; | |
| 246 case StreamType::Scheme::kMultiplexed: | |
| 247 return os << "kMultiplexed"; | |
| 248 case StreamType::Scheme::kLpcm: | |
| 249 return os << "kLpcm"; | |
| 250 case StreamType::Scheme::kCompressedAudio: | |
| 251 return os << "kCompressedAudio"; | |
| 252 case StreamType::Scheme::kVideo: | |
| 253 return os << "kVideo"; | 191 return os << "kVideo"; |
| 254 } | 192 case StreamType::Medium::kText: |
| 255 return os; | 193 return os << "kText"; |
| 256 } | 194 case StreamType::Medium::kSubpicture: |
| 257 | 195 return os << "kSubpicture"; |
| 258 std::ostream& operator<<(std::ostream& os, LpcmStreamType::SampleFormat value) { | |
| 259 switch (value) { | |
| 260 case LpcmStreamType::SampleFormat::kUnknown: | |
| 261 return os << "kUnknown"; | |
| 262 case LpcmStreamType::SampleFormat::kAny: | |
| 263 return os << "kAny"; | |
| 264 case LpcmStreamType::SampleFormat::kUnsigned8: | |
| 265 return os << "kUnsigned8"; | |
| 266 case LpcmStreamType::SampleFormat::kSigned16: | |
| 267 return os << "kSigned16"; | |
| 268 case LpcmStreamType::SampleFormat::kSigned24In32: | |
| 269 return os << "kSigned24In32"; | |
| 270 case LpcmStreamType::SampleFormat::kFloat: | |
| 271 return os << "kFloat"; | |
| 272 } | 196 } |
| 273 return os; | 197 return os; |
| 274 } | 198 } |
| 275 | 199 |
| 276 std::ostream& operator<<(std::ostream& os, | 200 std::ostream& operator<<(std::ostream& os, |
| 277 CompressedAudioStreamType::AudioEncoding value) { | 201 AudioStreamType::SampleFormat value) { |
| 278 switch (value) { | 202 switch (value) { |
| 279 case CompressedAudioStreamType::AudioEncoding::kUnknown: | 203 case AudioStreamType::SampleFormat::kAny: |
| 280 return os << "kUnknown"; | |
| 281 case CompressedAudioStreamType::AudioEncoding::kAny: | |
| 282 return os << "kAny"; | 204 return os << "kAny"; |
| 283 case CompressedAudioStreamType::AudioEncoding::kVorbis: | 205 case AudioStreamType::SampleFormat::kUnsigned8: |
| 284 return os << "kVorbis"; | 206 return os << "kUnsigned8"; |
| 285 } | 207 case AudioStreamType::SampleFormat::kSigned16: |
| 286 return os; | 208 return os << "kSigned16"; |
| 287 } | 209 case AudioStreamType::SampleFormat::kSigned24In32: |
| 288 | 210 return os << "kSigned24In32"; |
| 289 std::ostream& operator<<(std::ostream& os, | 211 case AudioStreamType::SampleFormat::kFloat: |
| 290 VideoStreamType::VideoEncoding value) { | 212 return os << "kFloat"; |
| 291 switch (value) { | |
| 292 case VideoStreamType::VideoEncoding::kUnknown: | |
| 293 return os << "kUnknown"; | |
| 294 case VideoStreamType::VideoEncoding::kAny: | |
| 295 return os << "kAny"; | |
| 296 case VideoStreamType::VideoEncoding::kTheora: | |
| 297 return os << "kTheora"; | |
| 298 case VideoStreamType::VideoEncoding::kVp8: | |
| 299 return os << "kVp8"; | |
| 300 } | 213 } |
| 301 return os; | 214 return os; |
| 302 } | 215 } |
| 303 | 216 |
| 304 std::ostream& operator<<(std::ostream& os, | 217 std::ostream& operator<<(std::ostream& os, |
| 305 VideoStreamType::VideoProfile value) { | 218 VideoStreamType::VideoProfile value) { |
| 306 switch (value) { | 219 switch (value) { |
| 307 case VideoStreamType::VideoProfile::kUnknown: | 220 case VideoStreamType::VideoProfile::kUnknown: |
| 308 return os << "kUnknown"; | 221 return os << "kUnknown"; |
| 309 case VideoStreamType::VideoProfile::kNotApplicable: | 222 case VideoStreamType::VideoProfile::kNotApplicable: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return os << "true"; | 315 return os << "true"; |
| 403 } else if (value.max) { | 316 } else if (value.max) { |
| 404 return os << "false..true"; | 317 return os << "false..true"; |
| 405 } else { | 318 } else { |
| 406 return os << "false"; | 319 return os << "false"; |
| 407 } | 320 } |
| 408 } | 321 } |
| 409 | 322 |
| 410 } // namespace media | 323 } // namespace media |
| 411 } // namespace mojo | 324 } // namespace mojo |
| OLD | NEW |