hunspell: Cleanup to fix the header include guards under google/ directory.
[chromium-blink-merge.git] / media / renderers / gpu_video_accelerator_factories.h
blob92bac9bfe14fafa8c063bd0366a2a41b6d769257
1 // Copyright 2013 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 MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
6 #define MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
8 #include <vector>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "gpu/command_buffer/client/gles2_interface.h"
13 #include "gpu/command_buffer/common/mailbox.h"
14 #include "media/base/media_export.h"
15 #include "media/video/video_decode_accelerator.h"
16 #include "media/video/video_encode_accelerator.h"
17 #include "ui/gfx/gpu_memory_buffer.h"
19 namespace base {
20 class SingleThreadTaskRunner;
21 class SharedMemory;
24 namespace gfx {
25 class Rect;
26 class Size;
29 namespace media {
31 class VideoDecodeAccelerator;
33 // Helper interface for specifying factories needed to instantiate a hardware
34 // video accelerator.
35 // Threading model:
36 // * The GpuVideoAcceleratorFactories may be constructed on any thread.
37 // * The GpuVideoAcceleratorFactories has an associated message loop, which may
38 // be retrieved as |GetMessageLoop()|.
39 // * All calls to the Factories after construction must be made on its message
40 // loop.
41 class MEDIA_EXPORT GpuVideoAcceleratorFactories
42 : public base::RefCountedThreadSafe<GpuVideoAcceleratorFactories> {
43 public:
44 // Return whether GPU encoding/decoding is enabled.
45 virtual bool IsGpuVideoAcceleratorEnabled() = 0;
46 // Caller owns returned pointer, but should call Destroy() on it (instead of
47 // directly deleting) for proper destruction, as per the
48 // VideoDecodeAccelerator interface.
49 virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() = 0;
51 // Caller owns returned pointer, but should call Destroy() on it (instead of
52 // directly deleting) for proper destruction, as per the
53 // VideoEncodeAccelerator interface.
54 virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0;
56 // Allocate & delete native textures.
57 virtual bool CreateTextures(int32 count,
58 const gfx::Size& size,
59 std::vector<uint32>* texture_ids,
60 std::vector<gpu::Mailbox>* texture_mailboxes,
61 uint32 texture_target) = 0;
62 virtual void DeleteTexture(uint32 texture_id) = 0;
64 virtual void WaitSyncPoint(uint32 sync_point) = 0;
66 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
67 const gfx::Size& size,
68 gfx::BufferFormat format,
69 gfx::BufferUsage usage) = 0;
71 virtual unsigned ImageTextureTarget() = 0;
72 virtual bool IsTextureRGSupported() = 0;
74 virtual gpu::gles2::GLES2Interface* GetGLES2Interface() = 0;
76 // Allocate & return a shared memory segment.
77 virtual scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) = 0;
79 // Returns the task runner the video accelerator runs on.
80 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0;
82 // Returns the supported codec profiles of video decode accelerator.
83 virtual VideoDecodeAccelerator::SupportedProfiles
84 GetVideoDecodeAcceleratorSupportedProfiles() = 0;
86 // Returns the supported codec profiles of video encode accelerator.
87 virtual VideoEncodeAccelerator::SupportedProfiles
88 GetVideoEncodeAcceleratorSupportedProfiles() = 0;
90 protected:
91 friend class base::RefCountedThreadSafe<GpuVideoAcceleratorFactories>;
92 virtual ~GpuVideoAcceleratorFactories() {}
95 } // namespace media
97 #endif // MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_