| 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> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // GPU-accelerated video decoder implementation. Relies on | 32 // GPU-accelerated video decoder implementation. Relies on |
| 33 // AcceleratedVideoDecoderMsg_Decode and friends. Can be created on any thread | 33 // AcceleratedVideoDecoderMsg_Decode and friends. Can be created on any thread |
| 34 // but must be accessed and destroyed on GpuVideoAcceleratorFactories's | 34 // but must be accessed and destroyed on GpuVideoAcceleratorFactories's |
| 35 // GetMessageLoop(). | 35 // GetMessageLoop(). |
| 36 class MEDIA_EXPORT GpuVideoDecoder | 36 class MEDIA_EXPORT GpuVideoDecoder |
| 37 : public VideoDecoder, | 37 : public VideoDecoder, |
| 38 public VideoDecodeAccelerator::Client { | 38 public VideoDecodeAccelerator::Client { |
| 39 public: | 39 public: |
| 40 explicit GpuVideoDecoder( | 40 explicit GpuVideoDecoder( |
| 41 const scoped_refptr<GpuVideoAcceleratorFactories>& factories, | 41 const scoped_refptr<GpuVideoAcceleratorFactories>& factories); |
| 42 const scoped_refptr<MediaLog>& media_log); | |
| 43 | 42 |
| 44 // VideoDecoder implementation. | 43 // VideoDecoder implementation. |
| 44 virtual std::string GetDisplayName() const OVERRIDE; |
| 45 virtual void Initialize(const VideoDecoderConfig& config, | 45 virtual void Initialize(const VideoDecoderConfig& config, |
| 46 bool low_delay, | 46 bool low_delay, |
| 47 const PipelineStatusCB& status_cb, | 47 const PipelineStatusCB& status_cb, |
| 48 const OutputCB& output_cb) OVERRIDE; | 48 const OutputCB& output_cb) OVERRIDE; |
| 49 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 49 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 50 const DecodeCB& decode_cb) OVERRIDE; | 50 const DecodeCB& decode_cb) OVERRIDE; |
| 51 virtual void Reset(const base::Closure& closure) OVERRIDE; | 51 virtual void Reset(const base::Closure& closure) OVERRIDE; |
| 52 virtual bool NeedsBitstreamConversion() const OVERRIDE; | 52 virtual bool NeedsBitstreamConversion() const OVERRIDE; |
| 53 virtual bool CanReadWithoutStalling() const OVERRIDE; | 53 virtual bool CanReadWithoutStalling() const OVERRIDE; |
| 54 virtual int GetMaxDecodeRequests() const OVERRIDE; | 54 virtual int GetMaxDecodeRequests() const OVERRIDE; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 State state_; | 146 State state_; |
| 147 | 147 |
| 148 VideoDecoderConfig config_; | 148 VideoDecoderConfig config_; |
| 149 | 149 |
| 150 // Shared-memory buffer pool. Since allocating SHM segments requires a | 150 // Shared-memory buffer pool. Since allocating SHM segments requires a |
| 151 // round-trip to the browser process, we keep allocation out of the | 151 // round-trip to the browser process, we keep allocation out of the |
| 152 // steady-state of the decoder. | 152 // steady-state of the decoder. |
| 153 std::vector<SHMBuffer*> available_shm_segments_; | 153 std::vector<SHMBuffer*> available_shm_segments_; |
| 154 | 154 |
| 155 scoped_refptr<MediaLog> media_log_; | |
| 156 | |
| 157 std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_; | 155 std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_; |
| 158 PictureBufferMap assigned_picture_buffers_; | 156 PictureBufferMap assigned_picture_buffers_; |
| 159 // PictureBuffers given to us by VDA via PictureReady, which we sent forward | 157 // PictureBuffers given to us by VDA via PictureReady, which we sent forward |
| 160 // as VideoFrames to be rendered via decode_cb_, and which will be returned | 158 // as VideoFrames to be rendered via decode_cb_, and which will be returned |
| 161 // to us via ReusePictureBuffer. | 159 // to us via ReusePictureBuffer. |
| 162 typedef std::map<int32 /* picture_buffer_id */, uint32 /* texture_id */> | 160 typedef std::map<int32 /* picture_buffer_id */, uint32 /* texture_id */> |
| 163 PictureBufferTextureMap; | 161 PictureBufferTextureMap; |
| 164 PictureBufferTextureMap picture_buffers_at_display_; | 162 PictureBufferTextureMap picture_buffers_at_display_; |
| 165 | 163 |
| 166 // The texture target used for decoded pictures. | 164 // The texture target used for decoded pictures. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 189 // Bound to factories_->GetMessageLoop(). | 187 // Bound to factories_->GetMessageLoop(). |
| 190 // NOTE: Weak pointers must be invalidated before all other member variables. | 188 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 191 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; | 189 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; |
| 192 | 190 |
| 193 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 191 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
| 194 }; | 192 }; |
| 195 | 193 |
| 196 } // namespace media | 194 } // namespace media |
| 197 | 195 |
| 198 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 196 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
| OLD | NEW |