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; | 22 class MessageLoopProxy; |
23 class SharedMemory; | 23 class SharedMemory; |
24 } | 24 } |
25 | 25 |
26 namespace media { | 26 namespace media { |
27 | 27 |
28 class DecoderBuffer; | 28 class DecoderBuffer; |
29 class GpuVideoAcceleratorFactories; | 29 class GpuVideoDecoderFactories; |
30 | 30 |
31 // GPU-accelerated video decoder implementation. Relies on | 31 // GPU-accelerated video decoder implementation. Relies on |
32 // AcceleratedVideoDecoderMsg_Decode and friends. | 32 // AcceleratedVideoDecoderMsg_Decode and friends. |
33 class MEDIA_EXPORT GpuVideoDecoder | 33 class MEDIA_EXPORT GpuVideoDecoder |
34 : public VideoDecoder, | 34 : public VideoDecoder, |
35 public VideoDecodeAccelerator::Client { | 35 public VideoDecodeAccelerator::Client { |
36 public: | 36 public: |
37 // The message loop of |factories| will be saved to |gvd_loop_proxy_|. | 37 // The message loop of |factories| will be saved to |gvd_loop_proxy_|. |
38 explicit GpuVideoDecoder( | 38 explicit GpuVideoDecoder( |
39 const scoped_refptr<GpuVideoAcceleratorFactories>& factories); | 39 const scoped_refptr<GpuVideoDecoderFactories>& factories); |
40 | 40 |
41 // VideoDecoder implementation. | 41 // VideoDecoder implementation. |
42 virtual void Initialize(const VideoDecoderConfig& config, | 42 virtual void Initialize(const VideoDecoderConfig& config, |
43 const PipelineStatusCB& status_cb) OVERRIDE; | 43 const PipelineStatusCB& status_cb) OVERRIDE; |
44 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 44 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
45 const DecodeCB& decode_cb) OVERRIDE; | 45 const DecodeCB& decode_cb) OVERRIDE; |
46 virtual void Reset(const base::Closure& closure) OVERRIDE; | 46 virtual void Reset(const base::Closure& closure) OVERRIDE; |
47 virtual void Stop(const base::Closure& closure) OVERRIDE; | 47 virtual void Stop(const base::Closure& closure) OVERRIDE; |
48 virtual bool HasAlpha() const OVERRIDE; | 48 virtual bool HasAlpha() const OVERRIDE; |
49 virtual bool NeedsBitstreamConversion() const OVERRIDE; | 49 virtual bool NeedsBitstreamConversion() const OVERRIDE; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 void DestroyTextures(); | 111 void DestroyTextures(); |
112 | 112 |
113 bool needs_bitstream_conversion_; | 113 bool needs_bitstream_conversion_; |
114 | 114 |
115 // Message loop which this class and |factories_| run on. | 115 // Message loop which this class and |factories_| run on. |
116 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; | 116 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; |
117 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 117 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
118 base::WeakPtr<GpuVideoDecoder> weak_this_; | 118 base::WeakPtr<GpuVideoDecoder> weak_this_; |
119 | 119 |
120 scoped_refptr<GpuVideoAcceleratorFactories> factories_; | 120 scoped_refptr<GpuVideoDecoderFactories> factories_; |
121 | 121 |
122 // Populated during Initialize() (on success) and unchanged until an error | 122 // Populated during Initialize() (on success) and unchanged until an error |
123 // occurs. | 123 // occurs. |
124 scoped_ptr<VideoDecodeAccelerator> vda_; | 124 scoped_ptr<VideoDecodeAccelerator> vda_; |
125 | 125 |
126 // Callbacks that are !is_null() only during their respective operation being | 126 // Callbacks that are !is_null() only during their respective operation being |
127 // asynchronously executed. | 127 // asynchronously executed. |
128 DecodeCB pending_decode_cb_; | 128 DecodeCB pending_decode_cb_; |
129 base::Closure pending_reset_cb_; | 129 base::Closure pending_reset_cb_; |
130 | 130 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // Set during ProvidePictureBuffers(), used for checking and implementing | 175 // Set during ProvidePictureBuffers(), used for checking and implementing |
176 // HasAvailableOutputFrames(). | 176 // HasAvailableOutputFrames(). |
177 int available_pictures_; | 177 int available_pictures_; |
178 | 178 |
179 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 179 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
180 }; | 180 }; |
181 | 181 |
182 } // namespace media | 182 } // namespace media |
183 | 183 |
184 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 184 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |