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

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

Issue 263893005: Rename some PPB_VideoDecoder_Dev implementation types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename resource creation API method CreateVideoDecoder (add Dev). Created 6 years, 7 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_dev_thunk.cc ('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
(Empty)
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.
4
5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/shared_impl/tracked_callback.h"
7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/thunk.h"
9 #include "ppapi/thunk/ppb_video_decoder_api.h"
10 #include "ppapi/thunk/resource_creation_api.h"
11
12 namespace ppapi {
13 namespace thunk {
14
15 namespace {
16
17 typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder;
18
19 PP_Resource Create(PP_Instance instance,
20 PP_Resource graphics_3d,
21 PP_VideoDecoder_Profile profile) {
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateVideoDecoder(instance, graphics_3d, profile);
26 }
27
28 PP_Bool IsVideoDecoder(PP_Resource resource) {
29 EnterVideoDecoder enter(resource, false);
30 return PP_FromBool(enter.succeeded());
31 }
32
33 int32_t Decode(PP_Resource video_decoder,
34 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
35 PP_CompletionCallback callback) {
36 EnterVideoDecoder enter(video_decoder, callback, true);
37 if (enter.failed())
38 return enter.retval();
39 return enter.SetResult(enter.object()->Decode(bitstream_buffer,
40 enter.callback()));
41 }
42
43 void AssignPictureBuffers(PP_Resource video_decoder,
44 uint32_t no_of_buffers,
45 const PP_PictureBuffer_Dev* buffers) {
46 EnterVideoDecoder enter(video_decoder, true);
47 if (enter.succeeded())
48 enter.object()->AssignPictureBuffers(no_of_buffers, buffers);
49 }
50
51 void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
52 EnterVideoDecoder enter(video_decoder, true);
53 if (enter.succeeded())
54 enter.object()->ReusePictureBuffer(picture_buffer_id);
55 }
56
57 int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
58 EnterVideoDecoder enter(video_decoder, callback, true);
59 if (enter.failed())
60 return enter.retval();
61 return enter.SetResult(enter.object()->Flush(enter.callback()));
62 }
63
64 int32_t Reset(PP_Resource video_decoder,
65 PP_CompletionCallback callback) {
66 EnterVideoDecoder enter(video_decoder, callback, true);
67 if (enter.failed())
68 return enter.retval();
69 return enter.SetResult(enter.object()->Reset(enter.callback()));
70 }
71
72 void Destroy(PP_Resource video_decoder) {
73 EnterVideoDecoder enter(video_decoder, true);
74 if (enter.succeeded())
75 enter.object()->Destroy();
76 }
77
78 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = {
79 &Create,
80 &IsVideoDecoder,
81 &Decode,
82 &AssignPictureBuffers,
83 &ReusePictureBuffer,
84 &Flush,
85 &Reset,
86 &Destroy
87 };
88
89 } // namespace
90
91 const PPB_VideoDecoder_Dev_0_16* GetPPB_VideoDecoder_Dev_0_16_Thunk() {
92 return &g_ppb_videodecoder_thunk;
93 }
94
95 } // namespace thunk
96 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_video_decoder_dev_thunk.cc ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698