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_resource_tracker.h" | 8 #include "ppapi/proxy/plugin_resource_tracker.h" |
9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
10 #include "ppapi/proxy/ppb_video_decoder_proxy.h" | 10 #include "ppapi/proxy/ppb_video_decoder_proxy.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 static const PPP_VideoDecoder_Dev video_decoder_interface = { | 73 static const PPP_VideoDecoder_Dev video_decoder_interface = { |
74 &ProvidePictureBuffers, | 74 &ProvidePictureBuffers, |
75 &DismissPictureBuffer, | 75 &DismissPictureBuffer, |
76 &PictureReady, | 76 &PictureReady, |
77 &EndOfStream, | 77 &EndOfStream, |
78 &NotifyError | 78 &NotifyError |
79 }; | 79 }; |
80 | 80 |
81 InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) { | 81 InterfaceProxy* CreateVideoDecoderPPPProxy( |
82 return new PPP_VideoDecoder_Proxy(dispatcher); | 82 Dispatcher* dispatcher, const void* target_interface) { |
| 83 return new PPP_VideoDecoder_Proxy(dispatcher, target_interface); |
83 } | 84 } |
84 | 85 |
85 } // namespace | 86 } // namespace |
86 | 87 |
87 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher) | 88 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy( |
88 : InterfaceProxy(dispatcher), | 89 Dispatcher* dispatcher, const void* target_interface) |
89 ppp_video_decoder_impl_(NULL) { | 90 : InterfaceProxy(dispatcher, target_interface) { |
90 if (dispatcher->IsPlugin()) { | |
91 ppp_video_decoder_impl_ = static_cast<const PPP_VideoDecoder_Dev*>( | |
92 dispatcher->local_get_interface()(PPP_VIDEODECODER_DEV_INTERFACE)); | |
93 } | |
94 } | 91 } |
95 | 92 |
96 PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() { | 93 PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() { |
97 } | 94 } |
98 | 95 |
99 // static | 96 // static |
100 const InterfaceProxy::Info* PPP_VideoDecoder_Proxy::GetInfo() { | 97 const InterfaceProxy::Info* PPP_VideoDecoder_Proxy::GetInfo() { |
101 static const Info info = { | 98 static const Info info = { |
102 &video_decoder_interface, | 99 &video_decoder_interface, |
103 PPP_VIDEODECODER_DEV_INTERFACE, | 100 PPP_VIDEODECODER_DEV_INTERFACE, |
(...skipping 21 matching lines...) Expand all Loading... |
125 IPC_END_MESSAGE_MAP() | 122 IPC_END_MESSAGE_MAP() |
126 DCHECK(handled); | 123 DCHECK(handled); |
127 return handled; | 124 return handled; |
128 } | 125 } |
129 | 126 |
130 void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers( | 127 void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers( |
131 const HostResource& decoder, uint32_t req_num_of_bufs, | 128 const HostResource& decoder, uint32_t req_num_of_bufs, |
132 const PP_Size& dimensions) { | 129 const PP_Size& dimensions) { |
133 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> | 130 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> |
134 PluginResourceForHostResource(decoder); | 131 PluginResourceForHostResource(decoder); |
135 ppp_video_decoder_impl_->ProvidePictureBuffers( | 132 ppp_video_decoder_target()->ProvidePictureBuffers( |
136 decoder.instance(), plugin_decoder, req_num_of_bufs, dimensions); | 133 decoder.instance(), plugin_decoder, req_num_of_bufs, dimensions); |
137 } | 134 } |
138 | 135 |
139 void PPP_VideoDecoder_Proxy::OnMsgDismissPictureBuffer( | 136 void PPP_VideoDecoder_Proxy::OnMsgDismissPictureBuffer( |
140 const HostResource& decoder, int32_t picture_id) { | 137 const HostResource& decoder, int32_t picture_id) { |
141 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> | 138 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> |
142 PluginResourceForHostResource(decoder); | 139 PluginResourceForHostResource(decoder); |
143 ppp_video_decoder_impl_->DismissPictureBuffer( | 140 ppp_video_decoder_target()->DismissPictureBuffer( |
144 decoder.instance(), plugin_decoder, picture_id); | 141 decoder.instance(), plugin_decoder, picture_id); |
145 } | 142 } |
146 | 143 |
147 void PPP_VideoDecoder_Proxy::OnMsgPictureReady( | 144 void PPP_VideoDecoder_Proxy::OnMsgPictureReady( |
148 const HostResource& decoder, const PP_Picture_Dev& picture) { | 145 const HostResource& decoder, const PP_Picture_Dev& picture) { |
149 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> | 146 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> |
150 PluginResourceForHostResource(decoder); | 147 PluginResourceForHostResource(decoder); |
151 ppp_video_decoder_impl_->PictureReady( | 148 ppp_video_decoder_target()->PictureReady( |
152 decoder.instance(), plugin_decoder, picture); | 149 decoder.instance(), plugin_decoder, picture); |
153 } | 150 } |
154 | 151 |
155 void PPP_VideoDecoder_Proxy::OnMsgNotifyEndOfStream( | 152 void PPP_VideoDecoder_Proxy::OnMsgNotifyEndOfStream( |
156 const HostResource& decoder) { | 153 const HostResource& decoder) { |
157 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> | 154 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> |
158 PluginResourceForHostResource(decoder); | 155 PluginResourceForHostResource(decoder); |
159 ppp_video_decoder_impl_->EndOfStream(decoder.instance(), | 156 ppp_video_decoder_target()->EndOfStream(decoder.instance(), |
160 plugin_decoder); | 157 plugin_decoder); |
161 } | 158 } |
162 | 159 |
163 void PPP_VideoDecoder_Proxy::OnMsgNotifyError( | 160 void PPP_VideoDecoder_Proxy::OnMsgNotifyError( |
164 const HostResource& decoder, PP_VideoDecodeError_Dev error) { | 161 const HostResource& decoder, PP_VideoDecodeError_Dev error) { |
165 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> | 162 PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()-> |
166 PluginResourceForHostResource(decoder); | 163 PluginResourceForHostResource(decoder); |
167 ppp_video_decoder_impl_->NotifyError( | 164 ppp_video_decoder_target()->NotifyError( |
168 decoder.instance(), plugin_decoder, error); | 165 decoder.instance(), plugin_decoder, error); |
169 } | 166 } |
170 | 167 |
171 } // namespace proxy | 168 } // namespace proxy |
172 } // namespace ppapi | 169 } // namespace ppapi |
OLD | NEW |