| 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/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 6 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| 7 #include "ppapi/shared_impl/tracked_callback.h" | 7 #include "ppapi/shared_impl/tracked_callback.h" |
| 8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_device_ref_api.h" | 9 #include "ppapi/thunk/ppb_device_ref_api.h" |
| 10 #include "ppapi/thunk/ppb_video_capture_api.h" | 10 #include "ppapi/thunk/ppb_video_capture_api.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return PP_FromBool(enter.succeeded()); | 30 return PP_FromBool(enter.succeeded()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 int32_t EnumerateDevices(PP_Resource video_capture, | 33 int32_t EnumerateDevices(PP_Resource video_capture, |
| 34 PP_ArrayOutput output, | 34 PP_ArrayOutput output, |
| 35 PP_CompletionCallback callback) { | 35 PP_CompletionCallback callback) { |
| 36 EnterVideoCapture enter(video_capture, callback, true); | 36 EnterVideoCapture enter(video_capture, callback, true); |
| 37 if (enter.failed()) | 37 if (enter.failed()) |
| 38 return enter.retval(); | 38 return enter.retval(); |
| 39 | 39 |
| 40 return enter.SetResult(enter.object()->EnumerateDevices(output, | 40 return enter.SetResult( |
| 41 enter.callback())); | 41 enter.object()->EnumerateDevices(output, enter.callback())); |
| 42 } | 42 } |
| 43 | 43 |
| 44 int32_t MonitorDeviceChange(PP_Resource video_capture, | 44 int32_t MonitorDeviceChange(PP_Resource video_capture, |
| 45 PP_MonitorDeviceChangeCallback callback, | 45 PP_MonitorDeviceChangeCallback callback, |
| 46 void* user_data) { | 46 void* user_data) { |
| 47 EnterVideoCapture enter(video_capture, true); | 47 EnterVideoCapture enter(video_capture, true); |
| 48 if (enter.failed()) | 48 if (enter.failed()) |
| 49 return enter.retval(); | 49 return enter.retval(); |
| 50 return enter.object()->MonitorDeviceChange(callback, user_data); | 50 return enter.object()->MonitorDeviceChange(callback, user_data); |
| 51 } | 51 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 73 device_id, *requested_info, buffer_count, enter.callback())); | 73 device_id, *requested_info, buffer_count, enter.callback())); |
| 74 } | 74 } |
| 75 | 75 |
| 76 int32_t StartCapture(PP_Resource video_capture) { | 76 int32_t StartCapture(PP_Resource video_capture) { |
| 77 EnterVideoCapture enter(video_capture, true); | 77 EnterVideoCapture enter(video_capture, true); |
| 78 if (enter.failed()) | 78 if (enter.failed()) |
| 79 return enter.retval(); | 79 return enter.retval(); |
| 80 return enter.object()->StartCapture(); | 80 return enter.object()->StartCapture(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 int32_t ReuseBuffer(PP_Resource video_capture, | 83 int32_t ReuseBuffer(PP_Resource video_capture, uint32_t buffer) { |
| 84 uint32_t buffer) { | |
| 85 EnterVideoCapture enter(video_capture, true); | 84 EnterVideoCapture enter(video_capture, true); |
| 86 if (enter.failed()) | 85 if (enter.failed()) |
| 87 return enter.retval(); | 86 return enter.retval(); |
| 88 return enter.object()->ReuseBuffer(buffer); | 87 return enter.object()->ReuseBuffer(buffer); |
| 89 } | 88 } |
| 90 | 89 |
| 91 int32_t StopCapture(PP_Resource video_capture) { | 90 int32_t StopCapture(PP_Resource video_capture) { |
| 92 EnterVideoCapture enter(video_capture, true); | 91 EnterVideoCapture enter(video_capture, true); |
| 93 if (enter.failed()) | 92 if (enter.failed()) |
| 94 return enter.retval(); | 93 return enter.retval(); |
| 95 return enter.object()->StopCapture(); | 94 return enter.object()->StopCapture(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void Close(PP_Resource video_capture) { | 97 void Close(PP_Resource video_capture) { |
| 99 EnterVideoCapture enter(video_capture, true); | 98 EnterVideoCapture enter(video_capture, true); |
| 100 if (enter.succeeded()) | 99 if (enter.succeeded()) |
| 101 enter.object()->Close(); | 100 enter.object()->Close(); |
| 102 } | 101 } |
| 103 | 102 |
| 104 const PPB_VideoCapture_Dev_0_3 g_ppb_video_capture_0_3_thunk = { | 103 const PPB_VideoCapture_Dev_0_3 g_ppb_video_capture_0_3_thunk = { |
| 105 &Create, | 104 &Create, &IsVideoCapture, &EnumerateDevices, |
| 106 &IsVideoCapture, | 105 &MonitorDeviceChange, &Open, &StartCapture, |
| 107 &EnumerateDevices, | 106 &ReuseBuffer, &StopCapture, &Close}; |
| 108 &MonitorDeviceChange, | |
| 109 &Open, | |
| 110 &StartCapture, | |
| 111 &ReuseBuffer, | |
| 112 &StopCapture, | |
| 113 &Close | |
| 114 }; | |
| 115 | 107 |
| 116 } // namespace | 108 } // namespace |
| 117 | 109 |
| 118 const PPB_VideoCapture_Dev_0_3* GetPPB_VideoCapture_Dev_0_3_Thunk() { | 110 const PPB_VideoCapture_Dev_0_3* GetPPB_VideoCapture_Dev_0_3_Thunk() { |
| 119 return &g_ppb_video_capture_0_3_thunk; | 111 return &g_ppb_video_capture_0_3_thunk; |
| 120 } | 112 } |
| 121 | 113 |
| 122 } // namespace thunk | 114 } // namespace thunk |
| 123 } // namespace ppapi | 115 } // namespace ppapi |
| OLD | NEW |