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

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

Issue 1685683004: Move media::AudioCodec to its own source file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix date and commit message Created 4 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 unified diff | Download patch
OLDNEW
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/filters/ffmpeg_audio_decoder.h" 5 #include "media/filters/ffmpeg_audio_decoder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 // Now create an AVBufferRef for the data just allocated. It will own the 122 // Now create an AVBufferRef for the data just allocated. It will own the
123 // reference to the AudioBuffer object. 123 // reference to the AudioBuffer object.
124 void* opaque = NULL; 124 void* opaque = NULL;
125 buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque)); 125 buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque));
126 frame->buf[0] = av_buffer_create( 126 frame->buf[0] = av_buffer_create(
127 frame->data[0], buffer_size_in_bytes, ReleaseAudioBufferImpl, opaque, 0); 127 frame->data[0], buffer_size_in_bytes, ReleaseAudioBufferImpl, opaque, 0);
128 return 0; 128 return 0;
129 } 129 }
130 130
131 // static
132 bool FFmpegAudioDecoder::IsCodecSupported(AudioCodec codec,
133 SampleFormat sample_format) {
134 FFmpegGlue::InitializeFFmpeg();
135 return avcodec_find_decoder(AudioCodecToCodecID(codec, sample_format)) !=
136 nullptr;
137 }
138
131 FFmpegAudioDecoder::FFmpegAudioDecoder( 139 FFmpegAudioDecoder::FFmpegAudioDecoder(
132 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 140 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
133 const scoped_refptr<MediaLog>& media_log) 141 const scoped_refptr<MediaLog>& media_log)
134 : task_runner_(task_runner), 142 : task_runner_(task_runner),
135 state_(kUninitialized), 143 state_(kUninitialized),
136 av_sample_format_(0), 144 av_sample_format_(0),
137 media_log_(media_log) { 145 media_log_(media_log) {
138 } 146 }
139 147
140 FFmpegAudioDecoder::~FFmpegAudioDecoder() { 148 FFmpegAudioDecoder::~FFmpegAudioDecoder() {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return true; 395 return true;
388 } 396 }
389 397
390 void FFmpegAudioDecoder::ResetTimestampState() { 398 void FFmpegAudioDecoder::ResetTimestampState() {
391 discard_helper_.reset(new AudioDiscardHelper(config_.samples_per_second(), 399 discard_helper_.reset(new AudioDiscardHelper(config_.samples_per_second(),
392 config_.codec_delay())); 400 config_.codec_delay()));
393 discard_helper_->Reset(config_.codec_delay()); 401 discard_helper_->Reset(config_.codec_delay());
394 } 402 }
395 403
396 } // namespace media 404 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698