OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ | 5 #ifndef MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ |
6 #define MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ | 6 #define MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "media/base/android/media_decoder_job.h" | 12 #include "media/base/android/media_decoder_job.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 class AudioCodecBridge; | 16 class AudioCodecBridge; |
17 class AudioTimestampHelper; | 17 class AudioTimestampHelper; |
18 | 18 |
19 // Class for managing audio decoding jobs. | 19 // Class for managing audio decoding jobs. |
20 class AudioDecoderJob : public MediaDecoderJob { | 20 class AudioDecoderJob : public MediaDecoderJob { |
21 public: | 21 public: |
22 // Creates a new AudioDecoderJob instance for decoding audio. | 22 // Creates a new AudioDecoderJob instance for decoding audio. |
23 // |request_data_cb| - Callback used to request more data for the decoder. | 23 // |request_data_cb| - Callback used to request more data for the decoder. |
24 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that | 24 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that |
25 // demuxer config has changed. | 25 // demuxer config has changed. |
26 AudioDecoderJob(const base::Closure& request_data_cb, | 26 AudioDecoderJob(const base::Closure& request_data_cb, |
27 const base::Closure& on_demuxer_config_changed_cb); | 27 const base::Closure& on_demuxer_config_changed_cb); |
28 virtual ~AudioDecoderJob(); | 28 ~AudioDecoderJob() override; |
29 | 29 |
30 // MediaDecoderJob implementation. | 30 // MediaDecoderJob implementation. |
31 virtual bool HasStream() const override; | 31 bool HasStream() const override; |
32 virtual void Flush() override; | 32 void Flush() override; |
33 virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 33 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
34 | 34 |
35 // Sets the volume of the audio output. | 35 // Sets the volume of the audio output. |
36 void SetVolume(double volume); | 36 void SetVolume(double volume); |
37 | 37 |
38 // Sets the base timestamp for |audio_timestamp_helper_|. | 38 // Sets the base timestamp for |audio_timestamp_helper_|. |
39 void SetBaseTimestamp(base::TimeDelta base_timestamp); | 39 void SetBaseTimestamp(base::TimeDelta base_timestamp); |
40 | 40 |
41 private: | 41 private: |
42 // MediaDecoderJob implementation. | 42 // MediaDecoderJob implementation. |
43 virtual void ReleaseOutputBuffer( | 43 void ReleaseOutputBuffer( |
44 int output_buffer_index, | 44 int output_buffer_index, |
45 size_t size, | 45 size_t size, |
46 bool render_output, | 46 bool render_output, |
47 base::TimeDelta current_presentation_timestamp, | 47 base::TimeDelta current_presentation_timestamp, |
48 const ReleaseOutputCompletionCallback& callback) override; | 48 const ReleaseOutputCompletionCallback& callback) override; |
49 virtual bool ComputeTimeToRender() const override; | 49 bool ComputeTimeToRender() const override; |
50 virtual bool AreDemuxerConfigsChanged( | 50 bool AreDemuxerConfigsChanged(const DemuxerConfigs& configs) const override; |
51 const DemuxerConfigs& configs) const override; | 51 MediaDecoderJobStatus CreateMediaCodecBridgeInternal() override; |
52 virtual MediaDecoderJobStatus CreateMediaCodecBridgeInternal() override; | 52 void OnOutputFormatChanged() override; |
53 virtual void OnOutputFormatChanged() override; | |
54 | 53 |
55 // Helper method to set the audio output volume. | 54 // Helper method to set the audio output volume. |
56 void SetVolumeInternal(); | 55 void SetVolumeInternal(); |
57 | 56 |
58 void ResetTimestampHelper(); | 57 void ResetTimestampHelper(); |
59 | 58 |
60 // Audio configs from the demuxer. | 59 // Audio configs from the demuxer. |
61 AudioCodec audio_codec_; | 60 AudioCodec audio_codec_; |
62 int num_channels_; | 61 int num_channels_; |
63 int config_sampling_rate_; | 62 int config_sampling_rate_; |
(...skipping 12 matching lines...) Expand all Loading... |
76 | 75 |
77 // Object to calculate the current audio timestamp for A/V sync. | 76 // Object to calculate the current audio timestamp for A/V sync. |
78 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; | 77 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; |
79 | 78 |
80 DISALLOW_COPY_AND_ASSIGN(AudioDecoderJob); | 79 DISALLOW_COPY_AND_ASSIGN(AudioDecoderJob); |
81 }; | 80 }; |
82 | 81 |
83 } // namespace media | 82 } // namespace media |
84 | 83 |
85 #endif // MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ | 84 #endif // MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ |
OLD | NEW |