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

Side by Side Diff: ppapi/shared_impl/video_decoder_impl.h

Issue 7545014: Implement PPAPI VideoDecode out-of-process support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responding to brettw 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/shared_impl/tracker_base.h ('k') | ppapi/shared_impl/video_decoder_impl.cc » ('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) 2011 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 #ifndef PPAPI_SHARED_IMPL_VIDEO_DECODER_IMPL_H_
6 #define PPAPI_SHARED_IMPL_VIDEO_DECODER_IMPL_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "ppapi/c/dev/ppb_video_decoder_dev.h"
14 #include "ppapi/shared_impl/resource_object_base.h"
15 #include "ppapi/thunk/ppb_video_decoder_api.h"
16
17 namespace gpu {
18 namespace gles2 {
19 class GLES2Implementation;
20 } // namespace gles2
21 } // namespace gpu
22
23 namespace ppapi {
24 namespace thunk {
25 class PPB_Context3D_API;
26 } // namespace thunk
27 } // namespace ppapi
28
29 namespace ppapi {
30
31 // Implements the logic to set and run callbacks for various video decoder
32 // events. Both the proxy and the renderer implementation share this code.
33 class VideoDecoderImpl : public ResourceObjectBase,
34 public thunk::PPB_VideoDecoder_API {
35 public:
36 VideoDecoderImpl();
37 virtual ~VideoDecoderImpl();
38
39 // ResourceObjectBase implementation.
40 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
41
42 // PPB_VideoDecoder_API implementation.
43 virtual void Destroy() OVERRIDE;
44
45 // Copy C-style config list into |out_configs| vector.
46 static bool CopyConfigsToVector(
47 const PP_VideoConfigElement* configs_to_copy,
48 std::vector<PP_VideoConfigElement>* out_configs);
49
50 protected:
51 void SetFlushCallback(PP_CompletionCallback callback);
52 void SetResetCallback(PP_CompletionCallback callback);
53 void SetBitstreamBufferCallback(
54 int32 bitstream_buffer_id, PP_CompletionCallback callback);
55
56 void RunFlushCallback(int32 result);
57 void RunResetCallback(int32 result);
58 void RunBitstreamBufferCallback(int32 bitstream_buffer_id, int32 result);
59
60 // Tell command buffer to process all commands it has received so far.
61 void FlushCommandBuffer();
62
63 // Initialize the underlying decoder and return success status.
64 virtual bool Init(PP_Resource context3d_id,
65 thunk::PPB_Context3D_API* context,
66 const PP_VideoConfigElement* dec_config);
67
68 // TODO(fischman/vrk): Remove accordingly when brettw has merged resource
69 // trackers.
70 virtual void AddRefResource(PP_Resource resource) = 0;
71 virtual void UnrefResource(PP_Resource resource) = 0;
72
73 private:
74 // Key: bitstream_buffer_id, value: callback to run when bitstream decode is
75 // done.
76 typedef std::map<int32, PP_CompletionCallback> CallbackById;
77
78 PP_CompletionCallback flush_callback_;
79 PP_CompletionCallback reset_callback_;
80 CallbackById bitstream_buffer_callbacks_;
81
82 // The resource ID of the underlying Context3d object being used. Used only
83 // for reference counting to keep it alive for the lifetime of |*this|.
84 PP_Resource context3d_id_;
85
86 // Reference to the GLES2Implementation owned by |context3d_id_|.
87 // Context3D is guaranteed to be alive for the lifetime of this class.
88 // In the out-of-process case, Context3D's gles2_impl() exists in the plugin
89 // process only, so gles2_impl_ is NULL in that case.
90 gpu::gles2::GLES2Implementation* gles2_impl_;
91
92 DISALLOW_COPY_AND_ASSIGN(VideoDecoderImpl);
93 };
94
95 } // namespace ppapi
96
97 #endif // PPAPI_SHARED_IMPL_VIDEO_DECODER_IMPL_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/tracker_base.h ('k') | ppapi/shared_impl/video_decoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698