| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_dev.h" | 5 #include "ppapi/cpp/dev/video_decoder_dev.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/cpp/common.h" |
| 8 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
| 9 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| 10 #include "ppapi/cpp/module_impl.h" | 11 #include "ppapi/cpp/module_impl.h" |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 DeviceFuncs<PPB_VideoDecoder_Dev> video_decoder_f( | 15 DeviceFuncs<PPB_VideoDecoder_Dev> video_decoder_f( |
| 15 PPB_VIDEODECODER_DEV_INTERFACE); | 16 PPB_VIDEODECODER_DEV_INTERFACE); |
| 16 | 17 |
| 17 } // namespace | 18 } // namespace |
| (...skipping 28 matching lines...) Expand all Loading... |
| 46 } | 47 } |
| 47 | 48 |
| 48 // static | 49 // static |
| 49 bool VideoDecoder_Dev::GetConfig(const Instance& instance, | 50 bool VideoDecoder_Dev::GetConfig(const Instance& instance, |
| 50 PP_VideoCodecId_Dev codec, | 51 PP_VideoCodecId_Dev codec, |
| 51 PP_VideoConfig_Dev* configs, | 52 PP_VideoConfig_Dev* configs, |
| 52 int32_t config_size, | 53 int32_t config_size, |
| 53 int32_t* num_config) { | 54 int32_t* num_config) { |
| 54 if (!video_decoder_f) | 55 if (!video_decoder_f) |
| 55 return false; | 56 return false; |
| 56 return video_decoder_f->GetConfig(instance.pp_instance(), | 57 return PPBoolToBool(video_decoder_f->GetConfig(instance.pp_instance(), |
| 57 codec, | 58 codec, |
| 58 configs, | 59 configs, |
| 59 config_size, | 60 config_size, |
| 60 num_config); | 61 num_config)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 bool VideoDecoder_Dev::Decode(PP_VideoCompressedDataBuffer_Dev& input_buffer) { | 64 bool VideoDecoder_Dev::Decode(PP_VideoCompressedDataBuffer_Dev& input_buffer) { |
| 64 if (!video_decoder_f || !pp_resource()) | 65 if (!video_decoder_f || !pp_resource()) |
| 65 return false; | 66 return false; |
| 66 return video_decoder_f->Decode(pp_resource(), | 67 return PPBoolToBool(video_decoder_f->Decode(pp_resource(), &input_buffer)); |
| 67 &input_buffer); | |
| 68 } | 68 } |
| 69 | 69 |
| 70 int32_t VideoDecoder_Dev::Flush(PP_CompletionCallback callback) { | 70 int32_t VideoDecoder_Dev::Flush(PP_CompletionCallback callback) { |
| 71 if (!video_decoder_f) | 71 if (!video_decoder_f) |
| 72 return PP_ERROR_NOINTERFACE; | 72 return PP_ERROR_NOINTERFACE; |
| 73 return video_decoder_f->Flush(pp_resource(), callback); | 73 return video_decoder_f->Flush(pp_resource(), callback); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool VideoDecoder_Dev::ReturnUncompressedDataBuffer( | 76 bool VideoDecoder_Dev::ReturnUncompressedDataBuffer( |
| 77 PP_VideoUncompressedDataBuffer_Dev& buffer) { | 77 PP_VideoUncompressedDataBuffer_Dev& buffer) { |
| 78 if (!video_decoder_f || !pp_resource()) | 78 if (!video_decoder_f || !pp_resource()) |
| 79 return false; | 79 return false; |
| 80 return video_decoder_f->ReturnUncompressedDataBuffer(pp_resource(), | 80 return PPBoolToBool( |
| 81 &buffer); | 81 video_decoder_f->ReturnUncompressedDataBuffer(pp_resource(), |
| 82 &buffer)); |
| 82 } | 83 } |
| 83 | 84 |
| 84 } // namespace pp | 85 } // namespace pp |
| OLD | NEW |