Home | History | Annotate | Download | only in android
      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.
      4 
      5 #ifndef MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_
      6 #define MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_
      7 
      8 #include <jni.h>
      9 
     10 #include "media/base/android/media_decoder_job.h"
     11 
     12 namespace media {
     13 
     14 class AudioCodecBridge;
     15 
     16 // Class for managing audio decoding jobs.
     17 class AudioDecoderJob : public MediaDecoderJob {
     18  public:
     19   virtual ~AudioDecoderJob();
     20 
     21   // Creates a new AudioDecoderJob instance for decoding audio.
     22   // |audio_codec| - The audio format the object needs to decode.
     23   // |sample_rate| - The sample rate of the decoded output.
     24   // |channel_count| - The number of channels in the decoded output.
     25   // |extra_data|, |extra_data_size| - Extra data buffer needed for initializing
     26   // the decoder.
     27   // |media_crypto| - Handle to a Java object that handles the encryption for
     28   // the audio data.
     29   // |request_data_cb| - Callback used to request more data for the decoder.
     30   static AudioDecoderJob* Create(
     31       const AudioCodec audio_codec, int sample_rate, int channel_count,
     32       const uint8* extra_data, size_t extra_data_size, jobject media_crypto,
     33       const base::Closure& request_data_cb);
     34 
     35   void SetVolume(double volume);
     36 
     37  private:
     38   AudioDecoderJob(scoped_ptr<AudioCodecBridge> audio_decoder_bridge,
     39                   const base::Closure& request_data_cb);
     40 
     41   // MediaDecoderJob implementation.
     42   virtual void ReleaseOutputBuffer(
     43       int output_buffer_index,
     44       size_t size,
     45       bool render_output,
     46       const ReleaseOutputCompletionCallback& callback) OVERRIDE;
     47 
     48   virtual bool ComputeTimeToRender() const OVERRIDE;
     49 
     50   scoped_ptr<AudioCodecBridge> audio_codec_bridge_;
     51 };
     52 
     53 }  // namespace media
     54 
     55 #endif  // MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_
     56