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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 private: | 85 private: |
86 enum State { | 86 enum State { |
87 kNormal, | 87 kNormal, |
88 kDrainingDecoder, | 88 kDrainingDecoder, |
89 kDecoderDrained, | 89 kDecoderDrained, |
90 kError | 90 kError |
91 }; | 91 }; |
92 | 92 |
93 // A shared memory segment and its allocated size. | 93 // A shared memory segment and its allocated size. |
94 struct SHMBuffer { | 94 struct SHMBuffer { |
95 SHMBuffer(scoped_ptr<base::SharedMemory> m, size_t s); | 95 SHMBuffer(std::unique_ptr<base::SharedMemory> m, size_t s); |
96 ~SHMBuffer(); | 96 ~SHMBuffer(); |
97 scoped_ptr<base::SharedMemory> shm; | 97 std::unique_ptr<base::SharedMemory> shm; |
98 size_t size; | 98 size_t size; |
99 }; | 99 }; |
100 | 100 |
101 // A SHMBuffer and the DecoderBuffer its data came from. | 101 // A SHMBuffer and the DecoderBuffer its data came from. |
102 struct PendingDecoderBuffer { | 102 struct PendingDecoderBuffer { |
103 PendingDecoderBuffer(SHMBuffer* s, | 103 PendingDecoderBuffer(SHMBuffer* s, |
104 const scoped_refptr<DecoderBuffer>& b, | 104 const scoped_refptr<DecoderBuffer>& b, |
105 const DecodeCB& done_cb); | 105 const DecodeCB& done_cb); |
106 PendingDecoderBuffer(const PendingDecoderBuffer& other); | 106 PendingDecoderBuffer(const PendingDecoderBuffer& other); |
107 ~PendingDecoderBuffer(); | 107 ~PendingDecoderBuffer(); |
(...skipping 19 matching lines...) Expand all Loading... |
127 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); | 127 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); |
128 void GetBufferData(int32_t id, | 128 void GetBufferData(int32_t id, |
129 base::TimeDelta* timetamp, | 129 base::TimeDelta* timetamp, |
130 gfx::Rect* visible_rect, | 130 gfx::Rect* visible_rect, |
131 gfx::Size* natural_size); | 131 gfx::Size* natural_size); |
132 | 132 |
133 void DestroyVDA(); | 133 void DestroyVDA(); |
134 | 134 |
135 // Request a shared-memory segment of at least |min_size| bytes. Will | 135 // Request a shared-memory segment of at least |min_size| bytes. Will |
136 // allocate as necessary. | 136 // allocate as necessary. |
137 scoped_ptr<SHMBuffer> GetSHM(size_t min_size); | 137 std::unique_ptr<SHMBuffer> GetSHM(size_t min_size); |
138 | 138 |
139 // Return a shared-memory segment to the available pool. | 139 // Return a shared-memory segment to the available pool. |
140 void PutSHM(scoped_ptr<SHMBuffer> shm_buffer); | 140 void PutSHM(std::unique_ptr<SHMBuffer> shm_buffer); |
141 | 141 |
142 // Destroy all PictureBuffers in |buffers|, and delete their textures. | 142 // Destroy all PictureBuffers in |buffers|, and delete their textures. |
143 void DestroyPictureBuffers(PictureBufferMap* buffers); | 143 void DestroyPictureBuffers(PictureBufferMap* buffers); |
144 | 144 |
145 // Returns true if the video decoder with |capabilities| can support | 145 // Returns true if the video decoder with |capabilities| can support |
146 // |profile|, |coded_size|, and |is_encrypted|. | 146 // |profile|, |coded_size|, and |is_encrypted|. |
147 bool IsProfileSupported( | 147 bool IsProfileSupported( |
148 const VideoDecodeAccelerator::Capabilities& capabilities, | 148 const VideoDecodeAccelerator::Capabilities& capabilities, |
149 VideoCodecProfile profile, | 149 VideoCodecProfile profile, |
150 const gfx::Size& coded_size, | 150 const gfx::Size& coded_size, |
151 bool is_encrypted); | 151 bool is_encrypted); |
152 | 152 |
153 // Assert the contract that this class is operated on the right thread. | 153 // Assert the contract that this class is operated on the right thread. |
154 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; | 154 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; |
155 | 155 |
156 bool needs_bitstream_conversion_; | 156 bool needs_bitstream_conversion_; |
157 | 157 |
158 GpuVideoAcceleratorFactories* factories_; | 158 GpuVideoAcceleratorFactories* factories_; |
159 | 159 |
160 // Populated during Initialize() (on success) and unchanged until an error | 160 // Populated during Initialize() (on success) and unchanged until an error |
161 // occurs. | 161 // occurs. |
162 scoped_ptr<VideoDecodeAccelerator> vda_; | 162 std::unique_ptr<VideoDecodeAccelerator> vda_; |
163 | 163 |
164 InitCB init_cb_; | 164 InitCB init_cb_; |
165 OutputCB output_cb_; | 165 OutputCB output_cb_; |
166 | 166 |
167 DecodeCB eos_decode_cb_; | 167 DecodeCB eos_decode_cb_; |
168 | 168 |
169 // Not null only during reset. | 169 // Not null only during reset. |
170 base::Closure pending_reset_cb_; | 170 base::Closure pending_reset_cb_; |
171 | 171 |
172 State state_; | 172 State state_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Bound to factories_->GetMessageLoop(). | 231 // Bound to factories_->GetMessageLoop(). |
232 // NOTE: Weak pointers must be invalidated before all other member variables. | 232 // NOTE: Weak pointers must be invalidated before all other member variables. |
233 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 233 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
234 | 234 |
235 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 235 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
236 }; | 236 }; |
237 | 237 |
238 } // namespace media | 238 } // namespace media |
239 | 239 |
240 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 240 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |