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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 555087: Refactor some code that depends on FFmpeg (Closed)
Patch Set: 2010 Created 10 years, 11 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/filters/bitstream_converter_unittest.cc ('k') | media/filters/ffmpeg_demuxer.h » ('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) 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
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
OLDNEW
« no previous file with comments | « media/filters/bitstream_converter_unittest.cc ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698