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

Side by Side Diff: content/renderer/pepper/pepper_video_decoder_host.h

Issue 270213004: Implement Pepper PPB_VideoDecoder interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, update to PPAPI message map macros. 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
OLDNEW
(Empty)
1 // Copyright (c) 2014 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 CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_
7
8 #include <list>
yzshen1 2014/05/14 18:08:23 This is not needed (and line 10)
bbudge 2014/05/14 19:35:04 Done.
9 #include <map>
10 #include <queue>
11 #include <vector>
12
13 #include "base/basictypes.h"
14 #include "base/containers/hash_tables.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/scoped_vector.h"
18 #include "content/common/content_export.h"
19 #include "gpu/command_buffer/common/mailbox.h"
20 #include "media/video/video_decode_accelerator.h"
21 #include "ppapi/c/pp_codecs.h"
22 #include "ppapi/host/host_message_context.h"
23 #include "ppapi/host/resource_host.h"
24 #include "ppapi/proxy/resource_message_params.h"
25
26 namespace base {
27 class SharedMemory;
28 }
29
30 namespace content {
31
32 class PPB_Graphics3D_Impl;
33 class RendererPpapiHost;
34 class RenderViewImpl;
35
36 class CONTENT_EXPORT PepperVideoDecoderHost
37 : public ppapi::host::ResourceHost,
38 public media::VideoDecodeAccelerator::Client {
39 public:
40 PepperVideoDecoderHost(RendererPpapiHost* host,
41 PP_Instance instance,
42 PP_Resource resource);
43 virtual ~PepperVideoDecoderHost();
44
45 private:
46 struct PendingDecode {
47 PendingDecode(uint32_t shm_id,
48 const ppapi::host::ReplyMessageContext& reply_context);
49 ~PendingDecode();
50
51 uint32_t shm_id_;
yzshen1 2014/05/14 18:08:23 I think public struct members don't need the '_' s
bbudge 2014/05/14 19:35:04 I did this to avoid name collisions in ctors. But
yzshen1 2014/05/14 22:58:16 I think '_' suffix has pretty specific meaning in
52 ppapi::host::ReplyMessageContext reply_context_;
53 };
54
55 virtual int32_t OnResourceMessageReceived(
56 const IPC::Message& msg,
57 ppapi::host::HostMessageContext* context) OVERRIDE;
58
59 // media::VideoDecodeAccelerator::Client implementation.
60 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers,
61 const gfx::Size& dimensions,
62 uint32 texture_target) OVERRIDE;
63 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
64 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
65 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE;
66 virtual void NotifyFlushDone() OVERRIDE;
67 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE;
68 virtual void NotifyResetDone() OVERRIDE;
69
70 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context,
71 ppapi::HostResource graphics_context,
yzshen1 2014/05/14 18:08:23 maybe const&?
bbudge 2014/05/14 19:35:04 Done.
72 PP_VideoProfile profile,
73 bool allow_software_fallback);
74 int32_t OnHostMsgGetShm(ppapi::host::HostMessageContext* context,
75 uint32_t size);
76 int32_t OnHostMsgAssignTextures(ppapi::host::HostMessageContext* context,
77 PP_Size size,
yzshen1 2014/05/14 18:08:23 const &?
bbudge 2014/05/14 19:35:04 Done.
78 const std::vector<uint32_t>& texture_ids);
79 int32_t OnHostMsgDecode(ppapi::host::HostMessageContext* context,
80 uint32_t shm_id,
81 uint32_t decode_id,
82 uint32_t size);
83 int32_t OnHostMsgRecyclePicture(ppapi::host::HostMessageContext* context,
84 uint32_t picture_id);
85 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context);
86 int32_t OnHostMsgReset(ppapi::host::HostMessageContext* context);
87
88 void RequestTextures(uint32 num_textures,
89 const gfx::Size& dimensions,
90 uint32 texture_target);
91
92 // Non-owning pointer.
93 RendererPpapiHost* renderer_ppapi_host_;
94
95 scoped_ptr<media::VideoDecodeAccelerator> decoder_;
96
97 scoped_refptr<PPB_Graphics3D_Impl> graphics3d_;
98 ScopedVector<base::SharedMemory> shm_buffers_;
99
100 // Maps decode_id to decode reply info, for pending decode messages.
101 typedef base::hash_map<uint32_t, PendingDecode> PendingDecodeMap;
102 PendingDecodeMap pending_decodes_;
103
104 ppapi::host::ReplyMessageContext flush_reply_context_;
105 ppapi::host::ReplyMessageContext reset_reply_context_;
106
107 bool initialized_;
108
109 DISALLOW_COPY_AND_ASSIGN(PepperVideoDecoderHost);
110 };
111
112 } // namespace content
113
114 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698