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