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

Unified Diff: media/filters/audio_file_reader.cc

Issue 9317096: Fix media code to work with new ffmpeg. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix years. Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/ffmpeg/file_protocol.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_file_reader.cc
diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
index bf26aff81c2ea77cf0a0f0c24b9f0ec24975b4ad..138d89e2e10d2f3317db1fafdc37c10cd542292a 100644
--- a/media/filters/audio_file_reader.cc
+++ b/media/filters/audio_file_reader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -51,15 +51,15 @@ bool AudioFileReader::Open() {
DCHECK(!format_context_);
AVFormatContext* context = NULL;
- int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL);
+ int result = avformat_open_input(&context, key.c_str(), NULL, NULL);
- // Remove our data reader from protocol list since av_open_input_file() setup
+ // Remove our data reader from protocol list since avformat_open_input() setup
// the AVFormatContext with the data reader.
FFmpegGlue::GetInstance()->RemoveProtocol(protocol_);
if (result) {
DLOG(WARNING)
- << "AudioFileReader::Open() : error in av_open_input_file() -"
+ << "AudioFileReader::Open() : error in avformat_open_input() -"
<< " result: " << result;
return false;
}
@@ -81,10 +81,10 @@ bool AudioFileReader::Open() {
if (!codec_context_)
return false;
- av_find_stream_info(format_context_);
+ avformat_find_stream_info(format_context_, NULL);
codec_ = avcodec_find_decoder(codec_context_->codec_id);
if (codec_) {
- if ((result = avcodec_open(codec_context_, codec_)) < 0) {
+ if ((result = avcodec_open2(codec_context_, codec_, NULL)) < 0) {
DLOG(WARNING) << "AudioFileReader::Open() : could not open codec -"
<< " result: " << result;
return false;
@@ -112,7 +112,7 @@ void AudioFileReader::Close() {
codec_ = NULL;
if (format_context_) {
- av_close_input_file(format_context_);
+ avformat_close_input(&format_context_);
format_context_ = NULL;
}
}
@@ -157,7 +157,7 @@ bool AudioFileReader::Read(const std::vector<float*>& audio_data,
// Determine the number of sample-frames we just decoded.
size_t bytes_per_sample =
- av_get_bits_per_sample_fmt(codec_context_->sample_fmt) >> 3;
+ av_get_bytes_per_sample(codec_context_->sample_fmt);
size_t frames_read = out_size / (channels * bytes_per_sample);
// Truncate, if necessary, if the destination isn't big enough.
« no previous file with comments | « media/ffmpeg/file_protocol.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698