1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_
6 #define MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_
10 #include "media/base/android/media_decoder_job.h"
14 class AudioCodecBridge
;
15 class AudioTimestampHelper
;
17 // Class for managing audio decoding jobs.
18 class AudioDecoderJob
: public MediaDecoderJob
{
20 virtual ~AudioDecoderJob();
22 // Creates a new AudioDecoderJob instance for decoding audio.
23 // |audio_codec| - The audio format the object needs to decode.
24 // |sample_rate| - The sample rate of the decoded output.
25 // |channel_count| - The number of channels in the decoded output.
26 // |extra_data|, |extra_data_size| - Extra data buffer needed for initializing
28 // |media_crypto| - Handle to a Java object that handles the encryption for
30 // |request_data_cb| - Callback used to request more data for the decoder.
31 static AudioDecoderJob
* Create(
32 const AudioCodec audio_codec
, int sample_rate
, int channel_count
,
33 const uint8
* extra_data
, size_t extra_data_size
, jobject media_crypto
,
34 const base::Closure
& request_data_cb
);
36 void SetVolume(double volume
);
38 // Sets the base timestamp for |audio_timestamp_helper_|.
39 void SetBaseTimestamp(base::TimeDelta base_timestamp
);
42 AudioDecoderJob(scoped_ptr
<AudioTimestampHelper
> audio_timestamp_helper
,
43 scoped_ptr
<AudioCodecBridge
> audio_decoder_bridge
,
45 const base::Closure
& request_data_cb
);
47 // MediaDecoderJob implementation.
48 virtual void ReleaseOutputBuffer(
49 int output_buffer_index
,
52 base::TimeDelta current_presentation_timestamp
,
53 const ReleaseOutputCompletionCallback
& callback
) OVERRIDE
;
55 virtual bool ComputeTimeToRender() const OVERRIDE
;
57 // number of bytes per audio frame;
60 scoped_ptr
<AudioCodecBridge
> audio_codec_bridge_
;
62 // Object to calculate the current audio timestamp for A/V sync.
63 scoped_ptr
<AudioTimestampHelper
> audio_timestamp_helper_
;
68 #endif // MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_