| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |