| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/video_encoder.h" | 5 #include "ppapi/cpp/video_encoder.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/ppb_video_encoder.h" | 8 #include "ppapi/c/ppb_video_encoder.h" |
| 9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
| 10 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 int32_t VideoEncoder::GetSupportedProfiles(const CompletionCallbackWithOutput< | 38 int32_t VideoEncoder::GetSupportedProfiles(const CompletionCallbackWithOutput< |
| 39 std::vector<PP_VideoProfileDescription> >& cc) { | 39 std::vector<PP_VideoProfileDescription> >& cc) { |
| 40 if (has_interface<PPB_VideoEncoder_0_1>()) { | 40 if (has_interface<PPB_VideoEncoder_0_1>()) { |
| 41 return get_interface<PPB_VideoEncoder_0_1>()->GetSupportedProfiles( | 41 return get_interface<PPB_VideoEncoder_0_1>()->GetSupportedProfiles( |
| 42 pp_resource(), cc.output(), cc.pp_completion_callback()); | 42 pp_resource(), cc.output(), cc.pp_completion_callback()); |
| 43 } | 43 } |
| 44 return cc.MayForce(PP_ERROR_NOINTERFACE); | 44 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 45 } | 45 } |
| 46 | 46 |
| 47 int32_t VideoEncoder::Initialize(const PP_VideoFrame_Format& input_format, | 47 int32_t VideoEncoder::Initialize(const PP_VideoFrame_Format& input_format, |
| 48 const PP_Size& input_visible_size, | 48 const Size& input_visible_size, |
| 49 const PP_VideoProfile& output_profile, | 49 const PP_VideoProfile& output_profile, |
| 50 const uint32_t initial_bitrate, | 50 const uint32_t initial_bitrate, |
| 51 PP_HardwareAcceleration acceleration, | 51 PP_HardwareAcceleration acceleration, |
| 52 const CompletionCallback& cc) { | 52 const CompletionCallback& cc) { |
| 53 if (has_interface<PPB_VideoEncoder_0_1>()) { | 53 if (has_interface<PPB_VideoEncoder_0_1>()) { |
| 54 return get_interface<PPB_VideoEncoder_0_1>()->Initialize( | 54 return get_interface<PPB_VideoEncoder_0_1>()->Initialize( |
| 55 pp_resource(), input_format, &input_visible_size, output_profile, | 55 pp_resource(), input_format, &input_visible_size.pp_size(), |
| 56 initial_bitrate, acceleration, cc.pp_completion_callback()); | 56 output_profile, initial_bitrate, acceleration, |
| 57 cc.pp_completion_callback()); |
| 57 } | 58 } |
| 58 return cc.MayForce(PP_ERROR_NOINTERFACE); | 59 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 59 } | 60 } |
| 60 | 61 |
| 61 int32_t VideoEncoder::GetFramesRequired() { | 62 int32_t VideoEncoder::GetFramesRequired() { |
| 62 if (has_interface<PPB_VideoEncoder_0_1>()) { | 63 if (has_interface<PPB_VideoEncoder_0_1>()) { |
| 63 return get_interface<PPB_VideoEncoder_0_1>()->GetFramesRequired( | 64 return get_interface<PPB_VideoEncoder_0_1>()->GetFramesRequired( |
| 64 pp_resource()); | 65 pp_resource()); |
| 65 } | 66 } |
| 66 return PP_ERROR_NOINTERFACE; | 67 return PP_ERROR_NOINTERFACE; |
| 67 } | 68 } |
| 68 | 69 |
| 69 int32_t VideoEncoder::GetFrameCodedSize(PP_Size* coded_size) { | 70 int32_t VideoEncoder::GetFrameCodedSize(Size* coded_size) { |
| 70 if (has_interface<PPB_VideoEncoder_0_1>()) { | 71 if (has_interface<PPB_VideoEncoder_0_1>()) { |
| 71 return get_interface<PPB_VideoEncoder_0_1>()->GetFrameCodedSize( | 72 return get_interface<PPB_VideoEncoder_0_1>()->GetFrameCodedSize( |
| 72 pp_resource(), coded_size); | 73 pp_resource(), &coded_size->pp_size()); |
| 73 } | 74 } |
| 74 return PP_ERROR_NOINTERFACE; | 75 return PP_ERROR_NOINTERFACE; |
| 75 } | 76 } |
| 76 | 77 |
| 77 int32_t VideoEncoder::GetVideoFrame( | 78 int32_t VideoEncoder::GetVideoFrame( |
| 78 const CompletionCallbackWithOutput<VideoFrame>& cc) { | 79 const CompletionCallbackWithOutput<VideoFrame>& cc) { |
| 79 if (has_interface<PPB_VideoEncoder_0_1>()) { | 80 if (has_interface<PPB_VideoEncoder_0_1>()) { |
| 80 return get_interface<PPB_VideoEncoder_0_1>()->GetVideoFrame( | 81 return get_interface<PPB_VideoEncoder_0_1>()->GetVideoFrame( |
| 81 pp_resource(), cc.output(), cc.pp_completion_callback()); | 82 pp_resource(), cc.output(), cc.pp_completion_callback()); |
| 82 } | 83 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 120 } |
| 120 } | 121 } |
| 121 | 122 |
| 122 void VideoEncoder::Close() { | 123 void VideoEncoder::Close() { |
| 123 if (has_interface<PPB_VideoEncoder_0_1>()) { | 124 if (has_interface<PPB_VideoEncoder_0_1>()) { |
| 124 get_interface<PPB_VideoEncoder_0_1>()->Close(pp_resource()); | 125 get_interface<PPB_VideoEncoder_0_1>()->Close(pp_resource()); |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace pp | 129 } // namespace pp |
| OLD | NEW |