OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/renderer/media/video_source_handler.h" | 12 #include "content/renderer/media/video_source_handler.h" |
13 #include "ppapi/c/pp_time.h" | 13 #include "ppapi/c/pp_time.h" |
14 #include "ppapi/host/host_message_context.h" | 14 #include "ppapi/host/host_message_context.h" |
15 #include "ppapi/host/resource_host.h" | 15 #include "ppapi/host/resource_host.h" |
16 | 16 |
| 17 struct PP_ImageDataDesc; |
| 18 |
17 namespace content { | 19 namespace content { |
18 | 20 |
19 class RendererPpapiHost; | 21 class RendererPpapiHost; |
20 | 22 |
21 class CONTENT_EXPORT PepperVideoSourceHost | 23 class CONTENT_EXPORT PepperVideoSourceHost |
22 : public ppapi::host::ResourceHost, | 24 : public ppapi::host::ResourceHost, |
23 public content::FrameReaderInterface { | 25 public content::FrameReaderInterface { |
24 public: | 26 public: |
25 PepperVideoSourceHost(RendererPpapiHost* host, | 27 PepperVideoSourceHost(RendererPpapiHost* host, |
26 PP_Instance instance, | 28 PP_Instance instance, |
27 PP_Resource resource); | 29 PP_Resource resource); |
28 | 30 |
29 virtual ~PepperVideoSourceHost(); | 31 virtual ~PepperVideoSourceHost(); |
30 | 32 |
31 // content::FrameReaderInterface implementation. | 33 // content::FrameReaderInterface implementation. |
32 virtual bool GotFrame(cricket::VideoFrame* frame) OVERRIDE; | 34 virtual bool GotFrame(cricket::VideoFrame* frame) OVERRIDE; |
33 | 35 |
34 virtual int32_t OnResourceMessageReceived( | 36 virtual int32_t OnResourceMessageReceived( |
35 const IPC::Message& msg, | 37 const IPC::Message& msg, |
36 ppapi::host::HostMessageContext* context) OVERRIDE; | 38 ppapi::host::HostMessageContext* context) OVERRIDE; |
37 | 39 |
38 private: | 40 private: |
39 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, | 41 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, |
40 const std::string& stream_url); | 42 const std::string& stream_url); |
41 int32_t OnHostMsgGetFrame(ppapi::host::HostMessageContext* context); | 43 int32_t OnHostMsgGetFrame(ppapi::host::HostMessageContext* context); |
42 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context); | 44 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context); |
43 | 45 |
44 void OnGotFrame(scoped_ptr<cricket::VideoFrame> frame); | 46 void OnGotFrame(scoped_ptr<cricket::VideoFrame> frame); |
45 | 47 |
46 int32_t ConvertFrame(ppapi::HostResource* image_data_resource, | 48 int32_t SendGetFrameReply(bool force_reply); |
47 PP_TimeTicks* timestamp); | 49 int32_t ReportGetFrameError(int32_t error, bool force_reply); |
48 void SendFrame(const ppapi::HostResource& image_data_resource, | 50 |
49 PP_TimeTicks timestamp, | |
50 int32_t result); | |
51 void Close(); | 51 void Close(); |
52 | 52 |
53 RendererPpapiHost* renderer_ppapi_host_; | 53 RendererPpapiHost* renderer_ppapi_host_; |
54 | 54 |
55 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; | 55 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; |
56 | 56 |
57 ppapi::host::ReplyMessageContext reply_context_; | 57 ppapi::host::ReplyMessageContext reply_context_; |
58 scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_; | 58 scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_; |
59 | 59 |
60 scoped_ptr<content::VideoSourceHandler> source_handler_; | 60 scoped_ptr<content::VideoSourceHandler> source_handler_; |
61 std::string stream_url_; | 61 std::string stream_url_; |
62 scoped_ptr<cricket::VideoFrame> last_frame_; | 62 scoped_ptr<cricket::VideoFrame> last_frame_; |
63 bool get_frame_pending_; | 63 bool get_frame_pending_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); | 65 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace content | 68 } // namespace content |
69 | 69 |
70 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 70 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
OLD | NEW |