OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 case AV_CODEC_ID_AMR_WB: | 85 case AV_CODEC_ID_AMR_WB: |
86 return kCodecAMR_WB; | 86 return kCodecAMR_WB; |
87 case AV_CODEC_ID_GSM_MS: | 87 case AV_CODEC_ID_GSM_MS: |
88 return kCodecGSM_MS; | 88 return kCodecGSM_MS; |
89 case AV_CODEC_ID_PCM_ALAW: | 89 case AV_CODEC_ID_PCM_ALAW: |
90 return kCodecPCM_ALAW; | 90 return kCodecPCM_ALAW; |
91 case AV_CODEC_ID_PCM_MULAW: | 91 case AV_CODEC_ID_PCM_MULAW: |
92 return kCodecPCM_MULAW; | 92 return kCodecPCM_MULAW; |
93 case AV_CODEC_ID_OPUS: | 93 case AV_CODEC_ID_OPUS: |
94 return kCodecOpus; | 94 return kCodecOpus; |
| 95 case AV_CODEC_ID_ALAC: |
| 96 return kCodecALAC; |
95 default: | 97 default: |
96 DVLOG(1) << "Unknown audio CodecID: " << codec_id; | 98 DVLOG(1) << "Unknown audio CodecID: " << codec_id; |
97 } | 99 } |
98 return kUnknownAudioCodec; | 100 return kUnknownAudioCodec; |
99 } | 101 } |
100 | 102 |
101 static AVCodecID AudioCodecToCodecID(AudioCodec audio_codec, | 103 static AVCodecID AudioCodecToCodecID(AudioCodec audio_codec, |
102 SampleFormat sample_format) { | 104 SampleFormat sample_format) { |
103 switch (audio_codec) { | 105 switch (audio_codec) { |
104 case kCodecAAC: | 106 case kCodecAAC: |
105 return AV_CODEC_ID_AAC; | 107 return AV_CODEC_ID_AAC; |
| 108 case kCodecALAC: |
| 109 return AV_CODEC_ID_ALAC; |
106 case kCodecMP3: | 110 case kCodecMP3: |
107 return AV_CODEC_ID_MP3; | 111 return AV_CODEC_ID_MP3; |
108 case kCodecPCM: | 112 case kCodecPCM: |
109 switch (sample_format) { | 113 switch (sample_format) { |
110 case kSampleFormatU8: | 114 case kSampleFormatU8: |
111 return AV_CODEC_ID_PCM_U8; | 115 return AV_CODEC_ID_PCM_U8; |
112 case kSampleFormatS16: | 116 case kSampleFormatS16: |
113 return AV_CODEC_ID_PCM_S16LE; | 117 return AV_CODEC_ID_PCM_S16LE; |
114 case kSampleFormatS32: | 118 case kSampleFormatS32: |
115 return AV_CODEC_ID_PCM_S24LE; | 119 return AV_CODEC_ID_PCM_S24LE; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 case AV_SAMPLE_FMT_U8: | 239 case AV_SAMPLE_FMT_U8: |
236 return kSampleFormatU8; | 240 return kSampleFormatU8; |
237 case AV_SAMPLE_FMT_S16: | 241 case AV_SAMPLE_FMT_S16: |
238 return kSampleFormatS16; | 242 return kSampleFormatS16; |
239 case AV_SAMPLE_FMT_S32: | 243 case AV_SAMPLE_FMT_S32: |
240 return kSampleFormatS32; | 244 return kSampleFormatS32; |
241 case AV_SAMPLE_FMT_FLT: | 245 case AV_SAMPLE_FMT_FLT: |
242 return kSampleFormatF32; | 246 return kSampleFormatF32; |
243 case AV_SAMPLE_FMT_S16P: | 247 case AV_SAMPLE_FMT_S16P: |
244 return kSampleFormatPlanarS16; | 248 return kSampleFormatPlanarS16; |
| 249 case AV_SAMPLE_FMT_S32P: |
| 250 return kSampleFormatPlanarS32; |
245 case AV_SAMPLE_FMT_FLTP: | 251 case AV_SAMPLE_FMT_FLTP: |
246 return kSampleFormatPlanarF32; | 252 return kSampleFormatPlanarF32; |
247 default: | 253 default: |
248 DVLOG(1) << "Unknown AVSampleFormat: " << sample_format; | 254 DVLOG(1) << "Unknown AVSampleFormat: " << sample_format; |
249 } | 255 } |
250 return kUnknownSampleFormat; | 256 return kUnknownSampleFormat; |
251 } | 257 } |
252 | 258 |
253 static AVSampleFormat SampleFormatToAVSampleFormat(SampleFormat sample_format) { | 259 static AVSampleFormat SampleFormatToAVSampleFormat(SampleFormat sample_format) { |
254 switch (sample_format) { | 260 switch (sample_format) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 return false; | 599 return false; |
594 | 600 |
595 *out = parsed_time; | 601 *out = parsed_time; |
596 return true; | 602 return true; |
597 } | 603 } |
598 | 604 |
599 return false; | 605 return false; |
600 } | 606 } |
601 | 607 |
602 } // namespace media | 608 } // namespace media |
OLD | NEW |