Index: content/common/gpu/client/gpu_video_encode_accelerator_host.h |
diff --git a/content/common/gpu/client/gpu_video_encode_accelerator_host.h b/content/common/gpu/client/gpu_video_encode_accelerator_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..258af75b642d3191ac3b3968eaab1daeabe54fb7 |
--- /dev/null |
+++ b/content/common/gpu/client/gpu_video_encode_accelerator_host.h |
@@ -0,0 +1,86 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
+#define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
+ |
+#include <vector> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "ipc/ipc_listener.h" |
+#include "media/video/video_encode_accelerator.h" |
+ |
+namespace gfx { |
+ |
+class Size; |
+ |
+} // namespace gfx |
+ |
+namespace content { |
+ |
+class GpuChannelHost; |
+ |
+// This class is the renderer-side host for the VideoEncodeAccelerator in the |
+// GPU process, coordinated over IPC. |
+class GpuVideoEncodeAcceleratorHost |
+ : public IPC::Listener, |
+ public media::VideoEncodeAccelerator, |
+ public base::SupportsWeakPtr<GpuVideoEncodeAcceleratorHost> { |
+ public: |
+ // |client| is assumed to outlive this object. Since the GpuChannelHost does |
+ // _not_ own this object, a reference to |gpu_channel_host| is taken. |
+ GpuVideoEncodeAcceleratorHost( |
+ media::VideoEncodeAccelerator::Client* client, |
+ const scoped_refptr<GpuChannelHost>& gpu_channel_host, |
+ int32 route_id); |
+ virtual ~GpuVideoEncodeAcceleratorHost(); |
+ |
+ // Static query for the supported profiles. This query proxies to |
+ // GpuVideoEncodeAcceleratorHost::GetSupportedProfiles(). |
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
s/GpuVideoEncodeAcceleratorHost/GpuVideoEncodeAcce
sheu
2013/08/02 01:27:49
Done.
|
+ static std::vector<SupportedProfile> GetSupportedProfiles(); |
+ |
+ // IPC::Listener implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ virtual void OnChannelError() OVERRIDE; |
+ |
+ // media::VideoEncodeAccelerator implementation. |
+ virtual void Initialize(media::VideoFrame::Format format, |
+ const gfx::Size& input_resolution, |
+ media::VideoCodecProfile output_profile, |
+ int32 initial_bitrate) OVERRIDE; |
+ virtual void Encode(const media::BitstreamBuffer& buffer, |
+ bool force_keyframe) OVERRIDE; |
+ virtual void UseOutputBitstreamBuffer( |
+ const media::BitstreamBuffer& buffer) OVERRIDE; |
+ virtual void RequestEncodingParameterChange(int32 bitrate) OVERRIDE; |
+ virtual void Destroy() OVERRIDE; |
+ |
+ private: |
+ bool Send(IPC::Message* message); |
+ |
+ // Unowned pointer to the client. |
+ media::VideoEncodeAccelerator::Client* client_; |
+ |
+ // IPC channel and route ID. |
+ scoped_refptr<GpuChannelHost> channel_; |
+ const int32 route_id_; |
+ |
+ // IPC handlers |
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
s/$/ proxying media::VideoEncodeAccelerator::Clien
sheu
2013/08/02 01:27:49
Done.
|
+ void OnNotifyInitializeDone(); |
+ void OnRequireBitstreamBuffers(int input_count, |
+ const gfx::Size& input_dimensions, |
+ uint32 output_size); |
+ void OnNotifyInputDone(int32 bitstream_buffer_id); |
+ void OnBitstreamBufferReady(int32 bitstream_buffer_id, |
+ uint32 payload_size, |
+ bool key_frame); |
+ void OnNotifyError(Error error); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |