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 MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 5 #ifndef MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
6 #define MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 6 #define MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "gpu/command_buffer/client/gles2_interface.h" | 16 #include "gpu/command_buffer/client/gles2_interface.h" |
17 #include "gpu/command_buffer/common/mailbox.h" | 17 #include "gpu/command_buffer/common/mailbox.h" |
18 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
19 #include "media/base/video_types.h" | 19 #include "media/base/video_types.h" |
20 #include "media/video/video_decode_accelerator.h" | 20 #include "media/video/video_decode_accelerator.h" |
21 #include "media/video/video_encode_accelerator.h" | 21 #include "media/video/video_encode_accelerator.h" |
22 #include "ui/gfx/gpu_memory_buffer.h" | 22 #include "ui/gfx/gpu_memory_buffer.h" |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 private: | 58 private: |
59 DISALLOW_COPY_AND_ASSIGN(ScopedGLContextLock); | 59 DISALLOW_COPY_AND_ASSIGN(ScopedGLContextLock); |
60 }; | 60 }; |
61 | 61 |
62 // Return whether GPU encoding/decoding is enabled. | 62 // Return whether GPU encoding/decoding is enabled. |
63 virtual bool IsGpuVideoAcceleratorEnabled() = 0; | 63 virtual bool IsGpuVideoAcceleratorEnabled() = 0; |
64 // Caller owns returned pointer, but should call Destroy() on it (instead of | 64 // Caller owns returned pointer, but should call Destroy() on it (instead of |
65 // directly deleting) for proper destruction, as per the | 65 // directly deleting) for proper destruction, as per the |
66 // VideoDecodeAccelerator interface. | 66 // VideoDecodeAccelerator interface. |
67 virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() = 0; | 67 virtual std::unique_ptr<VideoDecodeAccelerator> |
| 68 CreateVideoDecodeAccelerator() = 0; |
68 | 69 |
69 // Caller owns returned pointer, but should call Destroy() on it (instead of | 70 // Caller owns returned pointer, but should call Destroy() on it (instead of |
70 // directly deleting) for proper destruction, as per the | 71 // directly deleting) for proper destruction, as per the |
71 // VideoEncodeAccelerator interface. | 72 // VideoEncodeAccelerator interface. |
72 virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0; | 73 virtual std::unique_ptr<VideoEncodeAccelerator> |
| 74 CreateVideoEncodeAccelerator() = 0; |
73 | 75 |
74 // Allocate & delete native textures. | 76 // Allocate & delete native textures. |
75 virtual bool CreateTextures(int32_t count, | 77 virtual bool CreateTextures(int32_t count, |
76 const gfx::Size& size, | 78 const gfx::Size& size, |
77 std::vector<uint32_t>* texture_ids, | 79 std::vector<uint32_t>* texture_ids, |
78 std::vector<gpu::Mailbox>* texture_mailboxes, | 80 std::vector<gpu::Mailbox>* texture_mailboxes, |
79 uint32_t texture_target) = 0; | 81 uint32_t texture_target) = 0; |
80 virtual void DeleteTexture(uint32_t texture_id) = 0; | 82 virtual void DeleteTexture(uint32_t texture_id) = 0; |
81 | 83 |
82 virtual void WaitSyncToken(const gpu::SyncToken& sync_token) = 0; | 84 virtual void WaitSyncToken(const gpu::SyncToken& sync_token) = 0; |
83 | 85 |
84 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 86 virtual std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
85 const gfx::Size& size, | 87 const gfx::Size& size, |
86 gfx::BufferFormat format, | 88 gfx::BufferFormat format, |
87 gfx::BufferUsage usage) = 0; | 89 gfx::BufferUsage usage) = 0; |
88 | 90 |
89 virtual bool ShouldUseGpuMemoryBuffersForVideoFrames() const = 0; | 91 virtual bool ShouldUseGpuMemoryBuffersForVideoFrames() const = 0; |
90 virtual unsigned ImageTextureTarget(gfx::BufferFormat format) = 0; | 92 virtual unsigned ImageTextureTarget(gfx::BufferFormat format) = 0; |
91 // Pixel format of the hardware video frames created when GpuMemoryBuffers | 93 // Pixel format of the hardware video frames created when GpuMemoryBuffers |
92 // video frames are enabled. | 94 // video frames are enabled. |
93 virtual VideoPixelFormat VideoFrameOutputFormat() = 0; | 95 virtual VideoPixelFormat VideoFrameOutputFormat() = 0; |
94 | 96 |
95 virtual scoped_ptr<ScopedGLContextLock> GetGLContextLock() = 0; | 97 virtual std::unique_ptr<ScopedGLContextLock> GetGLContextLock() = 0; |
96 | 98 |
97 // Allocate & return a shared memory segment. | 99 // Allocate & return a shared memory segment. |
98 virtual scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) = 0; | 100 virtual std::unique_ptr<base::SharedMemory> CreateSharedMemory( |
| 101 size_t size) = 0; |
99 | 102 |
100 // Returns the task runner the video accelerator runs on. | 103 // Returns the task runner the video accelerator runs on. |
101 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; | 104 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; |
102 | 105 |
103 // Return the capabilities of video decode accelerator, which includes the | 106 // Return the capabilities of video decode accelerator, which includes the |
104 // supported codec profiles. | 107 // supported codec profiles. |
105 virtual VideoDecodeAccelerator::Capabilities | 108 virtual VideoDecodeAccelerator::Capabilities |
106 GetVideoDecodeAcceleratorCapabilities() = 0; | 109 GetVideoDecodeAcceleratorCapabilities() = 0; |
107 | 110 |
108 // Returns the supported codec profiles of video encode accelerator. | 111 // Returns the supported codec profiles of video encode accelerator. |
109 virtual VideoEncodeAccelerator::SupportedProfiles | 112 virtual VideoEncodeAccelerator::SupportedProfiles |
110 GetVideoEncodeAcceleratorSupportedProfiles() = 0; | 113 GetVideoEncodeAcceleratorSupportedProfiles() = 0; |
111 | 114 |
112 protected: | 115 protected: |
113 friend class base::RefCounted<GpuVideoAcceleratorFactories>; | 116 friend class base::RefCounted<GpuVideoAcceleratorFactories>; |
114 virtual ~GpuVideoAcceleratorFactories() {} | 117 virtual ~GpuVideoAcceleratorFactories() {} |
115 }; | 118 }; |
116 | 119 |
117 } // namespace media | 120 } // namespace media |
118 | 121 |
119 #endif // MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 122 #endif // MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
OLD | NEW |