| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ACCELERATOR_FACTORIES_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_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 class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories | 41 class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories |
| 42 : public media::GpuVideoAcceleratorFactories { | 42 : public media::GpuVideoAcceleratorFactories { |
| 43 public: | 43 public: |
| 44 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each | 44 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each |
| 45 // use. Safe to call from any thread. | 45 // use. Safe to call from any thread. |
| 46 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create( | 46 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create( |
| 47 GpuChannelHost* gpu_channel_host, | 47 GpuChannelHost* gpu_channel_host, |
| 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 49 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 49 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 50 unsigned image_texture_target, | 50 unsigned image_texture_target, |
| 51 media::VideoPixelFormat video_frame_pixel_format, |
| 51 bool enable_video_accelerator); | 52 bool enable_video_accelerator); |
| 52 | 53 |
| 53 bool IsGpuVideoAcceleratorEnabled() override; | 54 bool IsGpuVideoAcceleratorEnabled() override; |
| 54 // media::GpuVideoAcceleratorFactories implementation. | 55 // media::GpuVideoAcceleratorFactories implementation. |
| 55 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() | 56 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
| 56 override; | 57 override; |
| 57 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() | 58 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
| 58 override; | 59 override; |
| 59 // Creates textures and produces them into mailboxes. Returns true on success | 60 // Creates textures and produces them into mailboxes. Returns true on success |
| 60 // or false on failure. | 61 // or false on failure. |
| 61 bool CreateTextures(int32 count, | 62 bool CreateTextures(int32 count, |
| 62 const gfx::Size& size, | 63 const gfx::Size& size, |
| 63 std::vector<uint32>* texture_ids, | 64 std::vector<uint32>* texture_ids, |
| 64 std::vector<gpu::Mailbox>* texture_mailboxes, | 65 std::vector<gpu::Mailbox>* texture_mailboxes, |
| 65 uint32 texture_target) override; | 66 uint32 texture_target) override; |
| 66 void DeleteTexture(uint32 texture_id) override; | 67 void DeleteTexture(uint32 texture_id) override; |
| 67 void WaitSyncPoint(uint32 sync_point) override; | 68 void WaitSyncPoint(uint32 sync_point) override; |
| 68 | 69 |
| 69 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 70 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 70 const gfx::Size& size, | 71 const gfx::Size& size, |
| 71 gfx::BufferFormat format, | 72 gfx::BufferFormat format, |
| 72 gfx::BufferUsage usage) override; | 73 gfx::BufferUsage usage) override; |
| 73 | 74 |
| 74 bool IsTextureRGSupported() override; | 75 bool IsTextureRGSupported() override; |
| 75 unsigned ImageTextureTarget() override; | 76 unsigned ImageTextureTarget() override; |
| 77 media::VideoPixelFormat VideoFramePixelFormat() override; |
| 76 gpu::gles2::GLES2Interface* GetGLES2Interface() override; | 78 gpu::gles2::GLES2Interface* GetGLES2Interface() override; |
| 77 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; | 79 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; |
| 78 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; | 80 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
| 79 | 81 |
| 80 std::vector<media::VideoDecodeAccelerator::SupportedProfile> | 82 std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 81 GetVideoDecodeAcceleratorSupportedProfiles() override; | 83 GetVideoDecodeAcceleratorSupportedProfiles() override; |
| 82 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 84 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 83 GetVideoEncodeAcceleratorSupportedProfiles() override; | 85 GetVideoEncodeAcceleratorSupportedProfiles() override; |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; | 88 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; |
| 87 RendererGpuVideoAcceleratorFactories( | 89 RendererGpuVideoAcceleratorFactories( |
| 88 GpuChannelHost* gpu_channel_host, | 90 GpuChannelHost* gpu_channel_host, |
| 89 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 91 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 90 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 92 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 91 unsigned image_texture_target, | 93 unsigned image_texture_target, |
| 94 media::VideoPixelFormat video_frame_pixel_format_, |
| 92 bool enable_video_accelerator); | 95 bool enable_video_accelerator); |
| 93 | 96 |
| 94 ~RendererGpuVideoAcceleratorFactories() override; | 97 ~RendererGpuVideoAcceleratorFactories() override; |
| 95 | 98 |
| 96 // Helper to bind |context_provider| to the |task_runner_| thread after | 99 // Helper to bind |context_provider| to the |task_runner_| thread after |
| 97 // construction. | 100 // construction. |
| 98 void BindContext(); | 101 void BindContext(); |
| 99 | 102 |
| 100 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, | 103 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, |
| 101 // if it has not been lost yet. | 104 // if it has not been lost yet. |
| 102 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); | 105 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); |
| 103 GLHelper* GetGLHelper(); | 106 GLHelper* GetGLHelper(); |
| 104 | 107 |
| 105 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 108 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 106 scoped_refptr<GpuChannelHost> gpu_channel_host_; | 109 scoped_refptr<GpuChannelHost> gpu_channel_host_; |
| 107 scoped_refptr<ContextProviderCommandBuffer> context_provider_; | 110 scoped_refptr<ContextProviderCommandBuffer> context_provider_; |
| 108 | 111 |
| 109 const unsigned image_texture_target_; | 112 const unsigned image_texture_target_; |
| 113 const media::VideoPixelFormat video_frame_pixel_format_; |
| 110 // Whether video acceleration encoding/decoding should be enabled. | 114 // Whether video acceleration encoding/decoding should be enabled. |
| 111 const bool video_accelerator_enabled_; | 115 const bool video_accelerator_enabled_; |
| 112 | 116 |
| 113 scoped_ptr<GLHelper> gl_helper_; | 117 scoped_ptr<GLHelper> gl_helper_; |
| 114 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; | 118 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
| 115 | 119 |
| 116 // For sending requests to allocate shared memory in the Browser process. | 120 // For sending requests to allocate shared memory in the Browser process. |
| 117 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 121 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 118 | 122 |
| 119 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); | 123 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); |
| 120 }; | 124 }; |
| 121 | 125 |
| 122 } // namespace content | 126 } // namespace content |
| 123 | 127 |
| 124 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 128 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| OLD | NEW |