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. | |
yzshen1
2014/01/08 17:56:11
Have you tried to auto-generate this file?
Peng
2014/01/08 18:51:26
Done.
| |
4 | |
5 #include "ppapi/c/pp_errors.h" | |
6 #include "ppapi/c/ppb_video_frame.h" | |
7 #include "ppapi/thunk/enter.h" | |
8 #include "ppapi/thunk/ppb_instance_api.h" | |
9 #include "ppapi/thunk/ppb_video_frame_api.h" | |
10 #include "ppapi/thunk/thunk.h" | |
11 | |
12 namespace ppapi { | |
13 namespace thunk { | |
14 | |
15 namespace { | |
16 | |
17 PP_Bool IsVideoFrame(PP_Resource resource) { | |
18 VLOG(4) << "PPB_VideoFrame::IsVideoFrame()"; | |
19 EnterResource<PPB_VideoFrame_API> enter(resource, false); | |
20 return PP_FromBool(enter.succeeded()); | |
21 } | |
22 | |
23 PP_TimeDelta GetTimestamp(PP_Resource frame) { | |
24 VLOG(4) << "PPB_VideoFrame::GetTimestamp()"; | |
25 EnterResource<PPB_VideoFrame_API> enter(frame, true); | |
26 if (enter.failed()) | |
27 return 0.0; | |
28 return enter.object()->GetTimestamp(); | |
29 } | |
30 | |
31 void SetTimestamp(PP_Resource frame, PP_TimeDelta timestamp) { | |
32 VLOG(4) << "PPB_VideoFrame::SetTimestamp()"; | |
33 EnterResource<PPB_VideoFrame_API> enter(frame, true); | |
34 if (enter.failed()) | |
35 return; | |
36 return enter.object()->SetTimestamp(timestamp); | |
37 } | |
38 | |
39 PP_VideoFrame_Format GetFormat(PP_Resource frame) { | |
40 VLOG(4) << "PPB_VideoFrame::GetFormat()"; | |
41 EnterResource<PPB_VideoFrame_API> enter(frame, true); | |
42 if (enter.failed()) | |
43 return PP_VIDEOFRAME_FORMAT_UNKNOWN; | |
44 return enter.object()->GetFormat(); | |
45 } | |
46 | |
47 PP_Bool GetSize(PP_Resource frame, struct PP_Size* size) { | |
48 VLOG(4) << "PPB_VideoFrame::GetSize()"; | |
49 EnterResource<PPB_VideoFrame_API> enter(frame, true); | |
50 if (enter.failed()) | |
51 return PP_FALSE; | |
52 return enter.object()->GetSize(size); | |
53 } | |
54 | |
55 void* GetDataBuffer(PP_Resource frame) { | |
56 VLOG(4) << "PPB_VideoFrame::GetDataBuffer()"; | |
57 EnterResource<PPB_VideoFrame_API> enter(frame, true); | |
58 if (enter.failed()) | |
59 return NULL; | |
60 return enter.object()->GetDataBuffer(); | |
61 } | |
62 | |
63 uint32_t GetDataBufferSize(PP_Resource frame) { | |
64 VLOG(4) << "PPB_VideoFrame::GetDataBufferSize()"; | |
65 EnterResource<PPB_VideoFrame_API> enter(frame, true); | |
66 if (enter.failed()) | |
67 return 0; | |
68 return enter.object()->GetDataBufferSize(); | |
69 } | |
70 | |
71 const PPB_VideoFrame_0_1 g_ppb_videoframe_thunk_0_1 = { | |
72 &IsVideoFrame, | |
73 &GetTimestamp, | |
74 &SetTimestamp, | |
75 &GetFormat, | |
76 &GetSize, | |
77 &GetDataBuffer, | |
78 &GetDataBufferSize, | |
79 }; | |
80 | |
81 } // namespace | |
82 | |
83 const PPB_VideoFrame_0_1* GetPPB_VideoFrame_0_1_Thunk() { | |
84 return &g_ppb_videoframe_thunk_0_1; | |
85 } | |
86 | |
87 } // namespace thunk | |
88 } // namespace ppapi | |
OLD | NEW |