OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/filters/ffmpeg_audio_decoder.h" | 5 #include "media/filters/ffmpeg_audio_decoder.h" |
6 | 6 |
7 #include "media/base/callback.h" | 7 #include "media/base/callback.h" |
8 #include "media/base/data_buffer.h" | 8 #include "media/base/data_buffer.h" |
9 #include "media/base/limits.h" | 9 #include "media/base/limits.h" |
10 #include "media/ffmpeg/ffmpeg_common.h" | 10 #include "media/ffmpeg/ffmpeg_common.h" |
11 #include "media/filters/ffmpeg_demuxer.h" | 11 #include "media/filters/ffmpeg_demuxer.h" |
12 | 12 |
13 #if !defined(USE_SSE) | 13 #if !defined(USE_SSE) |
14 #if defined(__SSE__) || defined(ARCH_CPU_X86_64) || _M_IX86_FP==1 | 14 #if defined(__SSE__) || defined(ARCH_CPU_X86_64) || _M_IX86_FP==1 |
15 #define USE_SSE 1 | 15 #define USE_SSE 1 |
16 #else | 16 #else |
17 #define USE_SSE 0 | 17 #define USE_SSE 0 |
18 #endif | 18 #endif |
19 #endif | 19 #endif |
20 #if USE_SSE | 20 #if USE_SSE |
21 #include <emmintrin.h> | 21 #include <xmmintrin.h> |
22 #endif | 22 #endif |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 | 25 |
26 // Size of the decoded audio buffer. | 26 // Size of the decoded audio buffer. |
27 const size_t FFmpegAudioDecoder::kOutputBufferSize = | 27 const size_t FFmpegAudioDecoder::kOutputBufferSize = |
28 AVCODEC_MAX_AUDIO_FRAME_SIZE; | 28 AVCODEC_MAX_AUDIO_FRAME_SIZE; |
29 | 29 |
30 FFmpegAudioDecoder::FFmpegAudioDecoder() | 30 FFmpegAudioDecoder::FFmpegAudioDecoder() |
31 : codec_context_(NULL), | 31 : codec_context_(NULL), |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) { | 245 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) { |
246 int64 denominator = codec_context_->channels * | 246 int64 denominator = codec_context_->channels * |
247 av_get_bits_per_sample_format(codec_context_->sample_fmt) / 8 * | 247 av_get_bits_per_sample_format(codec_context_->sample_fmt) / 8 * |
248 codec_context_->sample_rate; | 248 codec_context_->sample_rate; |
249 double microseconds = size / | 249 double microseconds = size / |
250 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); | 250 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); |
251 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); | 251 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); |
252 } | 252 } |
253 | 253 |
254 } // namespace | 254 } // namespace |
OLD | NEW |