| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
| 6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/c/private/pp_video_frame_private.h" | 7 #include "ppapi/c/private/pp_video_frame_private.h" |
| 8 #include "ppapi/c/private/ppb_video_destination_private.h" | 8 #include "ppapi/c/private/ppb_video_destination_private.h" |
| 9 #include "ppapi/shared_impl/tracked_callback.h" | 9 #include "ppapi/shared_impl/tracked_callback.h" |
| 10 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 PP_Bool IsVideoDestination(PP_Resource resource) { | 28 PP_Bool IsVideoDestination(PP_Resource resource) { |
| 29 EnterResource<PPB_VideoDestination_Private_API> enter(resource, false); | 29 EnterResource<PPB_VideoDestination_Private_API> enter(resource, false); |
| 30 return PP_FromBool(enter.succeeded()); | 30 return PP_FromBool(enter.succeeded()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 int32_t Open(PP_Resource destination, | 33 int32_t Open(PP_Resource destination, |
| 34 PP_Var stream_url, | 34 PP_Var stream_url, |
| 35 PP_CompletionCallback callback) { | 35 PP_CompletionCallback callback) { |
| 36 EnterResource<PPB_VideoDestination_Private_API> enter(destination, | 36 EnterResource<PPB_VideoDestination_Private_API> enter( |
| 37 callback, true); | 37 destination, callback, true); |
| 38 if (enter.failed()) | 38 if (enter.failed()) |
| 39 return enter.retval(); | 39 return enter.retval(); |
| 40 return enter.SetResult(enter.object()->Open(stream_url, enter.callback())); | 40 return enter.SetResult(enter.object()->Open(stream_url, enter.callback())); |
| 41 } | 41 } |
| 42 | 42 |
| 43 int32_t PutFrame(PP_Resource destination, | 43 int32_t PutFrame(PP_Resource destination, const PP_VideoFrame_Private* frame) { |
| 44 const PP_VideoFrame_Private* frame) { | |
| 45 EnterResource<PPB_VideoDestination_Private_API> enter(destination, true); | 44 EnterResource<PPB_VideoDestination_Private_API> enter(destination, true); |
| 46 if (enter.failed()) | 45 if (enter.failed()) |
| 47 return enter.retval(); | 46 return enter.retval(); |
| 48 return enter.object()->PutFrame(*frame); | 47 return enter.object()->PutFrame(*frame); |
| 49 } | 48 } |
| 50 | 49 |
| 51 void Close(PP_Resource destination) { | 50 void Close(PP_Resource destination) { |
| 52 EnterResource<PPB_VideoDestination_Private_API> enter(destination, true); | 51 EnterResource<PPB_VideoDestination_Private_API> enter(destination, true); |
| 53 if (enter.succeeded()) | 52 if (enter.succeeded()) |
| 54 enter.object()->Close(); | 53 enter.object()->Close(); |
| 55 } | 54 } |
| 56 | 55 |
| 57 const PPB_VideoDestination_Private_0_1 | 56 const PPB_VideoDestination_Private_0_1 |
| 58 g_ppb_video_destination_private_thunk_0_1 = { | 57 g_ppb_video_destination_private_thunk_0_1 = {&Create, &IsVideoDestination, |
| 59 &Create, | 58 &Open, &PutFrame, &Close}; |
| 60 &IsVideoDestination, | |
| 61 &Open, | |
| 62 &PutFrame, | |
| 63 &Close | |
| 64 }; | |
| 65 | 59 |
| 66 } // namespace | 60 } // namespace |
| 67 | 61 |
| 68 const PPB_VideoDestination_Private_0_1* | 62 const PPB_VideoDestination_Private_0_1* |
| 69 GetPPB_VideoDestination_Private_0_1_Thunk() { | 63 GetPPB_VideoDestination_Private_0_1_Thunk() { |
| 70 return &g_ppb_video_destination_private_thunk_0_1; | 64 return &g_ppb_video_destination_private_thunk_0_1; |
| 71 } | 65 } |
| 72 | 66 |
| 73 } // namespace thunk | 67 } // namespace thunk |
| 74 } // namespace ppapi | 68 } // namespace ppapi |
| OLD | NEW |