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_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/common/gpu/gpu_command_buffer_stub.h" | 12 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 13 #include "gpu/command_buffer/common/mailbox_holder.h" |
13 #include "gpu/config/gpu_info.h" | 14 #include "gpu/config/gpu_info.h" |
14 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
15 #include "media/video/video_encode_accelerator.h" | 16 #include "media/video/video_encode_accelerator.h" |
16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 | 20 |
20 class SharedMemory; | 21 class SharedMemory; |
21 | 22 |
22 } // namespace base | 23 } // namespace base |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 68 |
68 // Return a set of VEA Create function pointers applicable to the current | 69 // Return a set of VEA Create function pointers applicable to the current |
69 // platform. | 70 // platform. |
70 static std::vector<CreateVEAFp> CreateVEAFps(); | 71 static std::vector<CreateVEAFp> CreateVEAFps(); |
71 static scoped_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); | 72 static scoped_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); |
72 static scoped_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); | 73 static scoped_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); |
73 static scoped_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); | 74 static scoped_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); |
74 | 75 |
75 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer | 76 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer |
76 // process. | 77 // process. |
77 void OnEncode(int32 frame_id, | 78 void OnEncodeSharedMemory(int32 frame_id, |
78 base::SharedMemoryHandle buffer_handle, | 79 base::SharedMemoryHandle buffer_handle, |
79 uint32 buffer_offset, | 80 uint32 buffer_offset, |
80 uint32 buffer_size, | 81 uint32 buffer_size, |
81 bool force_keyframe); | 82 bool force_keyframe); |
| 83 void OnEncodeNativeTexture(int32 frame_id, |
| 84 gpu::MailboxHolder mailbox_holder, |
| 85 bool force_keyframe); |
82 void OnUseOutputBitstreamBuffer(int32 buffer_id, | 86 void OnUseOutputBitstreamBuffer(int32 buffer_id, |
83 base::SharedMemoryHandle buffer_handle, | 87 base::SharedMemoryHandle buffer_handle, |
84 uint32 buffer_size); | 88 uint32 buffer_size); |
85 void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate); | 89 void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate); |
86 | 90 |
87 void OnDestroy(); | 91 void OnDestroy(); |
88 | 92 |
89 void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm); | 93 void EncodeSharedMemoryFrameFinished(int32 frame_id, |
| 94 scoped_ptr<base::SharedMemory> shm); |
| 95 |
| 96 void EncodeNativeTextureFrameFinished(int32 frame_id); |
90 | 97 |
91 void Send(IPC::Message* message); | 98 void Send(IPC::Message* message); |
92 // Helper for replying to the creation request. | 99 // Helper for replying to the creation request. |
93 void SendCreateEncoderReply(IPC::Message* message, bool succeeded); | 100 void SendCreateEncoderReply(IPC::Message* message, bool succeeded); |
94 | 101 |
95 // Route ID to communicate with the host. | 102 // Route ID to communicate with the host. |
96 int32 host_route_id_; | 103 int32 host_route_id_; |
97 | 104 |
98 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is | 105 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is |
99 // registered as a DestuctionObserver of |stub_| and will self-delete when | 106 // registered as a DestuctionObserver of |stub_| and will self-delete when |
(...skipping 12 matching lines...) Expand all Loading... |
112 | 119 |
113 // Weak pointer for media::VideoFrames that refer back to |this|. | 120 // Weak pointer for media::VideoFrames that refer back to |this|. |
114 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; | 121 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; |
115 | 122 |
116 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); | 123 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); |
117 }; | 124 }; |
118 | 125 |
119 } // namespace content | 126 } // namespace content |
120 | 127 |
121 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 128 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |