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/thunk/enter.h" | 6 #include "ppapi/thunk/enter.h" |
7 #include "ppapi/thunk/thunk.h" | 7 #include "ppapi/thunk/thunk.h" |
8 #include "ppapi/thunk/ppb_video_decoder_api.h" | 8 #include "ppapi/thunk/ppb_video_decoder_api.h" |
9 #include "ppapi/thunk/resource_creation_api.h" | 9 #include "ppapi/thunk/resource_creation_api.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 EnterVideoDecoder enter(resource, false); | 28 EnterVideoDecoder enter(resource, false); |
29 return PP_FromBool(enter.succeeded()); | 29 return PP_FromBool(enter.succeeded()); |
30 } | 30 } |
31 | 31 |
32 int32_t Decode(PP_Resource video_decoder, | 32 int32_t Decode(PP_Resource video_decoder, |
33 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | 33 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
34 PP_CompletionCallback callback) { | 34 PP_CompletionCallback callback) { |
35 EnterVideoDecoder enter(video_decoder, callback, true); | 35 EnterVideoDecoder enter(video_decoder, callback, true); |
36 if (enter.failed()) | 36 if (enter.failed()) |
37 return enter.retval(); | 37 return enter.retval(); |
38 return enter.SetResult(enter.object()->Decode(bitstream_buffer, callback)); | 38 return enter.SetResult(enter.object()->Decode(bitstream_buffer, |
| 39 enter.callback())); |
39 } | 40 } |
40 | 41 |
41 void AssignPictureBuffers(PP_Resource video_decoder, | 42 void AssignPictureBuffers(PP_Resource video_decoder, |
42 uint32_t no_of_buffers, | 43 uint32_t no_of_buffers, |
43 const PP_PictureBuffer_Dev* buffers) { | 44 const PP_PictureBuffer_Dev* buffers) { |
44 EnterVideoDecoder enter(video_decoder, true); | 45 EnterVideoDecoder enter(video_decoder, true); |
45 if (enter.succeeded()) | 46 if (enter.succeeded()) |
46 enter.object()->AssignPictureBuffers(no_of_buffers, buffers); | 47 enter.object()->AssignPictureBuffers(no_of_buffers, buffers); |
47 } | 48 } |
48 | 49 |
49 void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) { | 50 void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) { |
50 EnterVideoDecoder enter(video_decoder, true); | 51 EnterVideoDecoder enter(video_decoder, true); |
51 if (enter.succeeded()) | 52 if (enter.succeeded()) |
52 enter.object()->ReusePictureBuffer(picture_buffer_id); | 53 enter.object()->ReusePictureBuffer(picture_buffer_id); |
53 } | 54 } |
54 | 55 |
55 int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) { | 56 int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) { |
56 EnterVideoDecoder enter(video_decoder, callback, true); | 57 EnterVideoDecoder enter(video_decoder, callback, true); |
57 if (enter.failed()) | 58 if (enter.failed()) |
58 return enter.retval(); | 59 return enter.retval(); |
59 return enter.SetResult(enter.object()->Flush(callback)); | 60 return enter.SetResult(enter.object()->Flush(enter.callback())); |
60 } | 61 } |
61 | 62 |
62 int32_t Reset(PP_Resource video_decoder, | 63 int32_t Reset(PP_Resource video_decoder, |
63 PP_CompletionCallback callback) { | 64 PP_CompletionCallback callback) { |
64 EnterVideoDecoder enter(video_decoder, callback, true); | 65 EnterVideoDecoder enter(video_decoder, callback, true); |
65 if (enter.failed()) | 66 if (enter.failed()) |
66 return enter.retval(); | 67 return enter.retval(); |
67 return enter.SetResult(enter.object()->Reset(callback)); | 68 return enter.SetResult(enter.object()->Reset(enter.callback())); |
68 } | 69 } |
69 | 70 |
70 void Destroy(PP_Resource video_decoder) { | 71 void Destroy(PP_Resource video_decoder) { |
71 EnterVideoDecoder enter(video_decoder, true); | 72 EnterVideoDecoder enter(video_decoder, true); |
72 if (enter.succeeded()) | 73 if (enter.succeeded()) |
73 enter.object()->Destroy(); | 74 enter.object()->Destroy(); |
74 } | 75 } |
75 | 76 |
76 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = { | 77 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = { |
77 &Create, | 78 &Create, |
78 &IsVideoDecoder, | 79 &IsVideoDecoder, |
79 &Decode, | 80 &Decode, |
80 &AssignPictureBuffers, | 81 &AssignPictureBuffers, |
81 &ReusePictureBuffer, | 82 &ReusePictureBuffer, |
82 &Flush, | 83 &Flush, |
83 &Reset, | 84 &Reset, |
84 &Destroy | 85 &Destroy |
85 }; | 86 }; |
86 | 87 |
87 } // namespace | 88 } // namespace |
88 | 89 |
89 const PPB_VideoDecoder_Dev_0_16* GetPPB_VideoDecoder_Dev_0_16_Thunk() { | 90 const PPB_VideoDecoder_Dev_0_16* GetPPB_VideoDecoder_Dev_0_16_Thunk() { |
90 return &g_ppb_videodecoder_thunk; | 91 return &g_ppb_videodecoder_thunk; |
91 } | 92 } |
92 | 93 |
93 } // namespace thunk | 94 } // namespace thunk |
94 } // namespace ppapi | 95 } // namespace ppapi |
OLD | NEW |