| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/proxy/ppp_video_decoder_proxy.h" | 5 #include "ppapi/proxy/ppp_video_decoder_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/host_dispatcher.h" | 7 #include "ppapi/proxy/host_dispatcher.h" |
| 8 #include "ppapi/proxy/plugin_globals.h" | 8 #include "ppapi/proxy/plugin_globals.h" |
| 9 #include "ppapi/proxy/plugin_resource_tracker.h" | 9 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 void ProvidePictureBuffers(PP_Instance instance, PP_Resource decoder, | 23 void ProvidePictureBuffers(PP_Instance instance, PP_Resource decoder, |
| 24 uint32_t req_num_of_bufs, | 24 uint32_t req_num_of_bufs, |
| 25 const PP_Size* dimensions) { | 25 const PP_Size* dimensions) { |
| 26 HostResource decoder_resource; | 26 HostResource decoder_resource; |
| 27 decoder_resource.SetHostResource(instance, decoder); | 27 decoder_resource.SetHostResource(instance, decoder); |
| 28 | 28 |
| 29 HostDispatcher::GetForInstance(instance)->Send( | 29 HostDispatcher::GetForInstance(instance)->Send( |
| 30 new PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers( | 30 new PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers( |
| 31 INTERFACE_ID_PPP_VIDEO_DECODER_DEV, | 31 API_ID_PPP_VIDEO_DECODER_DEV, |
| 32 decoder_resource, req_num_of_bufs, *dimensions)); | 32 decoder_resource, req_num_of_bufs, *dimensions)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void DismissPictureBuffer(PP_Instance instance, PP_Resource decoder, | 35 void DismissPictureBuffer(PP_Instance instance, PP_Resource decoder, |
| 36 int32_t picture_buffer_id) { | 36 int32_t picture_buffer_id) { |
| 37 HostResource decoder_resource; | 37 HostResource decoder_resource; |
| 38 decoder_resource.SetHostResource(instance, decoder); | 38 decoder_resource.SetHostResource(instance, decoder); |
| 39 | 39 |
| 40 HostDispatcher::GetForInstance(instance)->Send( | 40 HostDispatcher::GetForInstance(instance)->Send( |
| 41 new PpapiMsg_PPPVideoDecoder_DismissPictureBuffer( | 41 new PpapiMsg_PPPVideoDecoder_DismissPictureBuffer( |
| 42 INTERFACE_ID_PPP_VIDEO_DECODER_DEV, | 42 API_ID_PPP_VIDEO_DECODER_DEV, |
| 43 decoder_resource, picture_buffer_id)); | 43 decoder_resource, picture_buffer_id)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void PictureReady(PP_Instance instance, PP_Resource decoder, | 46 void PictureReady(PP_Instance instance, PP_Resource decoder, |
| 47 const PP_Picture_Dev* picture) { | 47 const PP_Picture_Dev* picture) { |
| 48 HostResource decoder_resource; | 48 HostResource decoder_resource; |
| 49 decoder_resource.SetHostResource(instance, decoder); | 49 decoder_resource.SetHostResource(instance, decoder); |
| 50 | 50 |
| 51 HostDispatcher::GetForInstance(instance)->Send( | 51 HostDispatcher::GetForInstance(instance)->Send( |
| 52 new PpapiMsg_PPPVideoDecoder_PictureReady( | 52 new PpapiMsg_PPPVideoDecoder_PictureReady( |
| 53 INTERFACE_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, *picture)); | 53 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, *picture)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void EndOfStream(PP_Instance instance, PP_Resource decoder) { | 56 void EndOfStream(PP_Instance instance, PP_Resource decoder) { |
| 57 HostResource decoder_resource; | 57 HostResource decoder_resource; |
| 58 decoder_resource.SetHostResource(instance, decoder); | 58 decoder_resource.SetHostResource(instance, decoder); |
| 59 | 59 |
| 60 HostDispatcher::GetForInstance(instance)->Send( | 60 HostDispatcher::GetForInstance(instance)->Send( |
| 61 new PpapiMsg_PPPVideoDecoder_NotifyEndOfStream( | 61 new PpapiMsg_PPPVideoDecoder_NotifyEndOfStream( |
| 62 INTERFACE_ID_PPP_VIDEO_DECODER_DEV, decoder_resource)); | 62 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void NotifyError(PP_Instance instance, PP_Resource decoder, | 65 void NotifyError(PP_Instance instance, PP_Resource decoder, |
| 66 PP_VideoDecodeError_Dev error) { | 66 PP_VideoDecodeError_Dev error) { |
| 67 HostResource decoder_resource; | 67 HostResource decoder_resource; |
| 68 decoder_resource.SetHostResource(instance, decoder); | 68 decoder_resource.SetHostResource(instance, decoder); |
| 69 | 69 |
| 70 HostDispatcher::GetForInstance(instance)->Send( | 70 HostDispatcher::GetForInstance(instance)->Send( |
| 71 new PpapiMsg_PPPVideoDecoder_NotifyError( | 71 new PpapiMsg_PPPVideoDecoder_NotifyError( |
| 72 INTERFACE_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error)); | 72 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 static const PPP_VideoDecoder_Dev video_decoder_interface = { | 75 static const PPP_VideoDecoder_Dev video_decoder_interface = { |
| 76 &ProvidePictureBuffers, | 76 &ProvidePictureBuffers, |
| 77 &DismissPictureBuffer, | 77 &DismissPictureBuffer, |
| 78 &PictureReady, | 78 &PictureReady, |
| 79 &EndOfStream, | 79 &EndOfStream, |
| 80 &NotifyError | 80 &NotifyError |
| 81 }; | 81 }; |
| 82 | 82 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() { | 98 PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() { |
| 99 } | 99 } |
| 100 | 100 |
| 101 // static | 101 // static |
| 102 const InterfaceProxy::Info* PPP_VideoDecoder_Proxy::GetInfo() { | 102 const InterfaceProxy::Info* PPP_VideoDecoder_Proxy::GetInfo() { |
| 103 static const Info info = { | 103 static const Info info = { |
| 104 &video_decoder_interface, | 104 &video_decoder_interface, |
| 105 PPP_VIDEODECODER_DEV_INTERFACE, | 105 PPP_VIDEODECODER_DEV_INTERFACE, |
| 106 INTERFACE_ID_PPP_VIDEO_DECODER_DEV, | 106 API_ID_PPP_VIDEO_DECODER_DEV, |
| 107 false, | 107 false, |
| 108 &CreateVideoDecoderPPPProxy, | 108 &CreateVideoDecoderPPPProxy, |
| 109 }; | 109 }; |
| 110 return &info; | 110 return &info; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { | 113 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 114 bool handled = true; | 114 bool handled = true; |
| 115 IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg) | 115 IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg) |
| 116 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers, | 116 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void PPP_VideoDecoder_Proxy::OnMsgNotifyError( | 165 void PPP_VideoDecoder_Proxy::OnMsgNotifyError( |
| 166 const HostResource& decoder, PP_VideoDecodeError_Dev error) { | 166 const HostResource& decoder, PP_VideoDecodeError_Dev error) { |
| 167 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | 167 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> |
| 168 PluginResourceForHostResource(decoder); | 168 PluginResourceForHostResource(decoder); |
| 169 ppp_video_decoder_impl_->NotifyError( | 169 ppp_video_decoder_impl_->NotifyError( |
| 170 decoder.instance(), plugin_decoder, error); | 170 decoder.instance(), plugin_decoder, error); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace proxy | 173 } // namespace proxy |
| 174 } // namespace ppapi | 174 } // namespace ppapi |
| OLD | NEW |