Upstream version 8.37.180.0
[platform/framework/web/crosswalk.git] / src / content / common / gpu / media / vt_video_decode_accelerator.h
1 // Copyright 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_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_
7
8 #include <stdint.h>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/message_loop/message_loop_proxy.h"
14 #include "media/video/video_decode_accelerator.h"
15 #include "ui/gl/gl_context_cgl.h"
16
17 namespace content {
18
19 // (Stub of a) VideoToolbox.framework implementation of the
20 // VideoDecodeAccelerator interface for Mac OS X.
21 class VTVideoDecodeAccelerator
22     : public media::VideoDecodeAccelerator,
23       public base::NonThreadSafe {
24  public:
25   explicit VTVideoDecodeAccelerator(CGLContextObj cgl_context);
26   virtual ~VTVideoDecodeAccelerator();
27
28   // VideoDecodeAccelerator implementation.
29   virtual bool Initialize(
30       media::VideoCodecProfile profile,
31       Client* client) OVERRIDE;
32   virtual void Decode(const media::BitstreamBuffer& bitstream) OVERRIDE;
33   virtual void AssignPictureBuffers(
34       const std::vector<media::PictureBuffer>& pictures) OVERRIDE;
35   virtual void ReusePictureBuffer(int32_t picture_id) OVERRIDE;
36   virtual void Flush() OVERRIDE;
37   virtual void Reset() OVERRIDE;
38   virtual void Destroy() OVERRIDE;
39   virtual bool CanDecodeOnIOThread() OVERRIDE;
40
41  private:
42   scoped_refptr<base::MessageLoopProxy> loop_proxy_;
43   CGLContextObj cgl_context_;
44   media::VideoDecodeAccelerator::Client* client_;
45
46   // Member variables should appear before the WeakPtrFactory, to ensure
47   // that any WeakPtrs to Controller are invalidated before its members
48   // variable's destructors are executed, rendering them invalid.
49   base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_;
50
51   DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator);
52 };
53
54 }  // namespace content
55
56 #endif  // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_