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

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

Issue 1685683004: Move media::AudioCodec to its own source file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "media/base/audio_decoder_config.h"
14 #include "media/base/decoder_buffer.h" 15 #include "media/base/decoder_buffer.h"
15 #include "media/base/video_decoder_config.h" 16 #include "media/base/video_decoder_config.h"
16 #include "media/base/video_util.h" 17 #include "media/base/video_util.h"
17 #include "media/media_features.h" 18 #include "media/media_features.h"
18 19
19 namespace media { 20 namespace media {
20 21
21 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are 22 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
22 // padded. Check here to ensure FFmpeg only receives data padded to its 23 // padded. Check here to ensure FFmpeg only receives data padded to its
23 // specifications. 24 // specifications.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 case AV_CODEC_ID_OPUS: 104 case AV_CODEC_ID_OPUS:
104 return kCodecOpus; 105 return kCodecOpus;
105 case AV_CODEC_ID_ALAC: 106 case AV_CODEC_ID_ALAC:
106 return kCodecALAC; 107 return kCodecALAC;
107 default: 108 default:
108 DVLOG(1) << "Unknown audio CodecID: " << codec_id; 109 DVLOG(1) << "Unknown audio CodecID: " << codec_id;
109 } 110 }
110 return kUnknownAudioCodec; 111 return kUnknownAudioCodec;
111 } 112 }
112 113
113 static AVCodecID AudioCodecToCodecID(AudioCodec audio_codec, 114 AVCodecID AudioCodecToCodecID(AudioCodec audio_codec,
114 SampleFormat sample_format) { 115 SampleFormat sample_format) {
115 switch (audio_codec) { 116 switch (audio_codec) {
116 case kCodecAAC: 117 case kCodecAAC:
117 return AV_CODEC_ID_AAC; 118 return AV_CODEC_ID_AAC;
118 case kCodecALAC: 119 case kCodecALAC:
119 return AV_CODEC_ID_ALAC; 120 return AV_CODEC_ID_ALAC;
120 case kCodecMP3: 121 case kCodecMP3:
121 return AV_CODEC_ID_MP3; 122 return AV_CODEC_ID_MP3;
122 case kCodecPCM: 123 case kCodecPCM:
123 switch (sample_format) { 124 switch (sample_format) {
124 case kSampleFormatU8: 125 case kSampleFormatU8:
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 760 }
760 761
761 int32_t HashCodecName(const char* codec_name) { 762 int32_t HashCodecName(const char* codec_name) {
762 // Use the first 32-bits from the SHA1 hash as the identifier. 763 // Use the first 32-bits from the SHA1 hash as the identifier.
763 int32_t hash; 764 int32_t hash;
764 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); 765 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4);
765 return hash; 766 return hash;
766 } 767 }
767 768
768 } // namespace media 769 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698