Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Unified Diff: content/renderer/pepper/pepper_video_reader_host.cc

Issue 13771020: Add Pepper VideoReader and VideoWriter plumbing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_video_reader_host.cc
diff --git a/content/renderer/pepper/pepper_video_reader_host.cc b/content/renderer/pepper/pepper_video_reader_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d8851380acbb929af7af08489f21cae1ae6386e9
--- /dev/null
+++ b/content/renderer/pepper/pepper_video_reader_host.cc
@@ -0,0 +1,77 @@
+// 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.
+
+#include "content/renderer/pepper/pepper_video_reader_host.h"
+
+#include "base/bind.h"
+#include "content/public/renderer/renderer_ppapi_host.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/dispatch_host_message.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+using ppapi::host::HostMessageContext;
+using ppapi::host::ReplyMessageContext;
+
+namespace content {
+
+PepperVideoReaderHost::PepperVideoReaderHost(
+ RendererPpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource)
+ : ResourceHost(host->GetPpapiHost(), instance, resource),
+ renderer_ppapi_host_(host),
+ weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+}
+
+PepperVideoReaderHost::~PepperVideoReaderHost() {
+}
+
+int32_t PepperVideoReaderHost::OnResourceMessageReceived(
+ const IPC::Message& msg,
+ HostMessageContext* context) {
+ if (!host()->permissions().HasPermission(ppapi::PERMISSION_PRIVATE))
+ return PP_ERROR_FAILED;
+
+ IPC_BEGIN_MESSAGE_MAP(PepperVideoReaderHost, msg)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_VideoReader_Open,
+ OnHostMsgOpen)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoReader_GetFrame,
+ OnHostMsgGetFrame)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoReader_Close,
+ OnHostMsgClose)
+ IPC_END_MESSAGE_MAP()
+ return PP_ERROR_FAILED;
+}
+
+int32_t PepperVideoReaderHost::OnHostMsgOpen(HostMessageContext* context,
+ const std::string& stream_id) {
+ ReplyMessageContext reply_context = context->MakeReplyMessageContext();
+ // Create the video stream here and return error / result code.
+ reply_context.params.set_result(PP_ERROR_FAILED);
+ host()->SendReply(reply_context,
+ PpapiPluginMsg_VideoReader_OpenReply());
+ return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t PepperVideoReaderHost::OnHostMsgGetFrame(HostMessageContext* context) {
+ ReplyMessageContext reply_context = context->MakeReplyMessageContext();
+ // Create an image data resource and copy the stream's next frame into it.
Ronghua Wu (Left Chromium) 2013/04/08 22:34:39 Will the plugin need to call this GetFrame for eve
bbudge 2013/04/08 22:38:01 My understanding of this API is that the plugin 'p
+ // Return a timestamp.
+ ppapi::HostResource image_data;
+ double timestamp = 0;
+ reply_context.params.set_result(PP_ERROR_FAILED);
+ host()->SendReply(
+ reply_context,
+ PpapiPluginMsg_VideoReader_GetFrameReply(image_data, timestamp));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+int32_t PepperVideoReaderHost::OnHostMsgClose(HostMessageContext* context) {
+ // Close the video stream.
+ return PP_OK;
+}
+
+} // namespace content
« no previous file with comments | « content/renderer/pepper/pepper_video_reader_host.h ('k') | content/renderer/pepper/pepper_video_writer_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698