| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->presentation_time(); | 60 os << "/pts:" << value->presentation_time(); |
| 61 os << "/dur:" << value->duration(); | 61 os << "/dur:" << value->duration(); |
| 62 os << "/eos:" << (value->end_of_stream() ? "t" : "f"); | 62 os << "/eos:" << (value->end_of_stream() ? "t" : "f"); |
| 63 os << "/size:" << value->size(); | 63 os << "/size:" << value->size(); |
| 64 os << "/payload:" << std::hex << uint64_t(value->payload()) << std::dec; | 64 os << "/payload:" << std::hex << uint64_t(value->payload()) << std::dec; |
| 65 return os; | 65 return os; |
| 66 } | 66 } |
| 67 | 67 |
| 68 std::ostream& operator<<(std::ostream& os, const StreamTypePtr& value) { | 68 std::ostream& operator<<( |
| 69 std::ostream& os, |
| 70 const std::unique_ptr<StreamType>& value) { |
| 69 if (!value) { | 71 if (!value) { |
| 70 return os << "<nullptr>" << std::endl; | 72 return os << "<nullptr>" << std::endl; |
| 71 } else { | 73 } else { |
| 72 os << std::endl; | 74 os << std::endl; |
| 73 } | 75 } |
| 74 | 76 |
| 75 os << indent; | 77 os << indent; |
| 76 os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 78 os << begl << "Scheme scheme(): " << value->scheme() << std::endl; |
| 77 switch (value->scheme()) { | 79 switch (value->scheme()) { |
| 78 case StreamType::Scheme::kMultiplexed: | 80 case StreamType::Scheme::kMultiplexed: |
| 79 os << begl << "StreamTypePtr multiplex_type: " | 81 os << begl << "std::unique_ptr<StreamType> multiplex_type: " |
| 80 << value->multiplexed()->multiplex_type(); | 82 << value->multiplexed()->multiplex_type(); |
| 81 os << begl << "StreamTypesPtr substream_types: " | 83 os << begl << "std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>" |
| 84 << " substream_types: " |
| 82 << value->multiplexed()->substream_types(); | 85 << value->multiplexed()->substream_types(); |
| 83 break; | 86 break; |
| 84 case StreamType::Scheme::kLpcm: | 87 case StreamType::Scheme::kLpcm: |
| 85 os << begl << "SampleFormat sample_format: " | 88 os << begl << "SampleFormat sample_format: " |
| 86 << value->lpcm()->sample_format() << std::endl; | 89 << value->lpcm()->sample_format() << std::endl; |
| 87 os << begl << "uint32_t channels: " | 90 os << begl << "uint32_t channels: " |
| 88 << value->lpcm()->channels() << std::endl; | 91 << value->lpcm()->channels() << std::endl; |
| 89 os << begl << "uint32_t frames_per_second: " | 92 os << begl << "uint32_t frames_per_second: " |
| 90 << value->lpcm()->frames_per_second() << std::endl; | 93 << value->lpcm()->frames_per_second() << std::endl; |
| 91 break; | 94 break; |
| 92 case StreamType::Scheme::kCompressedAudio: | 95 case StreamType::Scheme::kCompressedAudio: |
| 93 os << begl << "AudioEncoding encoding: " | 96 os << begl << "AudioEncoding encoding: " |
| 94 << value->compressed_audio()->encoding() << std::endl; | 97 << value->compressed_audio()->encoding() << std::endl; |
| 95 os << begl << "SampleFormat sample_format: " | 98 os << begl << "SampleFormat sample_format: " |
| 96 << value->compressed_audio()->sample_format() << std::endl; | 99 << value->compressed_audio()->sample_format() << std::endl; |
| 97 os << begl << "uint32_t channels: " | 100 os << begl << "uint32_t channels: " |
| 98 << value->compressed_audio()->channels() << std::endl; | 101 << value->compressed_audio()->channels() << std::endl; |
| 99 os << begl << "uint32_t frames_per_second: " | 102 os << begl << "uint32_t frames_per_second: " |
| 100 << value->compressed_audio()->frames_per_second() << std::endl; | 103 << value->compressed_audio()->frames_per_second() << std::endl; |
| 101 os << begl << "BytesPtr encoding_details: " | 104 os << begl << "std::unique_ptr<Bytes> encoding_details: " |
| 102 << value->compressed_audio()->encoding_details() << std::endl; | 105 << value->compressed_audio()->encoding_details() << std::endl; |
| 103 break; | 106 break; |
| 104 case StreamType::Scheme::kVideo: | 107 case StreamType::Scheme::kVideo: |
| 105 os << begl << "VideoEncoding encoding: " | 108 os << begl << "VideoEncoding encoding: " |
| 106 << value->video()->encoding() << std::endl; | 109 << value->video()->encoding() << std::endl; |
| 107 os << begl << "VideoProfile profile: " | 110 os << begl << "VideoProfile profile: " |
| 108 << value->video()->profile() << std::endl; | 111 << value->video()->profile() << std::endl; |
| 109 os << begl << "PixelFormat pixel_format: " | 112 os << begl << "PixelFormat pixel_format: " |
| 110 << value->video()->pixel_format() << std::endl; | 113 << value->video()->pixel_format() << std::endl; |
| 111 os << begl << "ColorSpace color_space: " | 114 os << begl << "ColorSpace color_space: " |
| 112 << value->video()->color_space() << std::endl; | 115 << value->video()->color_space() << std::endl; |
| 113 os << begl << "uint32_t width: " | 116 os << begl << "uint32_t width: " |
| 114 << value->video()->width() << std::endl; | 117 << value->video()->width() << std::endl; |
| 115 os << begl << "uint32_t height: " | 118 os << begl << "uint32_t height: " |
| 116 << value->video()->height() << std::endl; | 119 << value->video()->height() << std::endl; |
| 117 os << begl << "uint32_t coded_width: " | 120 os << begl << "uint32_t coded_width: " |
| 118 << value->video()->coded_width() << std::endl; | 121 << value->video()->coded_width() << std::endl; |
| 119 os << begl << "uint32_t coded_height: " | 122 os << begl << "uint32_t coded_height: " |
| 120 << value->video()->coded_height() << std::endl; | 123 << value->video()->coded_height() << std::endl; |
| 121 os << begl << "BytesPtr encoding_details: " | 124 os << begl << "std::unique_ptr<Bytes> encoding_details: " |
| 122 << value->video()->encoding_details() << std::endl; | 125 << value->video()->encoding_details() << std::endl; |
| 123 break; | 126 break; |
| 124 default: | 127 default: |
| 125 break; | 128 break; |
| 126 } | 129 } |
| 127 | 130 |
| 128 return os << outdent; | 131 return os << outdent; |
| 129 } | 132 } |
| 130 | 133 |
| 131 std::ostream& operator<<(std::ostream& os, const StreamTypeSetPtr& value) { | 134 std::ostream& operator<<( |
| 135 std::ostream& os, |
| 136 const std::unique_ptr<StreamTypeSet>& value) { |
| 132 if (!value) { | 137 if (!value) { |
| 133 return os << "<nullptr>" << std::endl; | 138 return os << "<nullptr>" << std::endl; |
| 134 } else { | 139 } else { |
| 135 os << std::endl; | 140 os << std::endl; |
| 136 } | 141 } |
| 137 | 142 |
| 138 os << indent; | 143 os << indent; |
| 139 os << begl << "Scheme scheme(): " << value->scheme() << std::endl; | 144 os << begl << "Scheme scheme(): " << value->scheme() << std::endl; |
| 140 switch (value->scheme()) { | 145 switch (value->scheme()) { |
| 141 case StreamType::Scheme::kMultiplexed: | 146 case StreamType::Scheme::kMultiplexed: |
| 142 os << begl << "StreamTypeSetPtr multiplex_type_set: " | 147 os << begl << "std::unique_ptr<StreamTypeSet> multiplex_type_set: " |
| 143 << value->multiplexed()->multiplex_type_set(); | 148 << value->multiplexed()->multiplex_type_set(); |
| 144 os << begl << "StreamTypeSetsPtr substream_type_sets: " | 149 os << begl << "std::unique_ptr<std::vector<std::unique_ptr<" |
| 150 << "StreamTypeSet>>> substream_type_sets: " |
| 145 << value->multiplexed()->substream_type_sets(); | 151 << value->multiplexed()->substream_type_sets(); |
| 146 break; | 152 break; |
| 147 case StreamType::Scheme::kLpcm: | 153 case StreamType::Scheme::kLpcm: |
| 148 os << begl << "SampleFormat sample_format: " | 154 os << begl << "SampleFormat sample_format: " |
| 149 << value->lpcm()->sample_format() << std::endl; | 155 << value->lpcm()->sample_format() << std::endl; |
| 150 os << begl << "Range<uint32_t> channels: " | 156 os << begl << "Range<uint32_t> channels: " |
| 151 << value->lpcm()->channels() << std::endl; | 157 << value->lpcm()->channels() << std::endl; |
| 152 os << begl << "Range<uint32_t> frames_per_second: " | 158 os << begl << "Range<uint32_t> frames_per_second: " |
| 153 << value->lpcm()->frames_per_second() << std::endl; | 159 << value->lpcm()->frames_per_second() << std::endl; |
| 154 break; | 160 break; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 170 os << begl << "Range<uint32_t> height: " | 176 os << begl << "Range<uint32_t> height: " |
| 171 << value->video()->height() << std::endl; | 177 << value->video()->height() << std::endl; |
| 172 break; | 178 break; |
| 173 default: | 179 default: |
| 174 break; | 180 break; |
| 175 } | 181 } |
| 176 | 182 |
| 177 return os << outdent; | 183 return os << outdent; |
| 178 } | 184 } |
| 179 | 185 |
| 180 std::ostream& operator<<(std::ostream& os, const StreamTypesPtr& value) { | 186 std::ostream& operator<<( |
| 187 std::ostream& os, |
| 188 const std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>& value) { |
| 181 if (!value) { | 189 if (!value) { |
| 182 return os << "<nullptr>" << std::endl; | 190 return os << "<nullptr>" << std::endl; |
| 183 } else if (value->size() == 0) { | 191 } else if (value->size() == 0) { |
| 184 return os << "<empty>" << std::endl; | 192 return os << "<empty>" << std::endl; |
| 185 } else { | 193 } else { |
| 186 os << std::endl; | 194 os << std::endl; |
| 187 } | 195 } |
| 188 | 196 |
| 189 int index = 0; | 197 int index = 0; |
| 190 for (const StreamTypePtr& element : *value) { | 198 for (const std::unique_ptr<StreamType>& element : *value) { |
| 191 os << "[" << index++ << "]: " << element; | 199 os << "[" << index++ << "]: " << element; |
| 192 } | 200 } |
| 193 | 201 |
| 194 return os; | 202 return os; |
| 195 } | 203 } |
| 196 | 204 |
| 197 std::ostream& operator<<(std::ostream& os, const StreamTypeSetsPtr& value) { | 205 std::ostream& operator<<( |
| 206 std::ostream& os, |
| 207 const std::unique_ptr<std::vector<std::unique_ptr<StreamTypeSet>>>& value) { |
| 198 if (!value) { | 208 if (!value) { |
| 199 return os << "<nullptr>" << std::endl; | 209 return os << "<nullptr>" << std::endl; |
| 200 } else if (value->size() == 0) { | 210 } else if (value->size() == 0) { |
| 201 return os << "<empty>" << std::endl; | 211 return os << "<empty>" << std::endl; |
| 202 } else { | 212 } else { |
| 203 os << std::endl; | 213 os << std::endl; |
| 204 } | 214 } |
| 205 | 215 |
| 206 int index = 0; | 216 int index = 0; |
| 207 for (const StreamTypeSetPtr& element : *value) { | 217 for (const std::unique_ptr<StreamTypeSet>& element : *value) { |
| 208 os << "[" << index++ << "]: " << element; | 218 os << "[" << index++ << "]: " << element; |
| 209 } | 219 } |
| 210 | 220 |
| 211 return os; | 221 return os; |
| 212 } | 222 } |
| 213 | 223 |
| 214 std::ostream& operator<<(std::ostream& os, StreamType::Scheme value) { | 224 std::ostream& operator<<(std::ostream& os, StreamType::Scheme value) { |
| 215 switch (value) { | 225 switch (value) { |
| 216 case StreamType::Scheme::kUnknown: | 226 case StreamType::Scheme::kUnknown: |
| 217 return os << "kUnknown"; | 227 return os << "kUnknown"; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 case VideoStreamType::ColorSpace::kJpeg: | 382 case VideoStreamType::ColorSpace::kJpeg: |
| 373 return os << "kJpeg"; | 383 return os << "kJpeg"; |
| 374 case VideoStreamType::ColorSpace::kHdRec709: | 384 case VideoStreamType::ColorSpace::kHdRec709: |
| 375 return os << "kHdRec709"; | 385 return os << "kHdRec709"; |
| 376 case VideoStreamType::ColorSpace::kSdRec601: | 386 case VideoStreamType::ColorSpace::kSdRec601: |
| 377 return os << "kSdRec601"; | 387 return os << "kSdRec601"; |
| 378 } | 388 } |
| 379 return os; | 389 return os; |
| 380 } | 390 } |
| 381 | 391 |
| 382 std::ostream& operator<<(std::ostream& os, const BytesPtr& value) { | 392 std::ostream& operator<<( |
| 393 std::ostream& os, |
| 394 const std::unique_ptr<Bytes>& value) { |
| 383 if (value == nullptr) { | 395 if (value == nullptr) { |
| 384 return os << "<nullptr>"; | 396 return os << "<nullptr>"; |
| 385 } else { | 397 } else { |
| 386 return os << value->size() << " bytes"; | 398 return os << value->size() << " bytes"; |
| 387 } | 399 } |
| 388 } | 400 } |
| 389 | 401 |
| 390 std::ostream& operator<<(std::ostream& os, Range<bool> value) { | 402 std::ostream& operator<<(std::ostream& os, Range<bool> value) { |
| 391 if (value.min) { | 403 if (value.min) { |
| 392 return os << "true"; | 404 return os << "true"; |
| 393 } else if (value.max) { | 405 } else if (value.max) { |
| 394 return os << "false..true"; | 406 return os << "false..true"; |
| 395 } else { | 407 } else { |
| 396 return os << "false"; | 408 return os << "false"; |
| 397 } | 409 } |
| 398 } | 410 } |
| 399 | 411 |
| 400 } // namespace media | 412 } // namespace media |
| 401 } // namespace mojo | 413 } // namespace mojo |
| OLD | NEW |