OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/audio_codecs.h" | 5 #include "media/base/audio_codecs.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 26 matching lines...) Expand all Loading... |
37 case kCodecOpus: | 37 case kCodecOpus: |
38 return "opus"; | 38 return "opus"; |
39 case kCodecPCM_ALAW: | 39 case kCodecPCM_ALAW: |
40 return "pcm_alaw"; | 40 return "pcm_alaw"; |
41 case kCodecEAC3: | 41 case kCodecEAC3: |
42 return "eac3"; | 42 return "eac3"; |
43 case kCodecALAC: | 43 case kCodecALAC: |
44 return "alac"; | 44 return "alac"; |
45 case kCodecAC3: | 45 case kCodecAC3: |
46 return "ac3"; | 46 return "ac3"; |
| 47 case kCodecRaw: |
| 48 return "raw"; |
47 } | 49 } |
48 NOTREACHED(); | 50 NOTREACHED(); |
49 return ""; | 51 return ""; |
50 } | 52 } |
51 | 53 |
52 AudioCodec StringToAudioCodec(const std::string& codec_id) { | 54 AudioCodec StringToAudioCodec(const std::string& codec_id) { |
53 if (codec_id == "aac") | 55 if (codec_id == "aac") |
54 return kCodecAAC; | 56 return kCodecAAC; |
55 if (codec_id == "ac-3" || codec_id == "mp4a.A5") | 57 if (codec_id == "ac-3" || codec_id == "mp4a.A5") |
56 return kCodecAC3; | 58 return kCodecAC3; |
57 if (codec_id == "ec-3" || codec_id == "mp4a.A6") | 59 if (codec_id == "ec-3" || codec_id == "mp4a.A6") |
58 return kCodecEAC3; | 60 return kCodecEAC3; |
59 if (codec_id == "mp3") | 61 if (codec_id == "mp3") |
60 return kCodecMP3; | 62 return kCodecMP3; |
61 if (codec_id == "alac") | 63 if (codec_id == "alac") |
62 return kCodecALAC; | 64 return kCodecALAC; |
63 if (codec_id == "flac") | 65 if (codec_id == "flac") |
64 return kCodecFLAC; | 66 return kCodecFLAC; |
65 if (codec_id == "opus") | 67 if (codec_id == "opus") |
66 return kCodecOpus; | 68 return kCodecOpus; |
67 if (codec_id == "vorbis") | 69 if (codec_id == "vorbis") |
68 return kCodecVorbis; | 70 return kCodecVorbis; |
69 if (base::StartsWith(codec_id, "mp4a.40.", base::CompareCase::SENSITIVE)) | 71 if (base::StartsWith(codec_id, "mp4a.40.", base::CompareCase::SENSITIVE)) |
70 return kCodecAAC; | 72 return kCodecAAC; |
71 return kUnknownAudioCodec; | 73 return kUnknownAudioCodec; |
72 } | 74 } |
73 | 75 |
74 } // namespace media | 76 } // namespace media |
OLD | NEW |