OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // From ppb_video_frame.idl modified Wed Jan 8 13:30:05 2014. |
| 6 |
| 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/ppb_video_frame.h" |
| 9 #include "ppapi/shared_impl/tracked_callback.h" |
| 10 #include "ppapi/thunk/enter.h" |
| 11 #include "ppapi/thunk/ppb_instance_api.h" |
| 12 #include "ppapi/thunk/ppb_video_frame_api.h" |
| 13 #include "ppapi/thunk/resource_creation_api.h" |
| 14 #include "ppapi/thunk/thunk.h" |
| 15 |
| 16 namespace ppapi { |
| 17 namespace thunk { |
| 18 |
| 19 namespace { |
| 20 |
| 21 PP_Bool IsVideoFrame(PP_Resource resource) { |
| 22 VLOG(4) << "PPB_VideoFrame::IsVideoFrame()"; |
| 23 EnterResource<PPB_VideoFrame_API> enter(resource, false); |
| 24 return PP_FromBool(enter.succeeded()); |
| 25 } |
| 26 |
| 27 PP_TimeDelta GetTimestamp(PP_Resource frame) { |
| 28 VLOG(4) << "PPB_VideoFrame::GetTimestamp()"; |
| 29 EnterResource<PPB_VideoFrame_API> enter(frame, true); |
| 30 if (enter.failed()) |
| 31 return 0.0; |
| 32 return enter.object()->GetTimestamp(); |
| 33 } |
| 34 |
| 35 void SetTimestamp(PP_Resource frame, PP_TimeDelta timestamp) { |
| 36 VLOG(4) << "PPB_VideoFrame::SetTimestamp()"; |
| 37 EnterResource<PPB_VideoFrame_API> enter(frame, true); |
| 38 if (enter.failed()) |
| 39 return; |
| 40 enter.object()->SetTimestamp(timestamp); |
| 41 } |
| 42 |
| 43 PP_VideoFrame_Format GetFormat(PP_Resource frame) { |
| 44 VLOG(4) << "PPB_VideoFrame::GetFormat()"; |
| 45 EnterResource<PPB_VideoFrame_API> enter(frame, true); |
| 46 if (enter.failed()) |
| 47 return PP_VIDEOFRAME_FORMAT_UNKNOWN; |
| 48 return enter.object()->GetFormat(); |
| 49 } |
| 50 |
| 51 PP_Bool GetSize(PP_Resource frame, struct PP_Size* size) { |
| 52 VLOG(4) << "PPB_VideoFrame::GetSize()"; |
| 53 EnterResource<PPB_VideoFrame_API> enter(frame, true); |
| 54 if (enter.failed()) |
| 55 return PP_FALSE; |
| 56 return enter.object()->GetSize(size); |
| 57 } |
| 58 |
| 59 void* GetDataBuffer(PP_Resource frame) { |
| 60 VLOG(4) << "PPB_VideoFrame::GetDataBuffer()"; |
| 61 EnterResource<PPB_VideoFrame_API> enter(frame, true); |
| 62 if (enter.failed()) |
| 63 return NULL; |
| 64 return enter.object()->GetDataBuffer(); |
| 65 } |
| 66 |
| 67 uint32_t GetDataBufferSize(PP_Resource frame) { |
| 68 VLOG(4) << "PPB_VideoFrame::GetDataBufferSize()"; |
| 69 EnterResource<PPB_VideoFrame_API> enter(frame, true); |
| 70 if (enter.failed()) |
| 71 return 0; |
| 72 return enter.object()->GetDataBufferSize(); |
| 73 } |
| 74 |
| 75 const PPB_VideoFrame_0_1 g_ppb_videoframe_thunk_0_1 = { |
| 76 &IsVideoFrame, |
| 77 &GetTimestamp, |
| 78 &SetTimestamp, |
| 79 &GetFormat, |
| 80 &GetSize, |
| 81 &GetDataBuffer, |
| 82 &GetDataBufferSize |
| 83 }; |
| 84 |
| 85 } // namespace |
| 86 |
| 87 const PPB_VideoFrame_0_1* GetPPB_VideoFrame_0_1_Thunk() { |
| 88 return &g_ppb_videoframe_thunk_0_1; |
| 89 } |
| 90 |
| 91 } // namespace thunk |
| 92 } // namespace ppapi |
OLD | NEW |