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_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // gpu::GpuCommandBufferStub::DestructionObserver implementation. | 67 // gpu::GpuCommandBufferStub::DestructionObserver implementation. |
68 void OnWillDestroyStub() override; | 68 void OnWillDestroyStub() override; |
69 | 69 |
70 // Static query for supported profiles. This query calls the appropriate | 70 // Static query for supported profiles. This query calls the appropriate |
71 // platform-specific version. The returned supported profiles vector will | 71 // platform-specific version. The returned supported profiles vector will |
72 // not contain duplicates. | 72 // not contain duplicates. |
73 static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles( | 73 static gpu::VideoEncodeAcceleratorSupportedProfiles GetSupportedProfiles( |
74 const gpu::GpuPreferences& gpu_preferences); | 74 const gpu::GpuPreferences& gpu_preferences); |
75 | 75 |
76 private: | 76 private: |
77 typedef std::unique_ptr<VideoEncodeAccelerator> (*CreateVEAFp)(); | 77 // Returns a vector of VEAFactoryFunctions for the current platform. |
78 | 78 using VEAFactoryFunction = |
79 // Return a set of VEA Create function pointers applicable to the current | 79 base::Callback<std::unique_ptr<VideoEncodeAccelerator>()>; |
80 // platform. | 80 static std::vector<VEAFactoryFunction> GetVEAFactoryFunctions( |
81 static std::vector<CreateVEAFp> CreateVEAFps( | |
82 const gpu::GpuPreferences& gpu_preferences); | 81 const gpu::GpuPreferences& gpu_preferences); |
83 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
84 static std::unique_ptr<VideoEncodeAccelerator> CreateV4L2VEA(); | |
85 #endif | |
86 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
87 static std::unique_ptr<VideoEncodeAccelerator> CreateVaapiVEA(); | |
88 #endif | |
89 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | |
90 static std::unique_ptr<VideoEncodeAccelerator> CreateAndroidVEA(); | |
91 #endif | |
92 #if defined(OS_MACOSX) | |
93 static std::unique_ptr<VideoEncodeAccelerator> CreateVTVEA(); | |
94 #endif | |
95 #if defined(OS_WIN) | |
96 static std::unique_ptr<media::VideoEncodeAccelerator> | |
97 CreateMediaFoundationVEA(); | |
98 #endif | |
99 | 82 |
100 // IPC handlers, proxying VideoEncodeAccelerator for the renderer | 83 // IPC handlers, proxying VideoEncodeAccelerator for the renderer |
101 // process. | 84 // process. |
102 void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params); | 85 void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params); |
103 void OnEncode2(const AcceleratedVideoEncoderMsg_Encode_Params2& params); | 86 void OnEncode2(const AcceleratedVideoEncoderMsg_Encode_Params2& params); |
104 void OnUseOutputBitstreamBuffer(int32_t buffer_id, | 87 void OnUseOutputBitstreamBuffer(int32_t buffer_id, |
105 base::SharedMemoryHandle buffer_handle, | 88 base::SharedMemoryHandle buffer_handle, |
106 uint32_t buffer_size); | 89 uint32_t buffer_size); |
107 void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate); | 90 void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate); |
108 | 91 |
(...skipping 23 matching lines...) Expand all Loading... |
132 | 115 |
133 // Weak pointer for VideoFrames that refer back to |this|. | 116 // Weak pointer for VideoFrames that refer back to |this|. |
134 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; | 117 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; |
135 | 118 |
136 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); | 119 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); |
137 }; | 120 }; |
138 | 121 |
139 } // namespace media | 122 } // namespace media |
140 | 123 |
141 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 124 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |