Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 10452004: Add GSM_MS and PCM_ALAW codecs to CrOS FFMPEG. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 15 matching lines...) Expand all
26 case CODEC_ID_AAC: 26 case CODEC_ID_AAC:
27 return kCodecAAC; 27 return kCodecAAC;
28 case CODEC_ID_MP3: 28 case CODEC_ID_MP3:
29 return kCodecMP3; 29 return kCodecMP3;
30 case CODEC_ID_VORBIS: 30 case CODEC_ID_VORBIS:
31 return kCodecVorbis; 31 return kCodecVorbis;
32 case CODEC_ID_PCM_U8: 32 case CODEC_ID_PCM_U8:
33 case CODEC_ID_PCM_S16LE: 33 case CODEC_ID_PCM_S16LE:
34 case CODEC_ID_PCM_S24LE: 34 case CODEC_ID_PCM_S24LE:
35 return kCodecPCM; 35 return kCodecPCM;
36 case CODEC_ID_PCM_S16BE:
37 return kCodecPCM_S16BE;
38 case CODEC_ID_PCM_S24BE:
39 return kCodecPCM_S24BE;
36 case CODEC_ID_FLAC: 40 case CODEC_ID_FLAC:
37 return kCodecFLAC; 41 return kCodecFLAC;
38 case CODEC_ID_AMR_NB: 42 case CODEC_ID_AMR_NB:
39 return kCodecAMR_NB; 43 return kCodecAMR_NB;
40 case CODEC_ID_AMR_WB: 44 case CODEC_ID_AMR_WB:
41 return kCodecAMR_WB; 45 return kCodecAMR_WB;
46 case CODEC_ID_GSM_MS:
47 return kCodecGSM_MS;
42 case CODEC_ID_PCM_MULAW: 48 case CODEC_ID_PCM_MULAW:
43 return kCodecPCM_MULAW; 49 return kCodecPCM_MULAW;
44 default: 50 default:
45 DVLOG(1) << "Unknown audio CodecID: " << codec_id; 51 DVLOG(1) << "Unknown audio CodecID: " << codec_id;
46 } 52 }
47 return kUnknownAudioCodec; 53 return kUnknownAudioCodec;
48 } 54 }
49 55
50 static CodecID AudioCodecToCodecID(AudioCodec audio_codec, 56 static CodecID AudioCodecToCodecID(AudioCodec audio_codec,
51 int bits_per_channel) { 57 int bits_per_channel) {
52 switch (audio_codec) { 58 switch (audio_codec) {
53 case kCodecAAC: 59 case kCodecAAC:
54 return CODEC_ID_AAC; 60 return CODEC_ID_AAC;
55 case kCodecMP3: 61 case kCodecMP3:
56 return CODEC_ID_MP3; 62 return CODEC_ID_MP3;
57 case kCodecPCM: 63 case kCodecPCM:
58 switch (bits_per_channel) { 64 switch (bits_per_channel) {
59 case 8: 65 case 8:
60 return CODEC_ID_PCM_U8; 66 return CODEC_ID_PCM_U8;
61 case 16: 67 case 16:
62 return CODEC_ID_PCM_S16LE; 68 return CODEC_ID_PCM_S16LE;
63 case 32: 69 case 32:
64 return CODEC_ID_PCM_S24LE; 70 return CODEC_ID_PCM_S24LE;
65 default: 71 default:
66 DVLOG(1) << "Unsupported bits per channel: " << bits_per_channel; 72 DVLOG(1) << "Unsupported bits per channel: " << bits_per_channel;
67 } 73 }
68 break; 74 break;
75 case kCodecPCM_S16BE:
76 return CODEC_ID_PCM_S16BE;
77 case kCodecPCM_S24BE:
78 return CODEC_ID_PCM_S24BE;
69 case kCodecVorbis: 79 case kCodecVorbis:
70 return CODEC_ID_VORBIS; 80 return CODEC_ID_VORBIS;
71 case kCodecFLAC: 81 case kCodecFLAC:
72 return CODEC_ID_FLAC; 82 return CODEC_ID_FLAC;
73 case kCodecAMR_NB: 83 case kCodecAMR_NB:
74 return CODEC_ID_AMR_NB; 84 return CODEC_ID_AMR_NB;
75 case kCodecAMR_WB: 85 case kCodecAMR_WB:
76 return CODEC_ID_AMR_WB; 86 return CODEC_ID_AMR_WB;
87 case kCodecGSM_MS:
88 return CODEC_ID_GSM_MS;
77 case kCodecPCM_MULAW: 89 case kCodecPCM_MULAW:
78 return CODEC_ID_PCM_MULAW; 90 return CODEC_ID_PCM_MULAW;
79 default: 91 default:
80 DVLOG(1) << "Unknown AudioCodec: " << audio_codec; 92 DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
81 } 93 }
82 return CODEC_ID_NONE; 94 return CODEC_ID_NONE;
83 } 95 }
84 96
85 VideoCodec CodecIDToVideoCodec(CodecID codec_id) { 97 VideoCodec CodecIDToVideoCodec(CodecID codec_id) {
86 switch (codec_id) { 98 switch (codec_id) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 avcodec_close(stream->codec); 393 avcodec_close(stream->codec);
382 } 394 }
383 } 395 }
384 } 396 }
385 397
386 // Then finally cleanup the format context. 398 // Then finally cleanup the format context.
387 avformat_close_input(&format_context); 399 avformat_close_input(&format_context);
388 } 400 }
389 401
390 } // namespace media 402 } // namespace media
OLDNEW
« media/base/audio_decoder_config.h ('K') | « media/base/audio_decoder_config.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698