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 17 matching lines...) Expand all Loading... |
28 // Callback when a decoder job finishes its work. Args: whether decode | 28 // Callback when a decoder job finishes its work. Args: whether decode |
29 // finished successfully, presentation time, audio output bytes. | 29 // finished successfully, presentation time, audio output bytes. |
30 typedef base::Callback<void(MediaCodecStatus, const base::TimeDelta&, | 30 typedef base::Callback<void(MediaCodecStatus, const base::TimeDelta&, |
31 size_t)> DecoderCallback; | 31 size_t)> DecoderCallback; |
32 | 32 |
33 virtual ~MediaDecoderJob(); | 33 virtual ~MediaDecoderJob(); |
34 | 34 |
35 // Called by MediaSourcePlayer when more data for this object has arrived. | 35 // Called by MediaSourcePlayer when more data for this object has arrived. |
36 void OnDataReceived(const DemuxerData& data); | 36 void OnDataReceived(const DemuxerData& data); |
37 | 37 |
38 // Returns true if this object has data to decode. | |
39 bool HasData() const; | |
40 | |
41 // Prefetch so we know the decoder job has data when we call Decode(). | 38 // Prefetch so we know the decoder job has data when we call Decode(). |
42 // |prefetch_cb| - Run when prefetching has completed. | 39 // |prefetch_cb| - Run when prefetching has completed. |
43 void Prefetch(const base::Closure& prefetch_cb); | 40 void Prefetch(const base::Closure& prefetch_cb); |
44 | 41 |
45 // Called by MediaSourcePlayer to decode some data. | 42 // Called by MediaSourcePlayer to decode some data. |
46 // |callback| - Run when decode operation has completed. | 43 // |callback| - Run when decode operation has completed. |
47 // | 44 // |
48 // Returns true if the next decode was started and |callback| will be | 45 // Returns true if the next decode was started and |callback| will be |
49 // called when the decode operation is complete. | 46 // called when the decode operation is complete. |
50 // Returns false if a config change is needed. |callback| is ignored | 47 // Returns false if a config change is needed. |callback| is ignored |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Returns true if the "time to render" needs to be computed for frames in | 80 // Returns true if the "time to render" needs to be computed for frames in |
84 // this decoder job. | 81 // this decoder job. |
85 virtual bool ComputeTimeToRender() const = 0; | 82 virtual bool ComputeTimeToRender() const = 0; |
86 | 83 |
87 private: | 84 private: |
88 // Causes this instance to be deleted on the thread it is bound to. | 85 // Causes this instance to be deleted on the thread it is bound to. |
89 void Release(); | 86 void Release(); |
90 | 87 |
91 MediaCodecStatus QueueInputBuffer(const AccessUnit& unit); | 88 MediaCodecStatus QueueInputBuffer(const AccessUnit& unit); |
92 | 89 |
| 90 // Returns true if this object has data to decode. |
| 91 bool HasData() const; |
| 92 |
93 // Initiates a request for more data. | 93 // Initiates a request for more data. |
94 // |done_cb| is called when more data is available in |received_data_|. | 94 // |done_cb| is called when more data is available in |received_data_|. |
95 void RequestData(const base::Closure& done_cb); | 95 void RequestData(const base::Closure& done_cb); |
96 | 96 |
97 // Posts a task to start decoding the next access unit in |received_data_|. | 97 // Posts a task to start decoding the next access unit in |received_data_|. |
98 void DecodeNextAccessUnit( | 98 void DecodeNextAccessUnit( |
99 const base::TimeTicks& start_time_ticks, | 99 const base::TimeTicks& start_time_ticks, |
100 const base::TimeDelta& start_presentation_timestamp); | 100 const base::TimeDelta& start_presentation_timestamp); |
101 | 101 |
102 // Helper function to decoder data on |thread_|. |unit| contains all the data | 102 // Helper function to decoder data on |thread_|. |unit| contains all the data |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Decode() has completed. This gets set when Release() gets called | 161 // Decode() has completed. This gets set when Release() gets called |
162 // while there is a decode in progress. | 162 // while there is a decode in progress. |
163 bool destroy_pending_; | 163 bool destroy_pending_; |
164 | 164 |
165 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 165 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
166 }; | 166 }; |
167 | 167 |
168 } // namespace media | 168 } // namespace media |
169 | 169 |
170 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 170 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
OLD | NEW |