| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Callback when a decoder job finishes its work. Args: whether decode | 45 // Callback when a decoder job finishes its work. Args: whether decode |
| 46 // finished successfully, a flag whether the frame is late for statistics, | 46 // finished successfully, a flag whether the frame is late for statistics, |
| 47 // cacurrent presentation time, max presentation time. | 47 // cacurrent presentation time, max presentation time. |
| 48 // If the current presentation time is equal to kNoTimestamp(), the decoder | 48 // If the current presentation time is equal to kNoTimestamp(), the decoder |
| 49 // job skipped rendering of the decoded output and the callback target should | 49 // job skipped rendering of the decoded output and the callback target should |
| 50 // ignore the timestamps provided. The late frame flag has no meaning in this | 50 // ignore the timestamps provided. The late frame flag has no meaning in this |
| 51 // case. | 51 // case. |
| 52 typedef base::Callback<void(MediaCodecStatus, bool, base::TimeDelta, | 52 typedef base::Callback<void(MediaCodecStatus, bool, base::TimeDelta, |
| 53 base::TimeDelta)> DecoderCallback; | 53 base::TimeDelta)> DecoderCallback; |
| 54 // Callback when a decoder job finishes releasing the output buffer. | |
| 55 // Args: whether the frame is a late frame, current presentation time, max | |
| 56 // presentation time. | |
| 57 // If the current presentation time is equal to kNoTimestamp(), the callback | |
| 58 // target should ignore the timestamps provided and whether it is late. | |
| 59 typedef base::Callback<void(bool, base::TimeDelta, base::TimeDelta)> | |
| 60 ReleaseOutputCompletionCallback; | |
| 61 | 54 |
| 62 virtual ~MediaDecoderJob(); | 55 virtual ~MediaDecoderJob(); |
| 63 | 56 |
| 64 // Called by MediaSourcePlayer when more data for this object has arrived. | 57 // Called by MediaSourcePlayer when more data for this object has arrived. |
| 65 void OnDataReceived(const DemuxerData& data); | 58 void OnDataReceived(const DemuxerData& data); |
| 66 | 59 |
| 67 // Prefetch so we know the decoder job has data when we call Decode(). | 60 // Prefetch so we know the decoder job has data when we call Decode(). |
| 68 // |prefetch_cb| - Run when prefetching has completed. | 61 // |prefetch_cb| - Run when prefetching has completed. |
| 69 void Prefetch(const base::Closure& prefetch_cb); | 62 void Prefetch(const base::Closure& prefetch_cb); |
| 70 | 63 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // |render_output| is true. Upon completion, |callback| will be called. | 123 // |render_output| is true. Upon completion, |callback| will be called. |
| 131 // |is_late_frame| can be passed with the |callback| if the implementation | 124 // |is_late_frame| can be passed with the |callback| if the implementation |
| 132 // does not calculate it itself. | 125 // does not calculate it itself. |
| 133 virtual void ReleaseOutputBuffer( | 126 virtual void ReleaseOutputBuffer( |
| 134 int output_buffer_index, | 127 int output_buffer_index, |
| 135 size_t offset, | 128 size_t offset, |
| 136 size_t size, | 129 size_t size, |
| 137 bool render_output, | 130 bool render_output, |
| 138 bool is_late_frame, | 131 bool is_late_frame, |
| 139 base::TimeDelta current_presentation_timestamp, | 132 base::TimeDelta current_presentation_timestamp, |
| 140 const ReleaseOutputCompletionCallback& callback) = 0; | 133 MediaCodecStatus status, |
| 134 const DecoderCallback& callback) = 0; |
| 141 | 135 |
| 142 // Returns true if the "time to render" needs to be computed for frames in | 136 // Returns true if the "time to render" needs to be computed for frames in |
| 143 // this decoder job. | 137 // this decoder job. |
| 144 virtual bool ComputeTimeToRender() const = 0; | 138 virtual bool ComputeTimeToRender() const = 0; |
| 145 | 139 |
| 146 // Gets MediaCrypto object from |drm_bridge_|. | 140 // Gets MediaCrypto object from |drm_bridge_|. |
| 147 jobject GetMediaCrypto(); | 141 jobject GetMediaCrypto(); |
| 148 | 142 |
| 149 // Releases the |media_codec_bridge_|. | 143 // Releases the |media_codec_bridge_|. |
| 150 void ReleaseMediaCodecBridge(); | 144 void ReleaseMediaCodecBridge(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // This access unit is passed to the decoder during config changes to drain | 358 // This access unit is passed to the decoder during config changes to drain |
| 365 // the decoder. | 359 // the decoder. |
| 366 AccessUnit eos_unit_; | 360 AccessUnit eos_unit_; |
| 367 | 361 |
| 368 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 362 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
| 369 }; | 363 }; |
| 370 | 364 |
| 371 } // namespace media | 365 } // namespace media |
| 372 | 366 |
| 373 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 367 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
| OLD | NEW |