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 | 6 |
7 namespace media { | 7 namespace media { |
8 | 8 |
9 DemuxerConfigs::DemuxerConfigs() | 9 DemuxerConfigs::DemuxerConfigs() |
10 : audio_codec(kUnknownAudioCodec), | 10 : audio_codec(kUnknownAudioCodec), |
11 audio_channels(0), | 11 audio_channels(0), |
12 audio_sampling_rate(0), | 12 audio_sampling_rate(0), |
13 is_audio_encrypted(false), | 13 is_audio_encrypted(false), |
14 audio_codec_delay_ns(-1), | 14 audio_codec_delay_ns(-1), |
15 audio_seek_preroll_ns(-1), | 15 audio_seek_preroll_ns(-1), |
16 video_codec(kUnknownVideoCodec), | 16 video_codec(kUnknownVideoCodec), |
17 is_video_encrypted(false) {} | 17 is_video_encrypted(false) {} |
18 | 18 |
19 DemuxerConfigs::~DemuxerConfigs() {} | 19 DemuxerConfigs::~DemuxerConfigs() {} |
20 | 20 |
21 AccessUnit::AccessUnit() : is_end_of_stream(false), is_key_frame(false) {} | 21 AccessUnit::AccessUnit() : is_end_of_stream(false), is_key_frame(false) {} |
22 | 22 |
23 AccessUnit::~AccessUnit() {} | 23 AccessUnit::~AccessUnit() {} |
24 | 24 |
25 DemuxerData::DemuxerData() : type(DemuxerStream::UNKNOWN) {} | 25 DemuxerData::DemuxerData() : type(DemuxerStream::UNKNOWN) {} |
26 | 26 |
27 DemuxerData::~DemuxerData() {} | 27 DemuxerData::~DemuxerData() {} |
28 | 28 |
29 #undef RETURN_STRING | |
30 #define RETURN_STRING(x) \ | |
31 case x: \ | |
32 return #x; | |
33 | |
34 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.
| |
35 switch (codec) { | |
36 RETURN_STRING(kUnknownAudioCodec); | |
37 RETURN_STRING(kCodecAAC); | |
38 RETURN_STRING(kCodecMP3); | |
39 RETURN_STRING(kCodecPCM); | |
40 RETURN_STRING(kCodecVorbis); | |
41 RETURN_STRING(kCodecFLAC); | |
42 RETURN_STRING(kCodecAMR_NB); | |
43 RETURN_STRING(kCodecAMR_WB); | |
44 RETURN_STRING(kCodecPCM_MULAW); | |
45 RETURN_STRING(kCodecGSM_MS); | |
46 RETURN_STRING(kCodecPCM_S16BE); | |
47 RETURN_STRING(kCodecPCM_S24BE); | |
48 RETURN_STRING(kCodecOpus); | |
49 RETURN_STRING(kCodecPCM_ALAW); | |
50 RETURN_STRING(kCodecALAC); | |
51 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
| |
52 return "Unknown AudioCodec"; | |
53 } | |
54 } | |
55 | |
56 const char* AsString(VideoCodec codec) { | |
57 switch (codec) { | |
58 RETURN_STRING(kUnknownVideoCodec); | |
59 RETURN_STRING(kCodecH264); | |
60 RETURN_STRING(kCodecVC1); | |
61 RETURN_STRING(kCodecMPEG2); | |
62 RETURN_STRING(kCodecMPEG4); | |
63 RETURN_STRING(kCodecTheora); | |
64 RETURN_STRING(kCodecVP8); | |
65 RETURN_STRING(kCodecVP9); | |
66 default: | |
wolenetz
2015/06/22 21:41:22
ditto
Tima Vaisburd
2015/06/22 22:31:52
Done.
| |
67 return "Unknown VideoCodec"; | |
68 } | |
69 } | |
70 | |
71 #undef RETURN_STRING | |
72 | |
29 } // namespace media | 73 } // namespace media |
74 | |
75 std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au) { | |
76 os << "status:" << au.status << (au.is_end_of_stream ? " EOS" : "") | |
77 << (au.is_key_frame ? " KEY_FRAME" : "") << " pts:" << au.timestamp | |
78 << " size:" << au.data.size(); | |
79 return os; | |
80 } | |
81 | |
82 std::ostream& operator<<(std::ostream& os, const media::DemuxerConfigs& conf) { | |
83 os << conf.duration; | |
84 | |
85 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
| |
86 os << " audio:" << media::AsString(conf.audio_codec) | |
87 << " channels:" << conf.audio_channels | |
88 << " rate:" << conf.audio_sampling_rate | |
89 << (conf.is_audio_encrypted ? " encrypted" : ""); | |
90 } | |
91 | |
92 if (conf.video_codec != media::kUnknownVideoCodec) { | |
wolenetz
2015/06/22 21:41:22
nit ditto (kUnknownVideoCodec)
| |
93 os << " video:" << media::AsString(conf.video_codec) << " " | |
94 << conf.video_size.width() << "x" << conf.video_size.height() | |
95 << (conf.is_video_encrypted ? " encrypted" : ""); | |
96 } | |
97 | |
98 return os; | |
99 } | |
OLD | NEW |