| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 57   } | 57   } | 
| 58 | 58 | 
| 59   os << "&" << std::hex << uint64_t(value.get()) << std::dec; | 59   os << "&" << std::hex << uint64_t(value.get()) << std::dec; | 
| 60   os << "/pts:" << value->pts(); | 60   os << "/pts:" << value->pts(); | 
| 61   os << "/eos:" << (value->end_of_stream() ? "t" : "f"); | 61   os << "/eos:" << (value->end_of_stream() ? "t" : "f"); | 
| 62   os << "/size:" << value->size(); | 62   os << "/size:" << value->size(); | 
| 63   os << "/payload:" << std::hex << uint64_t(value->payload()) << std::dec; | 63   os << "/payload:" << std::hex << uint64_t(value->payload()) << std::dec; | 
| 64   return os; | 64   return os; | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 std::ostream& operator<<( | 67 std::ostream& operator<<(std::ostream& os, | 
| 68     std::ostream& os, | 68                          const std::unique_ptr<StreamType>& value) { | 
| 69     const std::unique_ptr<StreamType>& value) { |  | 
| 70   if (!value) { | 69   if (!value) { | 
| 71     return os << "<nullptr>" << std::endl; | 70     return os << "<nullptr>" << std::endl; | 
| 72   } else { | 71   } else { | 
| 73     os << std::endl; | 72     os << std::endl; | 
| 74   } | 73   } | 
| 75 | 74 | 
| 76   os << indent; | 75   os << indent; | 
| 77   os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 76   os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 
| 78   switch (value->scheme()) { | 77   switch (value->scheme()) { | 
| 79     case StreamType::Scheme::kMultiplexed: | 78     case StreamType::Scheme::kMultiplexed: | 
| 80       os << begl << "std::unique_ptr<StreamType> multiplex_type: " | 79       os << begl << "std::unique_ptr<StreamType> multiplex_type: " | 
| 81           << value->multiplexed()->multiplex_type(); | 80          << value->multiplexed()->multiplex_type(); | 
| 82       os << begl << "std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>" | 81       os << begl << "std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>" | 
| 83           << " substream_types: " | 82          << " substream_types: " << value->multiplexed()->substream_types(); | 
| 84           << value->multiplexed()->substream_types(); |  | 
| 85       break; | 83       break; | 
| 86     case StreamType::Scheme::kLpcm: | 84     case StreamType::Scheme::kLpcm: | 
| 87       os << begl << "SampleFormat sample_format: " | 85       os << begl | 
| 88           << value->lpcm()->sample_format() << std::endl; | 86          << "SampleFormat sample_format: " << value->lpcm()->sample_format() | 
| 89       os << begl << "uint32_t channels: " | 87          << std::endl; | 
| 90           << value->lpcm()->channels() << std::endl; | 88       os << begl << "uint32_t channels: " << value->lpcm()->channels() | 
| 91       os << begl << "uint32_t frames_per_second: " | 89          << std::endl; | 
| 92           << value->lpcm()->frames_per_second() << std::endl; | 90       os << begl | 
|  | 91          << "uint32_t frames_per_second: " << value->lpcm()->frames_per_second() | 
|  | 92          << std::endl; | 
| 93       break; | 93       break; | 
| 94     case StreamType::Scheme::kCompressedAudio: | 94     case StreamType::Scheme::kCompressedAudio: | 
| 95       os << begl << "AudioEncoding encoding: " | 95       os << begl | 
| 96           << value->compressed_audio()->encoding() << std::endl; | 96          << "AudioEncoding encoding: " << value->compressed_audio()->encoding() | 
|  | 97          << std::endl; | 
| 97       os << begl << "SampleFormat sample_format: " | 98       os << begl << "SampleFormat sample_format: " | 
| 98           << value->compressed_audio()->sample_format() << std::endl; | 99          << value->compressed_audio()->sample_format() << std::endl; | 
| 99       os << begl << "uint32_t channels: " | 100       os << begl | 
| 100           << value->compressed_audio()->channels() << std::endl; | 101          << "uint32_t channels: " << value->compressed_audio()->channels() | 
|  | 102          << std::endl; | 
| 101       os << begl << "uint32_t frames_per_second: " | 103       os << begl << "uint32_t frames_per_second: " | 
| 102           << value->compressed_audio()->frames_per_second() << std::endl; | 104          << value->compressed_audio()->frames_per_second() << std::endl; | 
| 103       os << begl << "std::unique_ptr<Bytes> encoding_details: " | 105       os << begl << "std::unique_ptr<Bytes> encoding_details: " | 
| 104           << value->compressed_audio()->encoding_details() << std::endl; | 106          << value->compressed_audio()->encoding_details() << std::endl; | 
| 105       break; | 107       break; | 
| 106     case StreamType::Scheme::kVideo: | 108     case StreamType::Scheme::kVideo: | 
| 107       os << begl << "VideoEncoding encoding: " | 109       os << begl << "VideoEncoding encoding: " << value->video()->encoding() | 
| 108           << value->video()->encoding() << std::endl; | 110          << std::endl; | 
| 109       os << begl << "VideoProfile profile: " | 111       os << begl << "VideoProfile profile: " << value->video()->profile() | 
| 110           << value->video()->profile() << std::endl; | 112          << std::endl; | 
| 111       os << begl << "PixelFormat pixel_format: " | 113       os << begl | 
| 112           << value->video()->pixel_format() << std::endl; | 114          << "PixelFormat pixel_format: " << value->video()->pixel_format() | 
| 113       os << begl << "ColorSpace color_space: " | 115          << std::endl; | 
| 114           << value->video()->color_space() << std::endl; | 116       os << begl << "ColorSpace color_space: " << value->video()->color_space() | 
| 115       os << begl << "uint32_t width: " | 117          << std::endl; | 
| 116           << value->video()->width() << std::endl; | 118       os << begl << "uint32_t width: " << value->video()->width() << std::endl; | 
| 117       os << begl << "uint32_t height: " | 119       os << begl << "uint32_t height: " << value->video()->height() | 
| 118           << value->video()->height() << std::endl; | 120          << std::endl; | 
| 119       os << begl << "uint32_t coded_width: " | 121       os << begl << "uint32_t coded_width: " << value->video()->coded_width() | 
| 120           << value->video()->coded_width() << std::endl; | 122          << std::endl; | 
| 121       os << begl << "uint32_t coded_height: " | 123       os << begl << "uint32_t coded_height: " << value->video()->coded_height() | 
| 122           << value->video()->coded_height() << std::endl; | 124          << std::endl; | 
| 123       os << begl << "std::unique_ptr<Bytes> encoding_details: " | 125       os << begl << "std::unique_ptr<Bytes> encoding_details: " | 
| 124           << value->video()->encoding_details() << std::endl; | 126          << value->video()->encoding_details() << std::endl; | 
| 125       break; | 127       break; | 
| 126     default: | 128     default: | 
| 127       break; | 129       break; | 
| 128   } | 130   } | 
| 129 | 131 | 
| 130   return os << outdent; | 132   return os << outdent; | 
| 131 } | 133 } | 
| 132 | 134 | 
| 133 std::ostream& operator<<( | 135 std::ostream& operator<<(std::ostream& os, | 
| 134     std::ostream& os, | 136                          const std::unique_ptr<StreamTypeSet>& value) { | 
| 135     const std::unique_ptr<StreamTypeSet>& value) { |  | 
| 136   if (!value) { | 137   if (!value) { | 
| 137     return os << "<nullptr>" << std::endl; | 138     return os << "<nullptr>" << std::endl; | 
| 138   } else { | 139   } else { | 
| 139     os << std::endl; | 140     os << std::endl; | 
| 140   } | 141   } | 
| 141 | 142 | 
| 142   os << indent; | 143   os << indent; | 
| 143   os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 144   os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 
| 144   switch (value->scheme()) { | 145   switch (value->scheme()) { | 
| 145     case StreamType::Scheme::kMultiplexed: | 146     case StreamType::Scheme::kMultiplexed: | 
| 146       os << begl << "std::unique_ptr<StreamTypeSet> multiplex_type_set: " | 147       os << begl << "std::unique_ptr<StreamTypeSet> multiplex_type_set: " | 
| 147           << value->multiplexed()->multiplex_type_set(); | 148          << value->multiplexed()->multiplex_type_set(); | 
| 148       os << begl << "std::unique_ptr<std::vector<std::unique_ptr<" | 149       os << begl << "std::unique_ptr<std::vector<std::unique_ptr<" | 
| 149           << "StreamTypeSet>>> substream_type_sets: " | 150          << "StreamTypeSet>>> substream_type_sets: " | 
| 150           << value->multiplexed()->substream_type_sets(); | 151          << value->multiplexed()->substream_type_sets(); | 
| 151       break; | 152       break; | 
| 152     case StreamType::Scheme::kLpcm: | 153     case StreamType::Scheme::kLpcm: | 
| 153       os << begl << "SampleFormat sample_format: " | 154       os << begl | 
| 154           << value->lpcm()->sample_format() << std::endl; | 155          << "SampleFormat sample_format: " << value->lpcm()->sample_format() | 
| 155       os << begl << "Range<uint32_t> channels: " | 156          << std::endl; | 
| 156           << value->lpcm()->channels() << std::endl; | 157       os << begl << "Range<uint32_t> channels: " << value->lpcm()->channels() | 
|  | 158          << std::endl; | 
| 157       os << begl << "Range<uint32_t> frames_per_second: " | 159       os << begl << "Range<uint32_t> frames_per_second: " | 
| 158           << value->lpcm()->frames_per_second() << std::endl; | 160          << value->lpcm()->frames_per_second() << std::endl; | 
| 159       break; | 161       break; | 
| 160     case StreamType::Scheme::kCompressedAudio: | 162     case StreamType::Scheme::kCompressedAudio: | 
| 161       os << begl << "AudioEncoding encoding: " | 163       os << begl | 
| 162           << value->compressed_audio()->encoding() << std::endl; | 164          << "AudioEncoding encoding: " << value->compressed_audio()->encoding() | 
|  | 165          << std::endl; | 
| 163       os << begl << "SampleFormat sample_format: " | 166       os << begl << "SampleFormat sample_format: " | 
| 164           << value->compressed_audio()->sample_format() << std::endl; | 167          << value->compressed_audio()->sample_format() << std::endl; | 
| 165       os << begl << "Range<uint32_t> channels: " | 168       os << begl << "Range<uint32_t> channels: " | 
| 166           << value->compressed_audio()->channels() << std::endl; | 169          << value->compressed_audio()->channels() << std::endl; | 
| 167       os << begl << "Range<uint32_t> frames_per_second: " | 170       os << begl << "Range<uint32_t> frames_per_second: " | 
| 168           << value->compressed_audio()->frames_per_second() << std::endl; | 171          << value->compressed_audio()->frames_per_second() << std::endl; | 
| 169       break; | 172       break; | 
| 170     case StreamType::Scheme::kVideo: | 173     case StreamType::Scheme::kVideo: | 
| 171       os << begl << "VideoEncoding encoding: " | 174       os << begl << "VideoEncoding encoding: " << value->video()->encoding() | 
| 172           << value->video()->encoding() << std::endl; | 175          << std::endl; | 
| 173       os << begl << "Range<uint32_t> width: " | 176       os << begl << "Range<uint32_t> width: " << value->video()->width() | 
| 174           << value->video()->width() << std::endl; | 177          << std::endl; | 
| 175       os << begl << "Range<uint32_t> height: " | 178       os << begl << "Range<uint32_t> height: " << value->video()->height() | 
| 176           << value->video()->height() << std::endl; | 179          << std::endl; | 
| 177       break; | 180       break; | 
| 178     default: | 181     default: | 
| 179       break; | 182       break; | 
| 180   } | 183   } | 
| 181 | 184 | 
| 182   return os << outdent; | 185   return os << outdent; | 
| 183 } | 186 } | 
| 184 | 187 | 
| 185 std::ostream& operator<<( | 188 std::ostream& operator<<( | 
| 186     std::ostream& os, | 189     std::ostream& os, | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 263     case LpcmStreamType::SampleFormat::kSigned16: | 266     case LpcmStreamType::SampleFormat::kSigned16: | 
| 264       return os << "kSigned16"; | 267       return os << "kSigned16"; | 
| 265     case LpcmStreamType::SampleFormat::kSigned24In32: | 268     case LpcmStreamType::SampleFormat::kSigned24In32: | 
| 266       return os << "kSigned24In32"; | 269       return os << "kSigned24In32"; | 
| 267     case LpcmStreamType::SampleFormat::kFloat: | 270     case LpcmStreamType::SampleFormat::kFloat: | 
| 268       return os << "kFloat"; | 271       return os << "kFloat"; | 
| 269   } | 272   } | 
| 270   return os; | 273   return os; | 
| 271 } | 274 } | 
| 272 | 275 | 
| 273 std::ostream& operator<<( | 276 std::ostream& operator<<(std::ostream& os, | 
| 274     std::ostream& os, | 277                          CompressedAudioStreamType::AudioEncoding value) { | 
| 275     CompressedAudioStreamType::AudioEncoding value) { |  | 
| 276   switch (value) { | 278   switch (value) { | 
| 277     case CompressedAudioStreamType::AudioEncoding::kUnknown: | 279     case CompressedAudioStreamType::AudioEncoding::kUnknown: | 
| 278       return os << "kUnknown"; | 280       return os << "kUnknown"; | 
| 279     case CompressedAudioStreamType::AudioEncoding::kAny: | 281     case CompressedAudioStreamType::AudioEncoding::kAny: | 
| 280       return os << "kAny"; | 282       return os << "kAny"; | 
| 281     case CompressedAudioStreamType::AudioEncoding::kVorbis: | 283     case CompressedAudioStreamType::AudioEncoding::kVorbis: | 
| 282       return os << "kVorbis"; | 284       return os << "kVorbis"; | 
| 283   } | 285   } | 
| 284   return os; | 286   return os; | 
| 285 } | 287 } | 
| 286 | 288 | 
| 287 std::ostream& operator<<( | 289 std::ostream& operator<<(std::ostream& os, | 
| 288     std::ostream& os, | 290                          VideoStreamType::VideoEncoding value) { | 
| 289     VideoStreamType::VideoEncoding value) { |  | 
| 290   switch (value) { | 291   switch (value) { | 
| 291     case VideoStreamType::VideoEncoding::kUnknown: | 292     case VideoStreamType::VideoEncoding::kUnknown: | 
| 292       return os << "kUnknown"; | 293       return os << "kUnknown"; | 
| 293     case VideoStreamType::VideoEncoding::kAny: | 294     case VideoStreamType::VideoEncoding::kAny: | 
| 294       return os << "kAny"; | 295       return os << "kAny"; | 
| 295     case VideoStreamType::VideoEncoding::kTheora: | 296     case VideoStreamType::VideoEncoding::kTheora: | 
| 296       return os << "kTheora"; | 297       return os << "kTheora"; | 
| 297     case VideoStreamType::VideoEncoding::kVp8: | 298     case VideoStreamType::VideoEncoding::kVp8: | 
| 298       return os << "kVp8"; | 299       return os << "kVp8"; | 
| 299   } | 300   } | 
| 300   return os; | 301   return os; | 
| 301 } | 302 } | 
| 302 | 303 | 
| 303 std::ostream& operator<<( | 304 std::ostream& operator<<(std::ostream& os, | 
| 304     std::ostream& os, | 305                          VideoStreamType::VideoProfile value) { | 
| 305     VideoStreamType::VideoProfile value) { |  | 
| 306   switch (value) { | 306   switch (value) { | 
| 307     case VideoStreamType::VideoProfile::kUnknown: | 307     case VideoStreamType::VideoProfile::kUnknown: | 
| 308       return os << "kUnknown"; | 308       return os << "kUnknown"; | 
| 309     case VideoStreamType::VideoProfile::kNotApplicable: | 309     case VideoStreamType::VideoProfile::kNotApplicable: | 
| 310       return os << "kNotApplicable"; | 310       return os << "kNotApplicable"; | 
| 311     case VideoStreamType::VideoProfile::kH264Baseline: | 311     case VideoStreamType::VideoProfile::kH264Baseline: | 
| 312       return os << "kH264Baseline"; | 312       return os << "kH264Baseline"; | 
| 313     case VideoStreamType::VideoProfile::kH264Main: | 313     case VideoStreamType::VideoProfile::kH264Main: | 
| 314       return os << "kH264Main"; | 314       return os << "kH264Main"; | 
| 315     case VideoStreamType::VideoProfile::kH264Extended: | 315     case VideoStreamType::VideoProfile::kH264Extended: | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 381     case VideoStreamType::ColorSpace::kJpeg: | 381     case VideoStreamType::ColorSpace::kJpeg: | 
| 382       return os << "kJpeg"; | 382       return os << "kJpeg"; | 
| 383     case VideoStreamType::ColorSpace::kHdRec709: | 383     case VideoStreamType::ColorSpace::kHdRec709: | 
| 384       return os << "kHdRec709"; | 384       return os << "kHdRec709"; | 
| 385     case VideoStreamType::ColorSpace::kSdRec601: | 385     case VideoStreamType::ColorSpace::kSdRec601: | 
| 386       return os << "kSdRec601"; | 386       return os << "kSdRec601"; | 
| 387   } | 387   } | 
| 388   return os; | 388   return os; | 
| 389 } | 389 } | 
| 390 | 390 | 
| 391 std::ostream& operator<<( | 391 std::ostream& operator<<(std::ostream& os, | 
| 392     std::ostream& os, | 392                          const std::unique_ptr<Bytes>& value) { | 
| 393     const std::unique_ptr<Bytes>& value) { |  | 
| 394   if (value == nullptr) { | 393   if (value == nullptr) { | 
| 395     return os << "<nullptr>"; | 394     return os << "<nullptr>"; | 
| 396   } else { | 395   } else { | 
| 397     return os << value->size() << " bytes"; | 396     return os << value->size() << " bytes"; | 
| 398   } | 397   } | 
| 399 } | 398 } | 
| 400 | 399 | 
| 401 std::ostream& operator<<(std::ostream& os, Range<bool> value) { | 400 std::ostream& operator<<(std::ostream& os, Range<bool> value) { | 
| 402   if (value.min) { | 401   if (value.min) { | 
| 403     return os << "true"; | 402     return os << "true"; | 
| 404   } else if (value.max) { | 403   } else if (value.max) { | 
| 405     return os << "false..true"; | 404     return os << "false..true"; | 
| 406   }  else { | 405   } else { | 
| 407     return os << "false"; | 406     return os << "false"; | 
| 408   } | 407   } | 
| 409 } | 408 } | 
| 410 | 409 | 
| 411 } // namespace media | 410 }  // namespace media | 
| 412 } // namespace mojo | 411 }  // namespace mojo | 
| OLD | NEW | 
|---|