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_MEDIA_DECODER_JOB_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 virtual bool HasStream() const = 0; | 101 virtual bool HasStream() const = 0; |
102 | 102 |
103 void SetDrmBridge(MediaDrmBridge* drm_bridge); | 103 void SetDrmBridge(MediaDrmBridge* drm_bridge); |
104 | 104 |
105 bool is_decoding() const { return !decode_cb_.is_null(); } | 105 bool is_decoding() const { return !decode_cb_.is_null(); } |
106 | 106 |
107 bool is_content_encrypted() const { return is_content_encrypted_; } | 107 bool is_content_encrypted() const { return is_content_encrypted_; } |
108 | 108 |
109 bool prerolling() const { return prerolling_; } | 109 bool prerolling() const { return prerolling_; } |
110 | 110 |
111 // Returns true if this object has data to decode. | |
112 bool HasData() const; | |
113 | |
114 protected: | 111 protected: |
115 // Creates a new MediaDecoderJob instance. | 112 // Creates a new MediaDecoderJob instance. |
116 // |decoder_task_runner| - Thread on which the decoder task will run. | 113 // |decoder_task_runner| - Thread on which the decoder task will run. |
117 // |request_data_cb| - Callback to request more data for the decoder. | 114 // |request_data_cb| - Callback to request more data for the decoder. |
118 // |config_changed_cb| - Callback to inform the caller that | 115 // |config_changed_cb| - Callback to inform the caller that |
119 // demuxer config has changed. | 116 // demuxer config has changed. |
120 MediaDecoderJob( | 117 MediaDecoderJob( |
121 const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner, | 118 const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner, |
122 const base::Closure& request_data_cb, | 119 const base::Closure& request_data_cb, |
123 const base::Closure& config_changed_cb); | 120 const base::Closure& config_changed_cb); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 156 |
160 private: | 157 private: |
161 friend class MediaSourcePlayerTest; | 158 friend class MediaSourcePlayerTest; |
162 | 159 |
163 // Causes this instance to be deleted on the thread it is bound to. | 160 // Causes this instance to be deleted on the thread it is bound to. |
164 void Release(); | 161 void Release(); |
165 | 162 |
166 // Queues an access unit into |media_codec_bridge_|'s input buffer. | 163 // Queues an access unit into |media_codec_bridge_|'s input buffer. |
167 MediaCodecStatus QueueInputBuffer(const AccessUnit& unit); | 164 MediaCodecStatus QueueInputBuffer(const AccessUnit& unit); |
168 | 165 |
| 166 // Returns true if this object has data to decode. |
| 167 bool HasData() const; |
| 168 |
169 // Initiates a request for more data. | 169 // Initiates a request for more data. |
170 // |done_cb| is called when more data is available in |received_data_|. | 170 // |done_cb| is called when more data is available in |received_data_|. |
171 void RequestData(const base::Closure& done_cb); | 171 void RequestData(const base::Closure& done_cb); |
172 | 172 |
173 // Posts a task to start decoding the current access unit in |received_data_|. | 173 // Posts a task to start decoding the current access unit in |received_data_|. |
174 void DecodeCurrentAccessUnit( | 174 void DecodeCurrentAccessUnit( |
175 base::TimeTicks start_time_ticks, | 175 base::TimeTicks start_time_ticks, |
176 base::TimeDelta start_presentation_timestamp); | 176 base::TimeDelta start_presentation_timestamp); |
177 | 177 |
178 // Helper function to decode data on |decoder_task_runner_|. |unit| contains | 178 // Helper function to decode data on |decoder_task_runner_|. |unit| contains |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // This access unit is passed to the decoder during config changes to drain | 353 // This access unit is passed to the decoder during config changes to drain |
354 // the decoder. | 354 // the decoder. |
355 AccessUnit eos_unit_; | 355 AccessUnit eos_unit_; |
356 | 356 |
357 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 357 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
358 }; | 358 }; |
359 | 359 |
360 } // namespace media | 360 } // namespace media |
361 | 361 |
362 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 362 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
OLD | NEW |