| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common.h" | 6 #include "ppapi/thunk/common.h" |
| 7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
| 8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
| 9 #include "ppapi/thunk/ppb_video_decoder_api.h" | 9 #include "ppapi/thunk/ppb_video_decoder_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 return enter.functions()->CreateVideoDecoder(instance); | 23 return enter.functions()->CreateVideoDecoder(instance); |
| 24 } | 24 } |
| 25 | 25 |
| 26 PP_Bool IsVideoDecoder(PP_Resource resource) { | 26 PP_Bool IsVideoDecoder(PP_Resource resource) { |
| 27 EnterVideoDecoder enter(resource, false); | 27 EnterVideoDecoder enter(resource, false); |
| 28 return PP_FromBool(enter.succeeded()); | 28 return PP_FromBool(enter.succeeded()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 int32_t Initialize(PP_Resource video_decoder, | 31 int32_t Initialize(PP_Resource video_decoder, |
| 32 PP_Resource context_id, | 32 PP_Resource context_id, |
| 33 const PP_VideoConfigElement* decoder_config, | 33 const PP_VideoConfigElement* decoder_config) { |
| 34 PP_CompletionCallback callback) { | |
| 35 EnterVideoDecoder enter(video_decoder, true); | 34 EnterVideoDecoder enter(video_decoder, true); |
| 36 if (enter.failed()) | 35 if (enter.failed()) |
| 37 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 36 return PP_ERROR_BADRESOURCE; |
| 38 int32_t result = | 37 return enter.object()->Initialize(context_id, decoder_config); |
| 39 enter.object()->Initialize(context_id, decoder_config, callback); | |
| 40 return MayForceCallback(callback, result); | |
| 41 } | 38 } |
| 42 | 39 |
| 43 int32_t Decode(PP_Resource video_decoder, | 40 int32_t Decode(PP_Resource video_decoder, |
| 44 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | 41 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
| 45 PP_CompletionCallback callback) { | 42 PP_CompletionCallback callback) { |
| 46 EnterVideoDecoder enter(video_decoder, true); | 43 EnterVideoDecoder enter(video_decoder, true); |
| 47 if (enter.failed()) | 44 if (enter.failed()) |
| 48 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 45 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
| 49 int32_t result = enter.object()->Decode(bitstream_buffer, callback); | 46 int32_t result = enter.object()->Decode(bitstream_buffer, callback); |
| 50 return MayForceCallback(callback, result); | 47 return MayForceCallback(callback, result); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 }; | 97 }; |
| 101 | 98 |
| 102 } // namespace | 99 } // namespace |
| 103 | 100 |
| 104 const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Thunk() { | 101 const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Thunk() { |
| 105 return &g_ppb_videodecoder_thunk; | 102 return &g_ppb_videodecoder_thunk; |
| 106 } | 103 } |
| 107 | 104 |
| 108 } // namespace thunk | 105 } // namespace thunk |
| 109 } // namespace ppapi | 106 } // namespace ppapi |
| OLD | NEW |