| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "media/base/android/demuxer_stream_player_params.h" | |
| 6 #include <iomanip> | |
| 7 | |
| 8 namespace media { | |
| 9 | |
| 10 DemuxerConfigs::DemuxerConfigs() | |
| 11 : audio_codec(kUnknownAudioCodec), | |
| 12 audio_channels(0), | |
| 13 audio_sampling_rate(0), | |
| 14 is_audio_encrypted(false), | |
| 15 audio_codec_delay_ns(-1), | |
| 16 audio_seek_preroll_ns(-1), | |
| 17 video_codec(kUnknownVideoCodec), | |
| 18 is_video_encrypted(false) {} | |
| 19 | |
| 20 DemuxerConfigs::DemuxerConfigs(const DemuxerConfigs& other) = default; | |
| 21 | |
| 22 DemuxerConfigs::~DemuxerConfigs() {} | |
| 23 | |
| 24 AccessUnit::AccessUnit() : is_end_of_stream(false), is_key_frame(false) {} | |
| 25 | |
| 26 AccessUnit::AccessUnit(const AccessUnit& other) = default; | |
| 27 | |
| 28 AccessUnit::~AccessUnit() {} | |
| 29 | |
| 30 DemuxerData::DemuxerData() : type(DemuxerStream::UNKNOWN) {} | |
| 31 | |
| 32 DemuxerData::DemuxerData(const DemuxerData& other) = default; | |
| 33 | |
| 34 DemuxerData::~DemuxerData() {} | |
| 35 | |
| 36 namespace { | |
| 37 | |
| 38 const char* AsString(DemuxerStream::Type stream_type) { | |
| 39 switch (stream_type) { | |
| 40 case DemuxerStream::UNKNOWN: | |
| 41 return "UNKNOWN"; | |
| 42 case DemuxerStream::AUDIO: | |
| 43 return "AUDIO"; | |
| 44 case DemuxerStream::VIDEO: | |
| 45 return "VIDEO"; | |
| 46 case DemuxerStream::TEXT: | |
| 47 return "TEXT"; | |
| 48 case DemuxerStream::NUM_TYPES: | |
| 49 return "NUM_TYPES"; | |
| 50 } | |
| 51 NOTREACHED(); | |
| 52 return nullptr; // crash early | |
| 53 } | |
| 54 | |
| 55 const char* AsString(DemuxerStream::Status status) { | |
| 56 switch (status) { | |
| 57 case DemuxerStream::kOk: | |
| 58 return "kOk"; | |
| 59 case DemuxerStream::kAborted: | |
| 60 return "kAborted"; | |
| 61 case DemuxerStream::kConfigChanged: | |
| 62 return "kConfigChanged"; | |
| 63 } | |
| 64 NOTREACHED(); | |
| 65 return nullptr; // crash early | |
| 66 } | |
| 67 | |
| 68 } // namespace (anonymous) | |
| 69 | |
| 70 } // namespace media | |
| 71 | |
| 72 std::ostream& operator<<(std::ostream& os, media::DemuxerStream::Type type) { | |
| 73 os << media::AsString(type); | |
| 74 return os; | |
| 75 } | |
| 76 | |
| 77 std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au) { | |
| 78 os << "status:" << media::AsString(au.status) | |
| 79 << (au.is_end_of_stream ? " EOS" : "") | |
| 80 << (au.is_key_frame ? " KEY_FRAME" : "") << " pts:" << au.timestamp | |
| 81 << " size:" << au.data.size(); | |
| 82 return os; | |
| 83 } | |
| 84 | |
| 85 std::ostream& operator<<(std::ostream& os, const media::DemuxerConfigs& conf) { | |
| 86 os << "duration:" << conf.duration; | |
| 87 | |
| 88 if (conf.audio_codec == media::kUnknownAudioCodec && | |
| 89 conf.video_codec == media::kUnknownVideoCodec) { | |
| 90 os << " no audio, no video"; | |
| 91 return os; | |
| 92 } | |
| 93 | |
| 94 if (conf.audio_codec != media::kUnknownAudioCodec) { | |
| 95 os << " audio:" << media::GetCodecName(conf.audio_codec) | |
| 96 << " channels:" << conf.audio_channels | |
| 97 << " rate:" << conf.audio_sampling_rate | |
| 98 << (conf.is_audio_encrypted ? " encrypted" : "") | |
| 99 << " delay (ns):" << conf.audio_codec_delay_ns | |
| 100 << " preroll (ns):" << conf.audio_seek_preroll_ns; | |
| 101 | |
| 102 if (!conf.audio_extra_data.empty()) { | |
| 103 os << " extra:{" << std::hex; | |
| 104 for (uint8_t byte : conf.audio_extra_data) | |
| 105 os << " " << std::setfill('0') << std::setw(2) << (int)byte; | |
| 106 os << "}" << std::dec; | |
| 107 } | |
| 108 } | |
| 109 | |
| 110 if (conf.video_codec != media::kUnknownVideoCodec) { | |
| 111 os << " video:" << media::GetCodecName(conf.video_codec) << " " | |
| 112 << conf.video_size.width() << "x" << conf.video_size.height() | |
| 113 << (conf.is_video_encrypted ? " encrypted" : ""); | |
| 114 } | |
| 115 | |
| 116 return os; | |
| 117 } | |
| OLD | NEW |