Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: ppapi/thunk/ppb_video_decoder_thunk.cc

Issue 7474006: PPB_VideoDecoder_Dev::Initialize is now synchronous! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vrk CR update. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/ppb_video_decoder_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 namespace ppapi { 12 namespace ppapi {
13 namespace thunk { 13 namespace thunk {
14 14
15 namespace { 15 namespace {
16 16
17 typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder; 17 typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder;
18 18
19 PP_Resource Create(PP_Instance instance) { 19 PP_Resource Create(PP_Instance instance,
20 PP_Resource context_3d,
21 const PP_VideoConfigElement* config) {
20 EnterFunction<ResourceCreationAPI> enter(instance, true); 22 EnterFunction<ResourceCreationAPI> enter(instance, true);
21 if (enter.failed()) 23 if (enter.failed())
22 return 0; 24 return 0;
23 return enter.functions()->CreateVideoDecoder(instance); 25 return enter.functions()->CreateVideoDecoder(instance, context_3d, config);
24 } 26 }
25 27
26 PP_Bool IsVideoDecoder(PP_Resource resource) { 28 PP_Bool IsVideoDecoder(PP_Resource resource) {
27 EnterVideoDecoder enter(resource, false); 29 EnterVideoDecoder enter(resource, false);
28 return PP_FromBool(enter.succeeded()); 30 return PP_FromBool(enter.succeeded());
29 } 31 }
30 32
31 int32_t Initialize(PP_Resource video_decoder,
32 PP_Resource context_id,
33 const PP_VideoConfigElement* decoder_config,
34 PP_CompletionCallback callback) {
35 EnterVideoDecoder enter(video_decoder, true);
36 if (enter.failed())
37 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
38 int32_t result =
39 enter.object()->Initialize(context_id, decoder_config, callback);
40 return MayForceCallback(callback, result);
41 }
42
43 int32_t Decode(PP_Resource video_decoder, 33 int32_t Decode(PP_Resource video_decoder,
44 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 34 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
45 PP_CompletionCallback callback) { 35 PP_CompletionCallback callback) {
46 EnterVideoDecoder enter(video_decoder, true); 36 EnterVideoDecoder enter(video_decoder, true);
47 if (enter.failed()) 37 if (enter.failed())
48 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 38 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
49 int32_t result = enter.object()->Decode(bitstream_buffer, callback); 39 int32_t result = enter.object()->Decode(bitstream_buffer, callback);
50 return MayForceCallback(callback, result); 40 return MayForceCallback(callback, result);
51 } 41 }
52 42
(...skipping 30 matching lines...) Expand all
83 73
84 void Destroy(PP_Resource video_decoder) { 74 void Destroy(PP_Resource video_decoder) {
85 EnterVideoDecoder enter(video_decoder, true); 75 EnterVideoDecoder enter(video_decoder, true);
86 if (enter.succeeded()) 76 if (enter.succeeded())
87 enter.object()->Destroy(); 77 enter.object()->Destroy();
88 } 78 }
89 79
90 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = { 80 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = {
91 &Create, 81 &Create,
92 &IsVideoDecoder, 82 &IsVideoDecoder,
93 &Initialize,
94 &Decode, 83 &Decode,
95 &AssignPictureBuffers, 84 &AssignPictureBuffers,
96 &ReusePictureBuffer, 85 &ReusePictureBuffer,
97 &Flush, 86 &Flush,
98 &Reset, 87 &Reset,
99 &Destroy 88 &Destroy
100 }; 89 };
101 90
102 } // namespace 91 } // namespace
103 92
104 const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Thunk() { 93 const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Thunk() {
105 return &g_ppb_videodecoder_thunk; 94 return &g_ppb_videodecoder_thunk;
106 } 95 }
107 96
108 } // namespace thunk 97 } // namespace thunk
109 } // namespace ppapi 98 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_video_decoder_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698