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
3 // found in the LICENSE file.
5 #include "ppapi/c/private/ppb_content_decryptor_private.h"
6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_instance_api.h"
8 #include "ppapi/thunk/thunk.h"
15 void NeedKey(PP_Instance instance
,
19 EnterInstance
enter(instance
);
20 if (enter
.succeeded())
21 enter
.functions()->NeedKey(instance
, key_system
, session_id
, init_data
);
24 void KeyAdded(PP_Instance instance
,
27 EnterInstance
enter(instance
);
28 if (enter
.succeeded())
29 enter
.functions()->KeyAdded(instance
, key_system
, session_id
);
32 void KeyMessage(PP_Instance instance
,
37 EnterInstance
enter(instance
);
38 if (enter
.succeeded()) {
39 enter
.functions()->KeyMessage(instance
, key_system
, session_id
, message
,
44 void KeyError(PP_Instance instance
,
48 int32_t system_code
) {
49 EnterInstance
enter(instance
);
50 if (enter
.succeeded()) {
51 enter
.functions()->KeyError(instance
, key_system
, session_id
, media_error
,
56 void DeliverBlock(PP_Instance instance
,
57 PP_Resource decrypted_block
,
58 const PP_DecryptedBlockInfo
* block_info
) {
59 EnterInstance
enter(instance
);
60 if (enter
.succeeded())
61 enter
.functions()->DeliverBlock(instance
, decrypted_block
, block_info
);
64 void DecoderInitializeDone(PP_Instance instance
,
65 PP_DecryptorStreamType decoder_type
,
68 EnterInstance
enter(instance
);
69 if (enter
.succeeded()) {
70 enter
.functions()->DecoderInitializeDone(instance
,
77 void DecoderDeinitializeDone(PP_Instance instance
,
78 PP_DecryptorStreamType decoder_type
,
79 uint32_t request_id
) {
80 EnterInstance
enter(instance
);
81 if (enter
.succeeded()) {
82 enter
.functions()->DecoderDeinitializeDone(instance
,
88 void DecoderResetDone(PP_Instance instance
,
89 PP_DecryptorStreamType decoder_type
,
90 uint32_t request_id
) {
91 EnterInstance
enter(instance
);
92 if (enter
.succeeded())
93 enter
.functions()->DecoderResetDone(instance
, decoder_type
, request_id
);
96 void DeliverFrame(PP_Instance instance
,
97 PP_Resource decrypted_frame
,
98 const PP_DecryptedFrameInfo
* frame_info
) {
99 EnterInstance
enter(instance
);
100 if (enter
.succeeded())
101 enter
.functions()->DeliverFrame(instance
, decrypted_frame
, frame_info
);
104 void DeliverSamples(PP_Instance instance
,
105 PP_Resource audio_frames
,
106 const PP_DecryptedBlockInfo
* block_info
) {
107 EnterInstance
enter(instance
);
108 if (enter
.succeeded())
109 enter
.functions()->DeliverSamples(instance
, audio_frames
, block_info
);
112 const PPB_ContentDecryptor_Private g_ppb_decryption_thunk
= {
118 &DecoderInitializeDone
,
119 &DecoderDeinitializeDone
,
127 const PPB_ContentDecryptor_Private
*
128 GetPPB_ContentDecryptor_Private_0_6_Thunk() {
129 return &g_ppb_decryption_thunk
;