| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool enable_gpu_memory_buffer_video_frames, | 50 bool enable_gpu_memory_buffer_video_frames, |
| 51 unsigned image_texture_target, | 51 unsigned image_texture_target, |
| 52 media::VideoPixelFormat video_frame_output_format, |
| 52 bool enable_video_accelerator); | 53 bool enable_video_accelerator); |
| 53 | 54 |
| 54 bool IsGpuVideoAcceleratorEnabled() override; | 55 bool IsGpuVideoAcceleratorEnabled() override; |
| 55 // media::GpuVideoAcceleratorFactories implementation. | 56 // media::GpuVideoAcceleratorFactories implementation. |
| 56 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() | 57 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
| 57 override; | 58 override; |
| 58 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() | 59 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
| 59 override; | 60 override; |
| 60 // Creates textures and produces them into mailboxes. Returns true on success | 61 // Creates textures and produces them into mailboxes. Returns true on success |
| 61 // or false on failure. | 62 // or false on failure. |
| 62 bool CreateTextures(int32 count, | 63 bool CreateTextures(int32 count, |
| 63 const gfx::Size& size, | 64 const gfx::Size& size, |
| 64 std::vector<uint32>* texture_ids, | 65 std::vector<uint32>* texture_ids, |
| 65 std::vector<gpu::Mailbox>* texture_mailboxes, | 66 std::vector<gpu::Mailbox>* texture_mailboxes, |
| 66 uint32 texture_target) override; | 67 uint32 texture_target) override; |
| 67 void DeleteTexture(uint32 texture_id) override; | 68 void DeleteTexture(uint32 texture_id) override; |
| 68 void WaitSyncPoint(uint32 sync_point) override; | 69 void WaitSyncPoint(uint32 sync_point) override; |
| 69 | 70 |
| 70 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 71 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 71 const gfx::Size& size, | 72 const gfx::Size& size, |
| 72 gfx::BufferFormat format, | 73 gfx::BufferFormat format, |
| 73 gfx::BufferUsage usage) override; | 74 gfx::BufferUsage usage) override; |
| 74 | 75 |
| 75 bool IsTextureRGSupported() override; | 76 bool IsTextureRGSupported() override; |
| 76 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; | 77 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; |
| 77 unsigned ImageTextureTarget() override; | 78 unsigned ImageTextureTarget() override; |
| 79 media::VideoPixelFormat VideoFrameOutputFormat() override; |
| 78 gpu::gles2::GLES2Interface* GetGLES2Interface() override; | 80 gpu::gles2::GLES2Interface* GetGLES2Interface() override; |
| 79 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; | 81 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; |
| 80 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; | 82 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
| 81 | 83 |
| 82 std::vector<media::VideoDecodeAccelerator::SupportedProfile> | 84 std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 83 GetVideoDecodeAcceleratorSupportedProfiles() override; | 85 GetVideoDecodeAcceleratorSupportedProfiles() override; |
| 84 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 86 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 85 GetVideoEncodeAcceleratorSupportedProfiles() override; | 87 GetVideoEncodeAcceleratorSupportedProfiles() override; |
| 86 | 88 |
| 87 private: | 89 private: |
| 88 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; | 90 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; |
| 89 RendererGpuVideoAcceleratorFactories( | 91 RendererGpuVideoAcceleratorFactories( |
| 90 GpuChannelHost* gpu_channel_host, | 92 GpuChannelHost* gpu_channel_host, |
| 91 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 93 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 92 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 94 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 93 bool enable_gpu_memory_buffer_video_frames, | 95 bool enable_gpu_memory_buffer_video_frames, |
| 94 unsigned image_texture_target, | 96 unsigned image_texture_target, |
| 97 media::VideoPixelFormat video_frame_output_format_, |
| 95 bool enable_video_accelerator); | 98 bool enable_video_accelerator); |
| 96 | 99 |
| 97 ~RendererGpuVideoAcceleratorFactories() override; | 100 ~RendererGpuVideoAcceleratorFactories() override; |
| 98 | 101 |
| 99 // Helper to bind |context_provider| to the |task_runner_| thread after | 102 // Helper to bind |context_provider| to the |task_runner_| thread after |
| 100 // construction. | 103 // construction. |
| 101 void BindContext(); | 104 void BindContext(); |
| 102 | 105 |
| 103 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, | 106 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, |
| 104 // if it has not been lost yet. | 107 // if it has not been lost yet. |
| 105 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); | 108 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); |
| 106 GLHelper* GetGLHelper(); | 109 GLHelper* GetGLHelper(); |
| 107 | 110 |
| 108 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 111 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 109 scoped_refptr<GpuChannelHost> gpu_channel_host_; | 112 scoped_refptr<GpuChannelHost> gpu_channel_host_; |
| 110 scoped_refptr<ContextProviderCommandBuffer> context_provider_; | 113 scoped_refptr<ContextProviderCommandBuffer> context_provider_; |
| 111 | 114 |
| 112 // Wheter gpu memory buffers should be used to hold video frames data. | 115 // Whether gpu memory buffers should be used to hold video frames data. |
| 113 bool enable_gpu_memory_buffer_video_frames_; | 116 bool enable_gpu_memory_buffer_video_frames_; |
| 114 const unsigned image_texture_target_; | 117 const unsigned image_texture_target_; |
| 118 // Pixel format of the hardware video frames created when GpuMemoryBuffers |
| 119 // video frames are enabled. |
| 120 const media::VideoPixelFormat video_frame_output_format_; |
| 115 // Whether video acceleration encoding/decoding should be enabled. | 121 // Whether video acceleration encoding/decoding should be enabled. |
| 116 const bool video_accelerator_enabled_; | 122 const bool video_accelerator_enabled_; |
| 117 | 123 |
| 118 scoped_ptr<GLHelper> gl_helper_; | 124 scoped_ptr<GLHelper> gl_helper_; |
| 119 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; | 125 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
| 120 | 126 |
| 121 // For sending requests to allocate shared memory in the Browser process. | 127 // For sending requests to allocate shared memory in the Browser process. |
| 122 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 128 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 123 | 129 |
| 124 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); | 130 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); |
| 125 }; | 131 }; |
| 126 | 132 |
| 127 } // namespace content | 133 } // namespace content |
| 128 | 134 |
| 129 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 135 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
| OLD | NEW |