| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // Flushes the decoder and abandons all the data that is being decoded. | 78 // Flushes the decoder and abandons all the data that is being decoded. |
| 79 virtual void Flush(); | 79 virtual void Flush(); |
| 80 | 80 |
| 81 // Enters prerolling state. The job must not currently be decoding. | 81 // Enters prerolling state. The job must not currently be decoding. |
| 82 void BeginPrerolling(base::TimeDelta preroll_timestamp); | 82 void BeginPrerolling(base::TimeDelta preroll_timestamp); |
| 83 | 83 |
| 84 // Releases all the decoder resources as the current tab is going background. | 84 // Releases all the decoder resources as the current tab is going background. |
| 85 virtual void ReleaseDecoderResources(); | 85 virtual void ReleaseDecoderResources(); |
| 86 | 86 |
| 87 // Sets the demuxer configs. Returns true if configs has changed, or false | 87 // Sets the demuxer configs. |
| 88 // otherwise. | 88 virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) = 0; |
| 89 bool SetDemuxerConfigs(const DemuxerConfigs& configs); | |
| 90 | 89 |
| 91 // Returns whether the decoder has finished decoding all the data. | 90 // Returns whether the decoder has finished decoding all the data. |
| 92 bool OutputEOSReached() const; | 91 bool OutputEOSReached() const; |
| 93 | 92 |
| 94 // Returns true if the audio/video stream is available, implemented by child | 93 // Returns true if the audio/video stream is available, implemented by child |
| 95 // classes. | 94 // classes. |
| 96 virtual bool HasStream() const = 0; | 95 virtual bool HasStream() const = 0; |
| 97 | 96 |
| 98 void SetDrmBridge(MediaDrmBridge* drm_bridge); | 97 void SetDrmBridge(MediaDrmBridge* drm_bridge); |
| 99 | 98 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 220 |
| 222 // Implemented by the child class to create |media_codec_bridge_| for a | 221 // Implemented by the child class to create |media_codec_bridge_| for a |
| 223 // particular stream. Returns true if it is created, or false otherwise. | 222 // particular stream. Returns true if it is created, or false otherwise. |
| 224 virtual bool CreateMediaCodecBridgeInternal() = 0; | 223 virtual bool CreateMediaCodecBridgeInternal() = 0; |
| 225 | 224 |
| 226 // Returns true if the |configs| doesn't match the current demuxer configs | 225 // Returns true if the |configs| doesn't match the current demuxer configs |
| 227 // the decoder job has. | 226 // the decoder job has. |
| 228 virtual bool AreDemuxerConfigsChanged( | 227 virtual bool AreDemuxerConfigsChanged( |
| 229 const DemuxerConfigs& configs) const = 0; | 228 const DemuxerConfigs& configs) const = 0; |
| 230 | 229 |
| 231 // Updates the demuxer configs. | |
| 232 virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) = 0; | |
| 233 | |
| 234 // Returns true if |media_codec_bridge_| needs to be reconfigured for the | 230 // Returns true if |media_codec_bridge_| needs to be reconfigured for the |
| 235 // new DemuxerConfigs, or false otherwise. | 231 // new DemuxerConfigs, or false otherwise. |
| 236 virtual bool IsCodecReconfigureNeeded(const DemuxerConfigs& configs) const; | 232 virtual bool IsCodecReconfigureNeeded(const DemuxerConfigs& configs) const; |
| 237 | 233 |
| 234 // Update the output format from the decoder, returns true if the output |
| 235 // format changes, or false otherwise. |
| 236 virtual bool UpdateOutputFormat() { return false; }; |
| 237 |
| 238 // Return the index to |received_data_| that is not currently being decoded. | 238 // Return the index to |received_data_| that is not currently being decoded. |
| 239 size_t inactive_demuxer_data_index() const { | 239 size_t inactive_demuxer_data_index() const { |
| 240 return 1 - current_demuxer_data_index_; | 240 return 1 - current_demuxer_data_index_; |
| 241 } | 241 } |
| 242 | 242 |
| 243 // The UI message loop where callbacks should be dispatched. | 243 // The UI message loop where callbacks should be dispatched. |
| 244 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 244 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 245 | 245 |
| 246 // The task runner that decoder job runs on. | 246 // The task runner that decoder job runs on. |
| 247 scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_; | 247 scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // This access unit is passed to the decoder during config changes to drain | 338 // This access unit is passed to the decoder during config changes to drain |
| 339 // the decoder. | 339 // the decoder. |
| 340 AccessUnit eos_unit_; | 340 AccessUnit eos_unit_; |
| 341 | 341 |
| 342 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 342 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
| 343 }; | 343 }; |
| 344 | 344 |
| 345 } // namespace media | 345 } // namespace media |
| 346 | 346 |
| 347 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 347 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
| OLD | NEW |