OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FILTERS_GPU_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/memory/weak_ptr.h" |
13 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
14 #include "media/base/demuxer_stream.h" | 15 #include "media/base/demuxer_stream.h" |
15 #include "media/base/video_decoder.h" | 16 #include "media/base/video_decoder.h" |
16 #include "media/video/video_decode_accelerator.h" | 17 #include "media/video/video_decode_accelerator.h" |
17 | 18 |
18 class MessageLoop; | 19 class MessageLoop; |
19 template <class T> class scoped_refptr; | 20 template <class T> class scoped_refptr; |
20 namespace base { | 21 namespace base { |
21 class MessageLoopProxy; | 22 class MessageLoopProxy; |
22 class SharedMemory; | 23 class SharedMemory; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const scoped_refptr<VideoFrame>& frame); | 124 const scoped_refptr<VideoFrame>& frame); |
124 | 125 |
125 // Indicate the picturebuffer can be reused by the decoder. | 126 // Indicate the picturebuffer can be reused by the decoder. |
126 void ReusePictureBuffer(int64 picture_buffer_id); | 127 void ReusePictureBuffer(int64 picture_buffer_id); |
127 | 128 |
128 void RecordBufferData( | 129 void RecordBufferData( |
129 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); | 130 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); |
130 void GetBufferData(int32 id, base::TimeDelta* timetamp, | 131 void GetBufferData(int32 id, base::TimeDelta* timetamp, |
131 gfx::Rect* visible_rect, gfx::Size* natural_size); | 132 gfx::Rect* visible_rect, gfx::Size* natural_size); |
132 | 133 |
133 // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render | 134 // Sets |vda_| and |weak_vda_| on the GVD thread and runs |status_cb|. |
134 // thread). | 135 void SetVDA(const PipelineStatusCB& status_cb, |
135 void SetVDA(VideoDecodeAccelerator* vda); | 136 VideoDecodeAccelerator* vda, |
| 137 base::WeakPtr<VideoDecodeAccelerator> weak_vda); |
136 | 138 |
137 // Call VDA::Destroy() on |vda_loop_proxy_| ensuring that |this| outlives the | 139 // Call VDA::Destroy() on |vda_loop_proxy_| ensuring that |this| outlives the |
138 // Destroy() call. | 140 // Destroy() call. |
139 void DestroyVDA(); | 141 void DestroyVDA(); |
140 | 142 |
141 // A shared memory segment and its allocated size. | 143 // A shared memory segment and its allocated size. |
142 struct SHMBuffer { | 144 struct SHMBuffer { |
143 SHMBuffer(base::SharedMemory* m, size_t s); | 145 SHMBuffer(base::SharedMemory* m, size_t s); |
144 ~SHMBuffer(); | 146 ~SHMBuffer(); |
145 base::SharedMemory* shm; | 147 base::SharedMemory* shm; |
(...skipping 10 matching lines...) Expand all Loading... |
156 void DestroyTextures(); | 158 void DestroyTextures(); |
157 | 159 |
158 StatisticsCB statistics_cb_; | 160 StatisticsCB statistics_cb_; |
159 | 161 |
160 // Pointer to the demuxer stream that will feed us compressed buffers. | 162 // Pointer to the demuxer stream that will feed us compressed buffers. |
161 scoped_refptr<DemuxerStream> demuxer_stream_; | 163 scoped_refptr<DemuxerStream> demuxer_stream_; |
162 | 164 |
163 // MessageLoop on which to fire callbacks and trampoline calls to this class | 165 // MessageLoop on which to fire callbacks and trampoline calls to this class |
164 // if they arrive on other loops. | 166 // if they arrive on other loops. |
165 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; | 167 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; |
| 168 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
| 169 base::WeakPtr<GpuVideoDecoder> weak_this_; |
166 | 170 |
167 // Message loop on which to makes all calls to vda_. (beware this loop may be | 171 // Message loop on which to makes all calls to vda_. (beware this loop may be |
168 // paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes | 172 // paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes |
169 // through). | 173 // through). |
170 scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_; | 174 scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_; |
171 | 175 |
172 scoped_refptr<Factories> factories_; | 176 scoped_refptr<Factories> factories_; |
173 | 177 |
174 // Populated during Initialize() via SetVDA() (on success) and unchanged | 178 // Populated during Initialize() via SetVDA() (on success) and unchanged |
175 // until an error occurs | 179 // until an error occurs |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Set during ProvidePictureBuffers(), used for checking and implementing | 232 // Set during ProvidePictureBuffers(), used for checking and implementing |
229 // HasAvailableOutputFrames(). | 233 // HasAvailableOutputFrames(). |
230 int available_pictures_; | 234 int available_pictures_; |
231 | 235 |
232 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 236 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
233 }; | 237 }; |
234 | 238 |
235 } // namespace media | 239 } // namespace media |
236 | 240 |
237 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 241 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |