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