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 <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "media/base/pipeline_status.h" | 15 #include "media/base/pipeline_status.h" |
16 #include "media/base/video_decoder.h" | 16 #include "media/base/video_decoder.h" |
17 #include "media/video/video_decode_accelerator.h" | 17 #include "media/video/video_decode_accelerator.h" |
18 | 18 |
19 template <class T> class scoped_refptr; | 19 template <class T> class scoped_refptr; |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class MessageLoopProxy; | |
23 class SharedMemory; | 22 class SharedMemory; |
| 23 class SingleThreadTaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace media { | 26 namespace media { |
27 | 27 |
28 class DecoderBuffer; | 28 class DecoderBuffer; |
29 class GpuVideoAcceleratorFactories; | 29 class GpuVideoAcceleratorFactories; |
30 class MediaLog; | 30 class MediaLog; |
31 | 31 |
32 // GPU-accelerated video decoder implementation. Relies on | 32 // GPU-accelerated video decoder implementation. Relies on |
33 // AcceleratedVideoDecoderMsg_Decode and friends. | 33 // AcceleratedVideoDecoderMsg_Decode and friends. |
34 class MEDIA_EXPORT GpuVideoDecoder | 34 class MEDIA_EXPORT GpuVideoDecoder |
35 : public VideoDecoder, | 35 : public VideoDecoder, |
36 public VideoDecodeAccelerator::Client { | 36 public VideoDecodeAccelerator::Client { |
37 public: | 37 public: |
38 // The message loop of |factories| will be saved to |gvd_loop_proxy_|. | 38 // The message loop of |factories| will be saved to |gvd_task_runner_|. |
39 explicit GpuVideoDecoder( | 39 explicit GpuVideoDecoder( |
40 const scoped_refptr<GpuVideoAcceleratorFactories>& factories, | 40 const scoped_refptr<GpuVideoAcceleratorFactories>& factories, |
41 const scoped_refptr<MediaLog>& media_log); | 41 const scoped_refptr<MediaLog>& media_log); |
42 | 42 |
43 // VideoDecoder implementation. | 43 // VideoDecoder implementation. |
44 virtual void Initialize(const VideoDecoderConfig& config, | 44 virtual void Initialize(const VideoDecoderConfig& config, |
45 const PipelineStatusCB& status_cb) OVERRIDE; | 45 const PipelineStatusCB& status_cb) OVERRIDE; |
46 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 46 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
47 const DecodeCB& decode_cb) OVERRIDE; | 47 const DecodeCB& decode_cb) OVERRIDE; |
48 virtual void Reset(const base::Closure& closure) OVERRIDE; | 48 virtual void Reset(const base::Closure& closure) OVERRIDE; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Return a shared-memory segment to the available pool. | 120 // Return a shared-memory segment to the available pool. |
121 void PutSHM(SHMBuffer* shm_buffer); | 121 void PutSHM(SHMBuffer* shm_buffer); |
122 | 122 |
123 // Destroy all PictureBuffers in |buffers|, and delete their textures. | 123 // Destroy all PictureBuffers in |buffers|, and delete their textures. |
124 void DestroyPictureBuffers(PictureBufferMap* buffers); | 124 void DestroyPictureBuffers(PictureBufferMap* buffers); |
125 | 125 |
126 bool needs_bitstream_conversion_; | 126 bool needs_bitstream_conversion_; |
127 | 127 |
128 // Message loop which this class and |factories_| run on. | 128 // Message loop which this class and |factories_| run on. |
129 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; | 129 scoped_refptr<base::SingleThreadTaskRunner> gvd_task_runner_; |
130 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 130 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
131 base::WeakPtr<GpuVideoDecoder> weak_this_; | 131 base::WeakPtr<GpuVideoDecoder> weak_this_; |
132 | 132 |
133 scoped_refptr<GpuVideoAcceleratorFactories> factories_; | 133 scoped_refptr<GpuVideoAcceleratorFactories> factories_; |
134 | 134 |
135 // Populated during Initialize() (on success) and unchanged until an error | 135 // Populated during Initialize() (on success) and unchanged until an error |
136 // occurs. | 136 // occurs. |
137 scoped_ptr<VideoDecodeAccelerator> vda_; | 137 scoped_ptr<VideoDecodeAccelerator> vda_; |
138 | 138 |
139 // Callbacks that are !is_null() only during their respective operation being | 139 // Callbacks that are !is_null() only during their respective operation being |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Set during ProvidePictureBuffers(), used for checking and implementing | 183 // Set during ProvidePictureBuffers(), used for checking and implementing |
184 // HasAvailableOutputFrames(). | 184 // HasAvailableOutputFrames(). |
185 int available_pictures_; | 185 int available_pictures_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 187 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace media | 190 } // namespace media |
191 | 191 |
192 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 192 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |