OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/android/demuxer_stream_player_params.h" | 5 #include "media/base/android/demuxer_stream_player_params.h" |
6 #include <iomanip> | 6 #include <iomanip> |
7 | 7 |
8 namespace media { | 8 namespace media { |
9 | 9 |
10 DemuxerConfigs::DemuxerConfigs() | 10 DemuxerConfigs::DemuxerConfigs() |
(...skipping 11 matching lines...) Expand all Loading... |
22 AccessUnit::AccessUnit() : is_end_of_stream(false), is_key_frame(false) {} | 22 AccessUnit::AccessUnit() : is_end_of_stream(false), is_key_frame(false) {} |
23 | 23 |
24 AccessUnit::~AccessUnit() {} | 24 AccessUnit::~AccessUnit() {} |
25 | 25 |
26 DemuxerData::DemuxerData() : type(DemuxerStream::UNKNOWN) {} | 26 DemuxerData::DemuxerData() : type(DemuxerStream::UNKNOWN) {} |
27 | 27 |
28 DemuxerData::~DemuxerData() {} | 28 DemuxerData::~DemuxerData() {} |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
| 32 const char* AsString(DemuxerStream::Type stream_type) { |
| 33 switch (stream_type) { |
| 34 case DemuxerStream::UNKNOWN: |
| 35 return "UNKNOWN"; |
| 36 case DemuxerStream::AUDIO: |
| 37 return "AUDIO"; |
| 38 case DemuxerStream::VIDEO: |
| 39 return "VIDEO"; |
| 40 case DemuxerStream::TEXT: |
| 41 return "TEXT"; |
| 42 case DemuxerStream::NUM_TYPES: |
| 43 return "NUM_TYPES"; |
| 44 } |
| 45 NOTREACHED(); |
| 46 return nullptr; // crash early |
| 47 } |
| 48 |
32 #undef RETURN_STRING | 49 #undef RETURN_STRING |
33 #define RETURN_STRING(x) \ | 50 #define RETURN_STRING(x) \ |
34 case x: \ | 51 case x: \ |
35 return #x; | 52 return #x; |
36 | 53 |
37 const char* AsString(AudioCodec codec) { | 54 const char* AsString(AudioCodec codec) { |
38 switch (codec) { | 55 switch (codec) { |
39 RETURN_STRING(kUnknownAudioCodec); | 56 RETURN_STRING(kUnknownAudioCodec); |
40 RETURN_STRING(kCodecAAC); | 57 RETURN_STRING(kCodecAAC); |
41 RETURN_STRING(kCodecMP3); | 58 RETURN_STRING(kCodecMP3); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 NOTREACHED(); | 100 NOTREACHED(); |
84 return nullptr; // crash early | 101 return nullptr; // crash early |
85 } | 102 } |
86 | 103 |
87 #undef RETURN_STRING | 104 #undef RETURN_STRING |
88 | 105 |
89 } // namespace (anonymous) | 106 } // namespace (anonymous) |
90 | 107 |
91 } // namespace media | 108 } // namespace media |
92 | 109 |
| 110 std::ostream& operator<<(std::ostream& os, media::DemuxerStream::Type type) { |
| 111 os << media::AsString(type); |
| 112 return os; |
| 113 } |
| 114 |
93 std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au) { | 115 std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au) { |
94 os << "status:" << media::AsString(au.status) | 116 os << "status:" << media::AsString(au.status) |
95 << (au.is_end_of_stream ? " EOS" : "") | 117 << (au.is_end_of_stream ? " EOS" : "") |
96 << (au.is_key_frame ? " KEY_FRAME" : "") << " pts:" << au.timestamp | 118 << (au.is_key_frame ? " KEY_FRAME" : "") << " pts:" << au.timestamp |
97 << " size:" << au.data.size(); | 119 << " size:" << au.data.size(); |
98 return os; | 120 return os; |
99 } | 121 } |
100 | 122 |
101 std::ostream& operator<<(std::ostream& os, const media::DemuxerConfigs& conf) { | 123 std::ostream& operator<<(std::ostream& os, const media::DemuxerConfigs& conf) { |
102 os << "duration:" << conf.duration; | 124 os << "duration:" << conf.duration; |
(...skipping 21 matching lines...) Expand all Loading... |
124 } | 146 } |
125 | 147 |
126 if (conf.video_codec != media::kUnknownVideoCodec) { | 148 if (conf.video_codec != media::kUnknownVideoCodec) { |
127 os << " video:" << media::AsString(conf.video_codec) << " " | 149 os << " video:" << media::AsString(conf.video_codec) << " " |
128 << conf.video_size.width() << "x" << conf.video_size.height() | 150 << conf.video_size.width() << "x" << conf.video_size.height() |
129 << (conf.is_video_encrypted ? " encrypted" : ""); | 151 << (conf.is_video_encrypted ? " encrypted" : ""); |
130 } | 152 } |
131 | 153 |
132 return os; | 154 return os; |
133 } | 155 } |
OLD | NEW |