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> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 assert(!"Unexpectedly lost graphics context"); | 59 assert(!"Unexpectedly lost graphics context"); |
60 } | 60 } |
61 | 61 |
62 // pp::VideoDecoderClient_Dev implementation. | 62 // pp::VideoDecoderClient_Dev implementation. |
63 virtual void ProvidePictureBuffers(PP_Resource decoder, | 63 virtual void ProvidePictureBuffers(PP_Resource decoder, |
64 uint32_t req_num_of_bufs, | 64 uint32_t req_num_of_bufs, |
65 const PP_Size& dimensions); | 65 const PP_Size& dimensions); |
66 virtual void DismissPictureBuffer(PP_Resource decoder, | 66 virtual void DismissPictureBuffer(PP_Resource decoder, |
67 int32_t picture_buffer_id); | 67 int32_t picture_buffer_id); |
68 virtual void PictureReady(PP_Resource decoder, const PP_Picture_Dev& picture); | 68 virtual void PictureReady(PP_Resource decoder, const PP_Picture_Dev& picture); |
69 virtual void EndOfStream(PP_Resource decoder); | |
70 virtual void NotifyError(PP_Resource decoder, PP_VideoDecodeError_Dev error); | 69 virtual void NotifyError(PP_Resource decoder, PP_VideoDecodeError_Dev error); |
71 | 70 |
72 private: | 71 private: |
73 enum { kNumConcurrentDecodes = 7, | 72 enum { kNumConcurrentDecodes = 7, |
74 kNumDecoders = 2 }; // Baked into viewport rendering. | 73 kNumDecoders = 2 }; // Baked into viewport rendering. |
75 | 74 |
76 // A single decoder's client interface. | 75 // A single decoder's client interface. |
77 class DecoderClient { | 76 class DecoderClient { |
78 public: | 77 public: |
79 DecoderClient(GLES2DemoInstance* gles2, pp::VideoDecoder_Dev* decoder); | 78 DecoderClient(GLES2DemoInstance* gles2, pp::VideoDecoder_Dev* decoder); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 gles2_if_->BindTexture( | 390 gles2_if_->BindTexture( |
392 context_->pp_resource(), GL_TEXTURE_2D, buffer.texture_id); | 391 context_->pp_resource(), GL_TEXTURE_2D, buffer.texture_id); |
393 gles2_if_->DrawArrays(context_->pp_resource(), GL_TRIANGLE_STRIP, 0, 4); | 392 gles2_if_->DrawArrays(context_->pp_resource(), GL_TRIANGLE_STRIP, 0, 4); |
394 pp::CompletionCallback cb = | 393 pp::CompletionCallback cb = |
395 callback_factory_.NewCallback( | 394 callback_factory_.NewCallback( |
396 &GLES2DemoInstance::PaintFinished, decoder, buffer.id); | 395 &GLES2DemoInstance::PaintFinished, decoder, buffer.id); |
397 last_swap_request_ticks_ = core_if_->GetTimeTicks(); | 396 last_swap_request_ticks_ = core_if_->GetTimeTicks(); |
398 assert(context_->SwapBuffers(cb) == PP_OK_COMPLETIONPENDING); | 397 assert(context_->SwapBuffers(cb) == PP_OK_COMPLETIONPENDING); |
399 } | 398 } |
400 | 399 |
401 void GLES2DemoInstance::EndOfStream(PP_Resource decoder) { | |
402 } | |
403 | |
404 void GLES2DemoInstance::NotifyError(PP_Resource decoder, | 400 void GLES2DemoInstance::NotifyError(PP_Resource decoder, |
405 PP_VideoDecodeError_Dev error) { | 401 PP_VideoDecodeError_Dev error) { |
406 LogError(this).s() << "Received error: " << error; | 402 LogError(this).s() << "Received error: " << error; |
407 assert(!"Unexpected error; see stderr for details"); | 403 assert(!"Unexpected error; see stderr for details"); |
408 } | 404 } |
409 | 405 |
410 // This object is the global object representing this plugin library as long | 406 // This object is the global object representing this plugin library as long |
411 // as it is loaded. | 407 // as it is loaded. |
412 class GLES2DemoModule : public pp::Module { | 408 class GLES2DemoModule : public pp::Module { |
413 public: | 409 public: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 gles2_if_->DeleteShader(context_->pp_resource(), shader); | 574 gles2_if_->DeleteShader(context_->pp_resource(), shader); |
579 } | 575 } |
580 } // anonymous namespace | 576 } // anonymous namespace |
581 | 577 |
582 namespace pp { | 578 namespace pp { |
583 // Factory function for your specialization of the Module object. | 579 // Factory function for your specialization of the Module object. |
584 Module* CreateModule() { | 580 Module* CreateModule() { |
585 return new GLES2DemoModule(); | 581 return new GLES2DemoModule(); |
586 } | 582 } |
587 } // namespace pp | 583 } // namespace pp |
OLD | NEW |