| 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 #ifndef SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_FORMATTING_H_ | 5 #ifndef SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_FORMATTING_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_FORMATTING_H_ | 6 #define SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_FORMATTING_H_ |
| 7 | 7 |
| 8 #include "mojo/services/media/common/interfaces/media_common.mojom.h" | 8 #include "mojo/services/media/common/interfaces/media_common.mojom.h" |
| 9 #include "mojo/services/media/common/interfaces/media_transport.mojom.h" | 9 #include "mojo/services/media/common/interfaces/media_transport.mojom.h" |
| 10 #include "mojo/services/media/common/interfaces/media_types.mojom.h" | 10 #include "mojo/services/media/common/interfaces/media_types.mojom.h" |
| 11 #include "mojo/services/media/common/interfaces/rate_control.mojom.h" | 11 #include "mojo/services/media/common/interfaces/rate_control.mojom.h" |
| 12 #include "mojo/services/media/control/interfaces/media_source.mojom.h" | 12 #include "mojo/services/media/control/interfaces/media_source.mojom.h" |
| 13 #include "services/media/framework/formatting.h" | 13 #include "services/media/framework/formatting.h" |
| 14 | 14 |
| 15 namespace mojo { | 15 namespace mojo { |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 // See services/media/framework/ostream.h for details. | 18 // See services/media/framework/ostream.h for details. |
| 19 | 19 |
| 20 // Mojo defines versions of operator<< for this that produce only numbers. | 20 // Mojo defines versions of operator<< for this that produce only numbers. |
| 21 const char* StringFromMediaTypeScheme(MediaTypeScheme value); | 21 const char* StringFromMediaTypeScheme(MediaTypeScheme value); |
| 22 const char* StringFromLpcmSampleFormat(LpcmSampleFormat value); | 22 const char* StringFromLpcmSampleFormat(LpcmSampleFormat value); |
| 23 const char* StringFromAudioEncoding(AudioEncoding value); | 23 const char* StringFromAudioEncoding(AudioEncoding value); |
| 24 const char* StringFromVideoEncoding(VideoEncoding value); | 24 const char* StringFromVideoEncoding(VideoEncoding value); |
| 25 const char* StringFromMediaState(MediaState value); | 25 const char* StringFromMediaState(MediaState value); |
| 26 | 26 |
| 27 // The following overloads add newlines. | 27 // The following overloads add newlines. |
| 28 | 28 |
| 29 template<typename T> | 29 template <typename T> |
| 30 std::ostream& operator<<(std::ostream& os, const InterfacePtr<T>& value); | 30 std::ostream& operator<<(std::ostream& os, const InterfacePtr<T>& value); |
| 31 | 31 |
| 32 template<typename T> | 32 template <typename T> |
| 33 std::ostream& operator<<(std::ostream& os, const Array<T>& value) { | 33 std::ostream& operator<<(std::ostream& os, const Array<T>& value) { |
| 34 if (!value) { | 34 if (!value) { |
| 35 return os << "<nullptr>" << std::endl; | 35 return os << "<nullptr>" << std::endl; |
| 36 } else if (value.size() == 0) { | 36 } else if (value.size() == 0) { |
| 37 return os << "<empty>" << std::endl; | 37 return os << "<empty>" << std::endl; |
| 38 } else { | 38 } else { |
| 39 os << std::endl; | 39 os << std::endl; |
| 40 } | 40 } |
| 41 | 41 |
| 42 int index = 0; | 42 int index = 0; |
| 43 for (T& element : const_cast<Array<T>&>(value)) { | 43 for (T& element : const_cast<Array<T>&>(value)) { |
| 44 os << "[" << index++ << "]: " << element; | 44 os << "[" << index++ << "]: " << element; |
| 45 } | 45 } |
| 46 | 46 |
| 47 return os; | 47 return os; |
| 48 } | 48 } |
| 49 | 49 |
| 50 std::ostream& operator<<(std::ostream& os, const MediaTypePtr& value); | 50 std::ostream& operator<<(std::ostream& os, const MediaTypePtr& value); |
| 51 std::ostream& operator<<(std::ostream& os, const MediaTypeSetPtr& value); | 51 std::ostream& operator<<(std::ostream& os, const MediaTypeSetPtr& value); |
| 52 std::ostream& operator<<(std::ostream& os, const MediaTypeDetailsPtr& value); | 52 std::ostream& operator<<(std::ostream& os, const MediaTypeDetailsPtr& value); |
| 53 std::ostream& operator<<(std::ostream& os, const MediaTypeSetDetailsPtr& value); | 53 std::ostream& operator<<(std::ostream& os, const MediaTypeSetDetailsPtr& value); |
| 54 std::ostream& operator<<( | 54 std::ostream& operator<<(std::ostream& os, |
| 55 std::ostream& os, | 55 const MultiplexedMediaTypeDetailsPtr& value); |
| 56 const MultiplexedMediaTypeDetailsPtr& value); | 56 std::ostream& operator<<(std::ostream& os, |
| 57 std::ostream& operator<<( | 57 const MultiplexedMediaTypeSetDetailsPtr& value); |
| 58 std::ostream& os, | 58 std::ostream& operator<<(std::ostream& os, |
| 59 const MultiplexedMediaTypeSetDetailsPtr& value); | 59 const LpcmMediaTypeDetailsPtr& value); |
| 60 std::ostream& operator<<( | 60 std::ostream& operator<<(std::ostream& os, |
| 61 std::ostream& os, | 61 const LpcmMediaTypeSetDetailsPtr& value); |
| 62 const LpcmMediaTypeDetailsPtr& value); | 62 std::ostream& operator<<(std::ostream& os, |
| 63 std::ostream& operator<<( | 63 const CompressedAudioMediaTypeDetailsPtr& value); |
| 64 std::ostream& os, | 64 std::ostream& operator<<(std::ostream& os, |
| 65 const LpcmMediaTypeSetDetailsPtr& value); | 65 const CompressedAudioMediaTypeSetDetailsPtr& value); |
| 66 std::ostream& operator<<( | 66 std::ostream& operator<<(std::ostream& os, |
| 67 std::ostream& os, | 67 const VideoMediaTypeDetailsPtr& value); |
| 68 const CompressedAudioMediaTypeDetailsPtr& value); | 68 std::ostream& operator<<(std::ostream& os, |
| 69 std::ostream& operator<<( | 69 const VideoMediaTypeSetDetailsPtr& value); |
| 70 std::ostream& os, | 70 std::ostream& operator<<(std::ostream& os, |
| 71 const CompressedAudioMediaTypeSetDetailsPtr& value); | 71 const MediaSourceStreamDescriptorPtr& value); |
| 72 std::ostream& operator<<( | 72 std::ostream& operator<<(std::ostream& os, const TimelineQuadPtr& value); |
| 73 std::ostream& os, | 73 std::ostream& operator<<(std::ostream& os, const TimelineTransformPtr& value); |
| 74 const VideoMediaTypeDetailsPtr& value); | |
| 75 std::ostream& operator<<( | |
| 76 std::ostream& os, | |
| 77 const VideoMediaTypeSetDetailsPtr& value); | |
| 78 std::ostream& operator<<( | |
| 79 std::ostream& os, | |
| 80 const MediaSourceStreamDescriptorPtr& value); | |
| 81 std::ostream& operator<<( | |
| 82 std::ostream& os, | |
| 83 const TimelineQuadPtr& value); | |
| 84 std::ostream& operator<<( | |
| 85 std::ostream& os, | |
| 86 const TimelineTransformPtr& value); | |
| 87 | 74 |
| 88 } // namespace media | 75 } // namespace media |
| 89 } // namespace mojo | 76 } // namespace mojo |
| 90 | 77 |
| 91 #endif // SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_FORMATTING_H_ | 78 #endif // SERVICES_MEDIA_FRAMEWORK_MOJO_MOJO_FORMATTING_H_ |
| OLD | NEW |