| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 API_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) { | |
| 57 HostResource decoder_resource; | |
| 58 decoder_resource.SetHostResource(instance, decoder); | |
| 59 | |
| 60 HostDispatcher::GetForInstance(instance)->Send( | |
| 61 new PpapiMsg_PPPVideoDecoder_NotifyEndOfStream( | |
| 62 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource)); | |
| 63 } | |
| 64 | |
| 65 void NotifyError(PP_Instance instance, PP_Resource decoder, | 56 void NotifyError(PP_Instance instance, PP_Resource decoder, |
| 66 PP_VideoDecodeError_Dev error) { | 57 PP_VideoDecodeError_Dev error) { |
| 67 HostResource decoder_resource; | 58 HostResource decoder_resource; |
| 68 decoder_resource.SetHostResource(instance, decoder); | 59 decoder_resource.SetHostResource(instance, decoder); |
| 69 | 60 |
| 70 HostDispatcher::GetForInstance(instance)->Send( | 61 HostDispatcher::GetForInstance(instance)->Send( |
| 71 new PpapiMsg_PPPVideoDecoder_NotifyError( | 62 new PpapiMsg_PPPVideoDecoder_NotifyError( |
| 72 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error)); | 63 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error)); |
| 73 } | 64 } |
| 74 | 65 |
| 75 static const PPP_VideoDecoder_Dev video_decoder_interface = { | 66 static const PPP_VideoDecoder_Dev video_decoder_interface = { |
| 76 &ProvidePictureBuffers, | 67 &ProvidePictureBuffers, |
| 77 &DismissPictureBuffer, | 68 &DismissPictureBuffer, |
| 78 &PictureReady, | 69 &PictureReady, |
| 79 &EndOfStream, | |
| 80 &NotifyError | 70 &NotifyError |
| 81 }; | 71 }; |
| 82 | 72 |
| 83 InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) { | 73 InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) { |
| 84 return new PPP_VideoDecoder_Proxy(dispatcher); | 74 return new PPP_VideoDecoder_Proxy(dispatcher); |
| 85 } | 75 } |
| 86 | 76 |
| 87 } // namespace | 77 } // namespace |
| 88 | 78 |
| 89 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher) | 79 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 112 | 102 |
| 113 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { | 103 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 114 bool handled = true; | 104 bool handled = true; |
| 115 IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg) | 105 IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg) |
| 116 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers, | 106 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers, |
| 117 OnMsgProvidePictureBuffers) | 107 OnMsgProvidePictureBuffers) |
| 118 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_DismissPictureBuffer, | 108 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_DismissPictureBuffer, |
| 119 OnMsgDismissPictureBuffer) | 109 OnMsgDismissPictureBuffer) |
| 120 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_PictureReady, | 110 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_PictureReady, |
| 121 OnMsgPictureReady) | 111 OnMsgPictureReady) |
| 122 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_NotifyEndOfStream, | |
| 123 OnMsgNotifyEndOfStream) | |
| 124 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_NotifyError, | 112 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_NotifyError, |
| 125 OnMsgNotifyError) | 113 OnMsgNotifyError) |
| 126 IPC_MESSAGE_UNHANDLED(handled = false) | 114 IPC_MESSAGE_UNHANDLED(handled = false) |
| 127 IPC_END_MESSAGE_MAP() | 115 IPC_END_MESSAGE_MAP() |
| 128 DCHECK(handled); | 116 DCHECK(handled); |
| 129 return handled; | 117 return handled; |
| 130 } | 118 } |
| 131 | 119 |
| 132 void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers( | 120 void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers( |
| 133 const HostResource& decoder, uint32_t req_num_of_bufs, | 121 const HostResource& decoder, uint32_t req_num_of_bufs, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 147 } | 135 } |
| 148 | 136 |
| 149 void PPP_VideoDecoder_Proxy::OnMsgPictureReady( | 137 void PPP_VideoDecoder_Proxy::OnMsgPictureReady( |
| 150 const HostResource& decoder, const PP_Picture_Dev& picture) { | 138 const HostResource& decoder, const PP_Picture_Dev& picture) { |
| 151 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | 139 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> |
| 152 PluginResourceForHostResource(decoder); | 140 PluginResourceForHostResource(decoder); |
| 153 ppp_video_decoder_impl_->PictureReady( | 141 ppp_video_decoder_impl_->PictureReady( |
| 154 decoder.instance(), plugin_decoder, &picture); | 142 decoder.instance(), plugin_decoder, &picture); |
| 155 } | 143 } |
| 156 | 144 |
| 157 void PPP_VideoDecoder_Proxy::OnMsgNotifyEndOfStream( | |
| 158 const HostResource& decoder) { | |
| 159 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | |
| 160 PluginResourceForHostResource(decoder); | |
| 161 ppp_video_decoder_impl_->EndOfStream(decoder.instance(), | |
| 162 plugin_decoder); | |
| 163 } | |
| 164 | |
| 165 void PPP_VideoDecoder_Proxy::OnMsgNotifyError( | 145 void PPP_VideoDecoder_Proxy::OnMsgNotifyError( |
| 166 const HostResource& decoder, PP_VideoDecodeError_Dev error) { | 146 const HostResource& decoder, PP_VideoDecodeError_Dev error) { |
| 167 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | 147 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> |
| 168 PluginResourceForHostResource(decoder); | 148 PluginResourceForHostResource(decoder); |
| 169 ppp_video_decoder_impl_->NotifyError( | 149 ppp_video_decoder_impl_->NotifyError( |
| 170 decoder.instance(), plugin_decoder, error); | 150 decoder.instance(), plugin_decoder, error); |
| 171 } | 151 } |
| 172 | 152 |
| 173 } // namespace proxy | 153 } // namespace proxy |
| 174 } // namespace ppapi | 154 } // namespace ppapi |
| OLD | NEW |