OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "ppapi/c/dev/ppb_console_dev.h" | |
15 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
| 15 #include "ppapi/c/ppb_console.h" |
16 #include "ppapi/c/ppb_opengles2.h" | 16 #include "ppapi/c/ppb_opengles2.h" |
17 #include "ppapi/cpp/dev/video_decoder_client_dev.h" | 17 #include "ppapi/cpp/dev/video_decoder_client_dev.h" |
18 #include "ppapi/cpp/dev/video_decoder_dev.h" | 18 #include "ppapi/cpp/dev/video_decoder_dev.h" |
19 #include "ppapi/cpp/graphics_3d.h" | 19 #include "ppapi/cpp/graphics_3d.h" |
20 #include "ppapi/cpp/graphics_3d_client.h" | 20 #include "ppapi/cpp/graphics_3d_client.h" |
21 #include "ppapi/cpp/instance.h" | 21 #include "ppapi/cpp/instance.h" |
22 #include "ppapi/cpp/module.h" | 22 #include "ppapi/cpp/module.h" |
23 #include "ppapi/cpp/rect.h" | 23 #include "ppapi/cpp/rect.h" |
24 #include "ppapi/cpp/var.h" | 24 #include "ppapi/cpp/var.h" |
25 #include "ppapi/examples/video_decode/testdata.h" | 25 #include "ppapi/examples/video_decode/testdata.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // When decode outpaces render, we queue up decoded pictures for later | 171 // When decode outpaces render, we queue up decoded pictures for later |
172 // painting. Elements are <decoder,picture>. | 172 // painting. Elements are <decoder,picture>. |
173 std::list<std::pair<PP_Resource, PP_Picture_Dev> > pictures_pending_paint_; | 173 std::list<std::pair<PP_Resource, PP_Picture_Dev> > pictures_pending_paint_; |
174 int num_frames_rendered_; | 174 int num_frames_rendered_; |
175 PP_TimeTicks first_frame_delivered_ticks_; | 175 PP_TimeTicks first_frame_delivered_ticks_; |
176 PP_TimeTicks last_swap_request_ticks_; | 176 PP_TimeTicks last_swap_request_ticks_; |
177 PP_TimeTicks swap_ticks_; | 177 PP_TimeTicks swap_ticks_; |
178 pp::CompletionCallbackFactory<VideoDecodeDemoInstance> callback_factory_; | 178 pp::CompletionCallbackFactory<VideoDecodeDemoInstance> callback_factory_; |
179 | 179 |
180 // Unowned pointers. | 180 // Unowned pointers. |
181 const PPB_Console_Dev* console_if_; | 181 const PPB_Console* console_if_; |
182 const PPB_Core* core_if_; | 182 const PPB_Core* core_if_; |
183 const PPB_OpenGLES2* gles2_if_; | 183 const PPB_OpenGLES2* gles2_if_; |
184 | 184 |
185 // Owned data. | 185 // Owned data. |
186 pp::Graphics3D* context_; | 186 pp::Graphics3D* context_; |
187 typedef std::map<int, DecoderClient*> Decoders; | 187 typedef std::map<int, DecoderClient*> Decoders; |
188 Decoders video_decoders_; | 188 Decoders video_decoders_; |
189 | 189 |
190 // Shader program to draw GL_TEXTURE_2D target. | 190 // Shader program to draw GL_TEXTURE_2D target. |
191 Shader shader_2d_; | 191 Shader shader_2d_; |
(...skipping 27 matching lines...) Expand all Loading... |
219 | 219 |
220 VideoDecodeDemoInstance::VideoDecodeDemoInstance(PP_Instance instance, | 220 VideoDecodeDemoInstance::VideoDecodeDemoInstance(PP_Instance instance, |
221 pp::Module* module) | 221 pp::Module* module) |
222 : pp::Instance(instance), pp::Graphics3DClient(this), | 222 : pp::Instance(instance), pp::Graphics3DClient(this), |
223 pp::VideoDecoderClient_Dev(this), | 223 pp::VideoDecoderClient_Dev(this), |
224 num_frames_rendered_(0), | 224 num_frames_rendered_(0), |
225 first_frame_delivered_ticks_(-1), | 225 first_frame_delivered_ticks_(-1), |
226 swap_ticks_(0), | 226 swap_ticks_(0), |
227 callback_factory_(this), | 227 callback_factory_(this), |
228 context_(NULL) { | 228 context_(NULL) { |
229 assert((console_if_ = static_cast<const PPB_Console_Dev*>( | 229 assert((console_if_ = static_cast<const PPB_Console*>( |
230 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)))); | 230 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)))); |
231 assert((core_if_ = static_cast<const PPB_Core*>( | 231 assert((core_if_ = static_cast<const PPB_Core*>( |
232 module->GetBrowserInterface(PPB_CORE_INTERFACE)))); | 232 module->GetBrowserInterface(PPB_CORE_INTERFACE)))); |
233 assert((gles2_if_ = static_cast<const PPB_OpenGLES2*>( | 233 assert((gles2_if_ = static_cast<const PPB_OpenGLES2*>( |
234 module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)))); | 234 module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)))); |
235 } | 235 } |
236 | 236 |
237 VideoDecodeDemoInstance::~VideoDecodeDemoInstance() { | 237 VideoDecodeDemoInstance::~VideoDecodeDemoInstance() { |
238 if (shader_2d_.program) | 238 if (shader_2d_.program) |
239 gles2_if_->DeleteProgram(context_->pp_resource(), shader_2d_.program); | 239 gles2_if_->DeleteProgram(context_->pp_resource(), shader_2d_.program); |
240 if (shader_rectangle_arb_.program) { | 240 if (shader_rectangle_arb_.program) { |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 gles2_if_->DeleteShader(context_->pp_resource(), shader); | 675 gles2_if_->DeleteShader(context_->pp_resource(), shader); |
676 } | 676 } |
677 } // anonymous namespace | 677 } // anonymous namespace |
678 | 678 |
679 namespace pp { | 679 namespace pp { |
680 // Factory function for your specialization of the Module object. | 680 // Factory function for your specialization of the Module object. |
681 Module* CreateModule() { | 681 Module* CreateModule() { |
682 return new VideoDecodeDemoModule(); | 682 return new VideoDecodeDemoModule(); |
683 } | 683 } |
684 } // namespace pp | 684 } // namespace pp |
OLD | NEW |