Index: content/common/gpu/client/ipc/chrome/chrome_gpu_video_decode_accelerator_host_ipc_transport.h |
diff --git a/content/common/gpu/client/ipc/chrome/chrome_gpu_video_decode_accelerator_host_ipc_transport.h b/content/common/gpu/client/ipc/chrome/chrome_gpu_video_decode_accelerator_host_ipc_transport.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca492dd93682e4c34dfce57d5b3da59d23554738 |
--- /dev/null |
+++ b/content/common/gpu/client/ipc/chrome/chrome_gpu_video_decode_accelerator_host_ipc_transport.h |
@@ -0,0 +1,85 @@ |
+// Copyright 2016 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_IPC_CHROME_CHROME_GPU_VIDEO_DECODE_ACCELERATOR_HOST_IPC_TRANSPORT_H_ |
+#define CONTENT_COMMON_GPU_CLIENT_IPC_CHROME_CHROME_GPU_VIDEO_DECODE_ACCELERATOR_HOST_IPC_TRANSPORT_H_ |
+ |
+#include "content/common/gpu/client/ipc/gpu_video_decode_accelerator_host_ipc_transport.h" |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "ipc/ipc_listener.h" |
+#include "ipc/ipc_sender.h" |
+#include "media/video/video_decode_accelerator.h" |
+ |
+namespace content { |
+ |
+class ChromeGpuChannelHostIPCTransport; |
+ |
+class ChromeGpuVideoDecodeAcceleratorHostIPCTransport |
+ : public GpuVideoDecodeAcceleratorHostIPCTransport, |
+ public IPC::Listener, |
+ public IPC::Sender { |
+ public: |
+ static scoped_ptr<GpuVideoDecodeAcceleratorHostIPCTransport> Create(); |
+ |
+ ~ChromeGpuVideoDecodeAcceleratorHostIPCTransport() override; |
+ |
+ void BindToService(ChromeGpuChannelHostIPCTransport* channel_transport); |
+ |
+ base::WeakPtr<ChromeGpuVideoDecodeAcceleratorHostIPCTransport> AsWeakPtr(); |
+ |
+ int32_t route_id() const { return route_id_; } |
+ |
+ private: |
+ ChromeGpuVideoDecodeAcceleratorHostIPCTransport(); |
+ |
+ // IPC::Listener implementation. |
+ void OnChannelError() override; |
+ bool OnMessageReceived(const IPC::Message& message) override; |
+ |
+ // IPC::Sender implementation: |
+ bool Send(IPC::Message* message) override; |
+ |
+ void PostNotifyError(media::VideoDecodeAccelerator::Error error); |
+ |
+ // GpuVideoDecodeAcceleratorHostIPCTransport implementation |
+ bool AssignPictureBuffers(const std::vector<int32_t>& buffer_ids, |
+ const std::vector<uint32_t>& texture_ids) override; |
+ bool Decode(const VideoDecodeParams& params) override; |
+ bool Destroy() override; |
+ bool Flush() override; |
+ bool Reset() override; |
+ bool ReusePictureBuffer(int32_t picture_buffer_id) override; |
+ bool SetCdm(int cdm_id) override; |
+ void SetClient( |
+ GpuVideoDecodeAcceleratorHostIPCTransport::Client* client) override; |
+ |
+ // Message handlers. |
+ void OnCdmAttached(bool success); |
+ void OnBitstreamBufferProcessed(int32_t bitstream_buffer_id); |
+ void OnProvidePictureBuffer(uint32_t num_requested_buffers, |
+ const gfx::Size& dimensions, |
+ uint32_t texture_target); |
+ void OnDismissPictureBuffer(int32_t picture_buffer_id); |
+ void OnPictureReady(int32_t picture_buffer_id, |
+ int32_t bitstream_buffer_id, |
+ const gfx::Rect& visible_rect, |
+ bool allow_overlay); |
+ void OnFlushDone(); |
+ void OnResetDone(); |
+ void OnNotifyError(uint32_t error); |
+ |
+ ChromeGpuChannelHostIPCTransport* channel_transport_; |
+ int route_id_; |
+ GpuVideoDecodeAcceleratorHostIPCTransport::Client* client_; |
+ base::WeakPtrFactory<ChromeGpuVideoDecodeAcceleratorHostIPCTransport> |
+ weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeGpuVideoDecodeAcceleratorHostIPCTransport); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_CLIENT_IPC_CHROME_CHROME_GPU_VIDEO_DECODE_ACCELERATOR_HOST_IPC_TRANSPORT_H_ |