OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // source code is governed by a BSD-style license that can be found in the | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // 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/filters/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 namespace media { | 13 namespace media { |
14 | 14 |
15 // Size of the decoded audio buffer. | 15 // Size of the decoded audio buffer. |
16 const size_t FFmpegAudioDecoder::kOutputBufferSize = | 16 const size_t FFmpegAudioDecoder::kOutputBufferSize = |
17 AVCODEC_MAX_AUDIO_FRAME_SIZE; | 17 AVCODEC_MAX_AUDIO_FRAME_SIZE; |
18 | 18 |
19 FFmpegAudioDecoder::FFmpegAudioDecoder() | 19 FFmpegAudioDecoder::FFmpegAudioDecoder() |
20 : codec_context_(NULL) { | 20 : codec_context_(NULL) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) { | 192 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) { |
193 int64 denominator = codec_context_->channels * | 193 int64 denominator = codec_context_->channels * |
194 av_get_bits_per_sample_format(codec_context_->sample_fmt) / 8 * | 194 av_get_bits_per_sample_format(codec_context_->sample_fmt) / 8 * |
195 codec_context_->sample_rate; | 195 codec_context_->sample_rate; |
196 double microseconds = size / | 196 double microseconds = size / |
197 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); | 197 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); |
198 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); | 198 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); |
199 } | 199 } |
200 | 200 |
201 } // namespace | 201 } // namespace |
OLD | NEW |