| 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 CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // use. | 41 // use. |
| 42 RendererGpuVideoDecoderFactories( | 42 RendererGpuVideoDecoderFactories( |
| 43 GpuChannelHost* gpu_channel_host, | 43 GpuChannelHost* gpu_channel_host, |
| 44 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 44 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 45 WebGraphicsContext3DCommandBufferImpl* wgc3dcbi); | 45 WebGraphicsContext3DCommandBufferImpl* wgc3dcbi); |
| 46 | 46 |
| 47 // media::GpuVideoDecoder::Factories implementation. | 47 // media::GpuVideoDecoder::Factories implementation. |
| 48 virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator( | 48 virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator( |
| 49 media::VideoCodecProfile profile, | 49 media::VideoCodecProfile profile, |
| 50 media::VideoDecodeAccelerator::Client* client) OVERRIDE; | 50 media::VideoDecodeAccelerator::Client* client) OVERRIDE; |
| 51 virtual bool CreateTextures(int32 count, const gfx::Size& size, | 51 // Creates textures and produces them into mailboxes. Returns a sync point to |
| 52 std::vector<uint32>* texture_ids, | 52 // wait on before using the mailboxes, or 0 on failure. |
| 53 uint32 texture_target) OVERRIDE; | 53 virtual uint32 CreateTextures( |
| 54 int32 count, const gfx::Size& size, |
| 55 std::vector<uint32>* texture_ids, |
| 56 std::vector<gpu::Mailbox>* texture_mailboxes, |
| 57 uint32 texture_target) OVERRIDE; |
| 54 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; | 58 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; |
| 59 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE; |
| 55 virtual void ReadPixels(uint32 texture_id, | 60 virtual void ReadPixels(uint32 texture_id, |
| 56 uint32 texture_target, | 61 uint32 texture_target, |
| 57 const gfx::Size& size, | 62 const gfx::Size& size, |
| 58 const SkBitmap& pixels) OVERRIDE; | 63 const SkBitmap& pixels) OVERRIDE; |
| 59 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; | 64 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; |
| 60 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; | 65 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; |
| 61 virtual void Abort() OVERRIDE; | 66 virtual void Abort() OVERRIDE; |
| 62 virtual bool IsAborted() OVERRIDE; | 67 virtual bool IsAborted() OVERRIDE; |
| 63 | 68 |
| 64 protected: | 69 protected: |
| 65 friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>; | 70 friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>; |
| 66 virtual ~RendererGpuVideoDecoderFactories(); | 71 virtual ~RendererGpuVideoDecoderFactories(); |
| 67 | 72 |
| 68 private: | 73 private: |
| 69 // Helper for the constructor to acquire the ContentGLContext on the | 74 // Helper for the constructor to acquire the ContentGLContext on the |
| 70 // compositor thread (when it is enabled). | 75 // compositor thread (when it is enabled). |
| 71 void AsyncGetContext(WebGraphicsContext3DCommandBufferImpl* context); | 76 void AsyncGetContext(WebGraphicsContext3DCommandBufferImpl* context); |
| 72 | 77 |
| 73 // Async versions of the public methods. They use output parameters instead | 78 // Async versions of the public methods. They use output parameters instead |
| 74 // of return values and each takes a WaitableEvent* param to signal completion | 79 // of return values and each takes a WaitableEvent* param to signal completion |
| 75 // (except for DeleteTexture, which is fire-and-forget). | 80 // (except for DeleteTexture, which is fire-and-forget). |
| 76 // AsyncCreateSharedMemory runs on the renderer thread and the rest run on | 81 // AsyncCreateSharedMemory runs on the renderer thread and the rest run on |
| 77 // |message_loop_|. | 82 // |message_loop_|. |
| 78 // The AsyncCreateVideoDecodeAccelerator returns its output in the vda_ | 83 // The AsyncCreateVideoDecodeAccelerator returns its output in the vda_ |
| 79 // member. | 84 // member. |
| 80 void AsyncCreateVideoDecodeAccelerator( | 85 void AsyncCreateVideoDecodeAccelerator( |
| 81 media::VideoCodecProfile profile, | 86 media::VideoCodecProfile profile, |
| 82 media::VideoDecodeAccelerator::Client* client); | 87 media::VideoDecodeAccelerator::Client* client); |
| 83 void AsyncCreateTextures(int32 count, const gfx::Size& size, | 88 void AsyncCreateTextures(int32 count, const gfx::Size& size, |
| 84 uint32 texture_target); | 89 uint32 texture_target, uint32* sync_point); |
| 85 void AsyncDeleteTexture(uint32 texture_id); | 90 void AsyncDeleteTexture(uint32 texture_id); |
| 91 void AsyncWaitSyncPoint(uint32 sync_point); |
| 86 void AsyncReadPixels(uint32 texture_id, uint32 texture_target, | 92 void AsyncReadPixels(uint32 texture_id, uint32 texture_target, |
| 87 const gfx::Size& size); | 93 const gfx::Size& size); |
| 88 void AsyncCreateSharedMemory(size_t size); | 94 void AsyncCreateSharedMemory(size_t size); |
| 89 void AsyncDestroyVideoDecodeAccelerator(); | 95 void AsyncDestroyVideoDecodeAccelerator(); |
| 90 | 96 |
| 91 scoped_refptr<base::MessageLoopProxy> message_loop_; | 97 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 92 scoped_refptr<GpuChannelHost> gpu_channel_host_; | 98 scoped_refptr<GpuChannelHost> gpu_channel_host_; |
| 93 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_; | 99 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_; |
| 94 | 100 |
| 95 // This event is signaled if we have been asked to Abort(). | 101 // This event is signaled if we have been asked to Abort(). |
| (...skipping 13 matching lines...) Expand all Loading... |
| 109 | 115 |
| 110 // Shared memory segment which is returned by the CreateSharedMemory() | 116 // Shared memory segment which is returned by the CreateSharedMemory() |
| 111 // function. | 117 // function. |
| 112 scoped_ptr<base::SharedMemory> shared_memory_segment_; | 118 scoped_ptr<base::SharedMemory> shared_memory_segment_; |
| 113 | 119 |
| 114 // Bitmap returned by ReadPixels(). | 120 // Bitmap returned by ReadPixels(). |
| 115 SkBitmap read_pixels_bitmap_; | 121 SkBitmap read_pixels_bitmap_; |
| 116 | 122 |
| 117 // Textures returned by the CreateTexture() function. | 123 // Textures returned by the CreateTexture() function. |
| 118 std::vector<uint32> created_textures_; | 124 std::vector<uint32> created_textures_; |
| 125 std::vector<gpu::Mailbox> created_texture_mailboxes_; |
| 119 | 126 |
| 120 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories); | 127 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories); |
| 121 }; | 128 }; |
| 122 | 129 |
| 123 } // namespace content | 130 } // namespace content |
| 124 | 131 |
| 125 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ | 132 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ |
| OLD | NEW |