| 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 "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/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| 11 #include "ppapi/cpp/module.h" | 11 #include "ppapi/cpp/module.h" |
| 12 #include "ppapi/cpp/module_impl.h" | 12 #include "ppapi/cpp/module_impl.h" |
| 13 | 13 |
| 14 namespace pp { | 14 namespace pp { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 const char kPPPVideoDecoderInterface[] = PPP_VIDEODECODER_DEV_INTERFACE; | 18 const char kPPPVideoDecoderInterface[] = PPP_VIDEODECODER_DEV_INTERFACE; |
| 19 | 19 |
| 20 // Callback to provide buffers for the decoded output pictures. | 20 // Callback to provide buffers for the decoded output pictures. |
| 21 void ProvidePictureBuffers(PP_Instance instance, | 21 void ProvidePictureBuffers(PP_Instance instance, |
| 22 PP_Resource decoder, | 22 PP_Resource decoder, |
| 23 uint32_t req_num_of_bufs, | 23 uint32_t req_num_of_bufs, |
| 24 const PP_Size* dimensions) { | 24 const PP_Size* dimensions, |
| 25 PP_VideoDecoder_TextureTarget_Dev texture_target) { |
| 25 void* object = Instance::GetPerInstanceObject(instance, | 26 void* object = Instance::GetPerInstanceObject(instance, |
| 26 kPPPVideoDecoderInterface); | 27 kPPPVideoDecoderInterface); |
| 27 if (!object) | 28 if (!object) |
| 28 return; | 29 return; |
| 29 static_cast<VideoDecoderClient_Dev*>(object)->ProvidePictureBuffers( | 30 static_cast<VideoDecoderClient_Dev*>(object)->ProvidePictureBuffers( |
| 30 decoder, req_num_of_bufs, *dimensions); | 31 decoder, req_num_of_bufs, *dimensions, texture_target); |
| 31 } | 32 } |
| 32 | 33 |
| 33 void DismissPictureBuffer(PP_Instance instance, | 34 void DismissPictureBuffer(PP_Instance instance, |
| 34 PP_Resource decoder, | 35 PP_Resource decoder, |
| 35 int32_t picture_buffer_id) { | 36 int32_t picture_buffer_id) { |
| 36 void* object = Instance::GetPerInstanceObject(instance, | 37 void* object = Instance::GetPerInstanceObject(instance, |
| 37 kPPPVideoDecoderInterface); | 38 kPPPVideoDecoderInterface); |
| 38 if (!object) | 39 if (!object) |
| 39 return; | 40 return; |
| 40 static_cast<VideoDecoderClient_Dev*>(object)->DismissPictureBuffer( | 41 static_cast<VideoDecoderClient_Dev*>(object)->DismissPictureBuffer( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 &videodecoder_interface); | 77 &videodecoder_interface); |
| 77 instance->AddPerInstanceObject(kPPPVideoDecoderInterface, this); | 78 instance->AddPerInstanceObject(kPPPVideoDecoderInterface, this); |
| 78 } | 79 } |
| 79 | 80 |
| 80 VideoDecoderClient_Dev::~VideoDecoderClient_Dev() { | 81 VideoDecoderClient_Dev::~VideoDecoderClient_Dev() { |
| 81 Instance::RemovePerInstanceObject(associated_instance_, | 82 Instance::RemovePerInstanceObject(associated_instance_, |
| 82 kPPPVideoDecoderInterface, this); | 83 kPPPVideoDecoderInterface, this); |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace pp | 86 } // namespace pp |
| OLD | NEW |