Refactor management of overview window copy lifetime into a separate class.
[chromium-blink-merge.git] / content / renderer / pepper / ppb_video_decoder_impl.h
blobd9b195bc5aae94512c301a39e499e92352e1497c
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 #ifndef CONTENT_RENDERER_PEPPER_PPB_VIDEO_DECODER_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_VIDEO_DECODER_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "media/video/video_decode_accelerator.h"
12 #include "ppapi/c/dev/pp_video_dev.h"
13 #include "ppapi/c/dev/ppp_video_decoder_dev.h"
14 #include "ppapi/c/pp_var.h"
15 #include "ppapi/shared_impl/ppb_video_decoder_shared.h"
16 #include "ppapi/shared_impl/resource.h"
17 #include "ppapi/thunk/ppb_video_decoder_api.h"
19 struct PP_PictureBuffer_Dev;
20 struct PP_VideoBitstreamBuffer_Dev;
22 namespace gpu {
23 namespace gles2 {
24 class GLES2Implementation;
25 } // namespace gles2
26 } // namespace gpu
28 namespace content {
29 class PlatformContext3D;
30 class PlatformVideoDecoder;
32 class PPB_VideoDecoder_Impl : public ppapi::PPB_VideoDecoder_Shared,
33 public media::VideoDecodeAccelerator::Client {
34 public:
35 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create &
36 // initialize.
37 static PP_Resource Create(PP_Instance instance,
38 PP_Resource graphics_context,
39 PP_VideoDecoder_Profile profile);
41 // PPB_VideoDecoder_API implementation.
42 virtual int32_t Decode(
43 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
44 scoped_refptr<ppapi::TrackedCallback> callback) OVERRIDE;
45 virtual void AssignPictureBuffers(
46 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE;
47 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE;
48 virtual int32_t Flush(
49 scoped_refptr<ppapi::TrackedCallback> callback) OVERRIDE;
50 virtual int32_t Reset(
51 scoped_refptr<ppapi::TrackedCallback> callback) OVERRIDE;
52 virtual void Destroy() OVERRIDE;
54 // media::VideoDecodeAccelerator::Client implementation.
55 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers,
56 const gfx::Size& dimensions,
57 uint32 texture_target) OVERRIDE;
58 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
59 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
60 virtual void NotifyInitializeDone() OVERRIDE;
61 virtual void NotifyError(
62 media::VideoDecodeAccelerator::Error error) OVERRIDE;
63 virtual void NotifyFlushDone() OVERRIDE;
64 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE;
65 virtual void NotifyResetDone() OVERRIDE;
67 private:
68 virtual ~PPB_VideoDecoder_Impl();
70 explicit PPB_VideoDecoder_Impl(PP_Instance instance);
71 bool Init(PP_Resource graphics_context,
72 PlatformContext3D* context,
73 gpu::gles2::GLES2Implementation* gles2_impl,
74 PP_VideoDecoder_Profile profile);
76 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
77 // swapped with another.
78 scoped_ptr<PlatformVideoDecoder> platform_video_decoder_;
80 // Reference to the plugin requesting this interface.
81 const PPP_VideoDecoder_Dev* ppp_videodecoder_;
83 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl);
86 } // namespace content
88 #endif // CONTENT_RENDERER_PEPPER_PPB_VIDEO_DECODER_IMPL_H_