| 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/cpp/dev/video_decoder_client_dev.h" | 5 #include "ppapi/cpp/dev/video_decoder_client_dev.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppp_video_decoder_dev.h" | 7 #include "ppapi/c/dev/ppp_video_decoder_dev.h" |
| 8 #include "ppapi/cpp/dev/video_decoder_dev.h" | 8 #include "ppapi/cpp/dev/video_decoder_dev.h" |
| 9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void PictureReady(PP_Instance instance, | 43 void PictureReady(PP_Instance instance, |
| 44 PP_Resource decoder, | 44 PP_Resource decoder, |
| 45 const PP_Picture_Dev* picture) { | 45 const PP_Picture_Dev* picture) { |
| 46 void* object = pp::Instance::GetPerInstanceObject( | 46 void* object = pp::Instance::GetPerInstanceObject( |
| 47 instance, kPPPVideoDecoderInterface); | 47 instance, kPPPVideoDecoderInterface); |
| 48 if (!object) | 48 if (!object) |
| 49 return; | 49 return; |
| 50 static_cast<VideoDecoderClient_Dev*>(object)->PictureReady(decoder, *picture); | 50 static_cast<VideoDecoderClient_Dev*>(object)->PictureReady(decoder, *picture); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void EndOfStream(PP_Instance instance, | |
| 54 PP_Resource decoder) { | |
| 55 void* object = pp::Instance::GetPerInstanceObject( | |
| 56 instance, kPPPVideoDecoderInterface); | |
| 57 if (!object) | |
| 58 return; | |
| 59 static_cast<VideoDecoderClient_Dev*>(object)->EndOfStream(decoder); | |
| 60 } | |
| 61 | |
| 62 void NotifyError(PP_Instance instance, | 53 void NotifyError(PP_Instance instance, |
| 63 PP_Resource decoder, | 54 PP_Resource decoder, |
| 64 PP_VideoDecodeError_Dev error) { | 55 PP_VideoDecodeError_Dev error) { |
| 65 void* object = pp::Instance::GetPerInstanceObject( | 56 void* object = pp::Instance::GetPerInstanceObject( |
| 66 instance, kPPPVideoDecoderInterface); | 57 instance, kPPPVideoDecoderInterface); |
| 67 if (!object) | 58 if (!object) |
| 68 return; | 59 return; |
| 69 static_cast<VideoDecoderClient_Dev*>(object)->NotifyError(decoder, error); | 60 static_cast<VideoDecoderClient_Dev*>(object)->NotifyError(decoder, error); |
| 70 } | 61 } |
| 71 | 62 |
| 72 static PPP_VideoDecoder_Dev videodecoder_interface = { | 63 static PPP_VideoDecoder_Dev videodecoder_interface = { |
| 73 &ProvidePictureBuffers, | 64 &ProvidePictureBuffers, |
| 74 &DismissPictureBuffer, | 65 &DismissPictureBuffer, |
| 75 &PictureReady, | 66 &PictureReady, |
| 76 &EndOfStream, | |
| 77 &NotifyError, | 67 &NotifyError, |
| 78 }; | 68 }; |
| 79 | 69 |
| 80 } // namespace | 70 } // namespace |
| 81 | 71 |
| 82 VideoDecoderClient_Dev::VideoDecoderClient_Dev(Instance* instance) | 72 VideoDecoderClient_Dev::VideoDecoderClient_Dev(Instance* instance) |
| 83 : associated_instance_(instance) { | 73 : associated_instance_(instance) { |
| 84 pp::Module::Get()->AddPluginInterface(kPPPVideoDecoderInterface, | 74 pp::Module::Get()->AddPluginInterface(kPPPVideoDecoderInterface, |
| 85 &videodecoder_interface); | 75 &videodecoder_interface); |
| 86 associated_instance_->AddPerInstanceObject( | 76 associated_instance_->AddPerInstanceObject( |
| 87 kPPPVideoDecoderInterface, this); | 77 kPPPVideoDecoderInterface, this); |
| 88 } | 78 } |
| 89 | 79 |
| 90 VideoDecoderClient_Dev::~VideoDecoderClient_Dev() { | 80 VideoDecoderClient_Dev::~VideoDecoderClient_Dev() { |
| 91 associated_instance_->RemovePerInstanceObject( | 81 associated_instance_->RemovePerInstanceObject( |
| 92 kPPPVideoDecoderInterface, this); | 82 kPPPVideoDecoderInterface, this); |
| 93 } | 83 } |
| 94 | 84 |
| 95 } // namespace pp | 85 } // namespace pp |
| OLD | NEW |