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