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

Side by Side Diff: content/renderer/pepper/pepper_video_writer_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/renderer/pepper/pepper_video_writer_host.h"
6
7 #include "base/bind.h"
8 #include "content/public/renderer/renderer_ppapi_host.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/host/dispatch_host_message.h"
11 #include "ppapi/host/host_message_context.h"
12 #include "ppapi/host/ppapi_host.h"
13 #include "ppapi/proxy/ppapi_messages.h"
14
15 using ppapi::host::HostMessageContext;
16 using ppapi::host::ReplyMessageContext;
17
18 namespace content {
19
20 PepperVideoWriterHost::PepperVideoWriterHost(
21 RendererPpapiHost* host,
22 PP_Instance instance,
23 PP_Resource resource)
24 : ResourceHost(host->GetPpapiHost(), instance, resource),
25 renderer_ppapi_host_(host),
26 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
27 }
28
29 PepperVideoWriterHost::~PepperVideoWriterHost() {
30 }
31
32 int32_t PepperVideoWriterHost::OnResourceMessageReceived(
33 const IPC::Message& msg,
34 HostMessageContext* context) {
35 if (!host()->permissions().HasPermission(ppapi::PERMISSION_PRIVATE))
36 return PP_ERROR_FAILED;
37
38 IPC_BEGIN_MESSAGE_MAP(PepperVideoWriterHost, msg)
39 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoWriter_Open,
40 OnHostMsgOpen)
41 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_VideoWriter_PutFrame,
42 OnHostMsgPutFrame)
43 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoWriter_Close,
44 OnHostMsgClose)
45 IPC_END_MESSAGE_MAP()
46 return PP_ERROR_FAILED;
47 }
48
49 int32_t PepperVideoWriterHost::OnHostMsgOpen(HostMessageContext* context) {
50 ReplyMessageContext reply_context = context->MakeReplyMessageContext();
51 // Open a video stream for writing.
52 std::string stream_id;
53 reply_context.params.set_result(PP_ERROR_FAILED);
54 host()->SendReply(reply_context,
55 PpapiPluginMsg_VideoWriter_OpenReply(stream_id));
56 return PP_OK_COMPLETIONPENDING;
57 }
58
59 int32_t PepperVideoWriterHost::OnHostMsgPutFrame(
60 HostMessageContext* context,
61 const ppapi::HostResource& image_data,
62 double timestamp) {
63 ReplyMessageContext reply_context = context->MakeReplyMessageContext();
64 // Copy the image data to the video stream.
65 reply_context.params.set_result(PP_ERROR_FAILED);
66 return PP_OK_COMPLETIONPENDING;
67 }
68
69 int32_t PepperVideoWriterHost::OnHostMsgClose(HostMessageContext* context) {
70 // Close the video stream.
71 return PP_OK;
72 }
73
74 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698