Chromium Code Reviews| Index: media/base/android/demuxer_stream_player_params.cc |
| diff --git a/media/base/android/demuxer_stream_player_params.cc b/media/base/android/demuxer_stream_player_params.cc |
| index 5c2a11fc28498ec31a40e71158b8da4181d1fd8e..3b81553b6449222b408d11f6c387bab508e6ec7b 100644 |
| --- a/media/base/android/demuxer_stream_player_params.cc |
| +++ b/media/base/android/demuxer_stream_player_params.cc |
| @@ -26,4 +26,74 @@ DemuxerData::DemuxerData() : type(DemuxerStream::UNKNOWN) {} |
| DemuxerData::~DemuxerData() {} |
| +#undef RETURN_STRING |
| +#define RETURN_STRING(x) \ |
| + case x: \ |
| + return #x; |
| + |
| +const char* AsString(AudioCodec codec) { |
|
wolenetz
2015/06/22 21:41:22
nit: should these two AsString be static (private
Tima Vaisburd
2015/06/22 22:31:52
Done.
|
| + switch (codec) { |
| + RETURN_STRING(kUnknownAudioCodec); |
| + RETURN_STRING(kCodecAAC); |
| + RETURN_STRING(kCodecMP3); |
| + RETURN_STRING(kCodecPCM); |
| + RETURN_STRING(kCodecVorbis); |
| + RETURN_STRING(kCodecFLAC); |
| + RETURN_STRING(kCodecAMR_NB); |
| + RETURN_STRING(kCodecAMR_WB); |
| + RETURN_STRING(kCodecPCM_MULAW); |
| + RETURN_STRING(kCodecGSM_MS); |
| + RETURN_STRING(kCodecPCM_S16BE); |
| + RETURN_STRING(kCodecPCM_S24BE); |
| + RETURN_STRING(kCodecOpus); |
| + RETURN_STRING(kCodecPCM_ALAW); |
| + RETURN_STRING(kCodecALAC); |
| + default: |
|
wolenetz
2015/06/22 21:41:21
Here and in the next switch, remove the default ca
Tima Vaisburd
2015/06/22 22:31:52
Done. Compilation fails, indeed, with "enumeration
|
| + return "Unknown AudioCodec"; |
| + } |
| +} |
| + |
| +const char* AsString(VideoCodec codec) { |
| + switch (codec) { |
| + RETURN_STRING(kUnknownVideoCodec); |
| + RETURN_STRING(kCodecH264); |
| + RETURN_STRING(kCodecVC1); |
| + RETURN_STRING(kCodecMPEG2); |
| + RETURN_STRING(kCodecMPEG4); |
| + RETURN_STRING(kCodecTheora); |
| + RETURN_STRING(kCodecVP8); |
| + RETURN_STRING(kCodecVP9); |
| + default: |
|
wolenetz
2015/06/22 21:41:22
ditto
Tima Vaisburd
2015/06/22 22:31:52
Done.
|
| + return "Unknown VideoCodec"; |
| + } |
| +} |
| + |
| +#undef RETURN_STRING |
| + |
| } // namespace media |
| + |
| +std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au) { |
| + os << "status:" << au.status << (au.is_end_of_stream ? " EOS" : "") |
| + << (au.is_key_frame ? " KEY_FRAME" : "") << " pts:" << au.timestamp |
| + << " size:" << au.data.size(); |
| + return os; |
| +} |
| + |
| +std::ostream& operator<<(std::ostream& os, const media::DemuxerConfigs& conf) { |
| + os << conf.duration; |
| + |
| + if (conf.audio_codec != media::kUnknownAudioCodec) { |
|
wolenetz
2015/06/22 21:41:22
nit: if kUnknownAudioCodec, that's interesting, to
Tima Vaisburd
2015/06/22 22:31:52
I added the log if both are unknown. If at least o
|
| + os << " audio:" << media::AsString(conf.audio_codec) |
| + << " channels:" << conf.audio_channels |
| + << " rate:" << conf.audio_sampling_rate |
| + << (conf.is_audio_encrypted ? " encrypted" : ""); |
| + } |
| + |
| + if (conf.video_codec != media::kUnknownVideoCodec) { |
|
wolenetz
2015/06/22 21:41:22
nit ditto (kUnknownVideoCodec)
|
| + os << " video:" << media::AsString(conf.video_codec) << " " |
| + << conf.video_size.width() << "x" << conf.video_size.height() |
| + << (conf.is_video_encrypted ? " encrypted" : ""); |
| + } |
| + |
| + return os; |
| +} |