| 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 |
| 111 protected: | 114 protected: |
| 112 // Creates a new MediaDecoderJob instance. | 115 // Creates a new MediaDecoderJob instance. |
| 113 // |decoder_task_runner| - Thread on which the decoder task will run. | 116 // |decoder_task_runner| - Thread on which the decoder task will run. |
| 114 // |request_data_cb| - Callback to request more data for the decoder. | 117 // |request_data_cb| - Callback to request more data for the decoder. |
| 115 // |config_changed_cb| - Callback to inform the caller that | 118 // |config_changed_cb| - Callback to inform the caller that |
| 116 // demuxer config has changed. | 119 // demuxer config has changed. |
| 117 MediaDecoderJob( | 120 MediaDecoderJob( |
| 118 const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner, | 121 const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner, |
| 119 const base::Closure& request_data_cb, | 122 const base::Closure& request_data_cb, |
| 120 const base::Closure& config_changed_cb); | 123 const base::Closure& config_changed_cb); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 158 |
| 156 private: | 159 private: |
| 157 friend class MediaSourcePlayerTest; | 160 friend class MediaSourcePlayerTest; |
| 158 | 161 |
| 159 // Causes this instance to be deleted on the thread it is bound to. | 162 // Causes this instance to be deleted on the thread it is bound to. |
| 160 void Release(); | 163 void Release(); |
| 161 | 164 |
| 162 // Queues an access unit into |media_codec_bridge_|'s input buffer. | 165 // Queues an access unit into |media_codec_bridge_|'s input buffer. |
| 163 MediaCodecStatus QueueInputBuffer(const AccessUnit& unit); | 166 MediaCodecStatus QueueInputBuffer(const AccessUnit& unit); |
| 164 | 167 |
| 165 // Returns true if this object has data to decode. | |
| 166 bool HasData() const; | |
| 167 | |
| 168 // Initiates a request for more data. | 168 // Initiates a request for more data. |
| 169 // |done_cb| is called when more data is available in |received_data_|. | 169 // |done_cb| is called when more data is available in |received_data_|. |
| 170 void RequestData(const base::Closure& done_cb); | 170 void RequestData(const base::Closure& done_cb); |
| 171 | 171 |
| 172 // Posts a task to start decoding the current access unit in |received_data_|. | 172 // Posts a task to start decoding the current access unit in |received_data_|. |
| 173 void DecodeCurrentAccessUnit( | 173 void DecodeCurrentAccessUnit( |
| 174 base::TimeTicks start_time_ticks, | 174 base::TimeTicks start_time_ticks, |
| 175 base::TimeDelta start_presentation_timestamp); | 175 base::TimeDelta start_presentation_timestamp); |
| 176 | 176 |
| 177 // Helper function to decode data on |decoder_task_runner_|. |unit| contains | 177 // Helper function to decode data on |decoder_task_runner_|. |unit| contains |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // This access unit is passed to the decoder during config changes to drain | 352 // This access unit is passed to the decoder during config changes to drain |
| 353 // the decoder. | 353 // the decoder. |
| 354 AccessUnit eos_unit_; | 354 AccessUnit eos_unit_; |
| 355 | 355 |
| 356 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 356 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 } // namespace media | 359 } // namespace media |
| 360 | 360 |
| 361 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 361 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
| OLD | NEW |