Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / media / renderers / gpu_video_accelerator_factories.h
blob0980f34489af55dc00cd4d32f476599a997cbbc4
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/common/mailbox.h"
13 #include "media/base/media_export.h"
14 #include "media/video/video_decode_accelerator.h"
15 #include "media/video/video_encode_accelerator.h"
17 namespace base {
18 class SingleThreadTaskRunner;
19 class SharedMemory;
22 namespace gfx {
23 class Rect;
24 class Size;
27 namespace media {
29 class VideoDecodeAccelerator;
31 // Helper interface for specifying factories needed to instantiate a hardware
32 // video accelerator.
33 // Threading model:
34 // * The GpuVideoAcceleratorFactories may be constructed on any thread.
35 // * The GpuVideoAcceleratorFactories has an associated message loop, which may
36 // be retrieved as |GetMessageLoop()|.
37 // * All calls to the Factories after construction must be made on its message
38 // loop.
39 class MEDIA_EXPORT GpuVideoAcceleratorFactories
40 : public base::RefCountedThreadSafe<GpuVideoAcceleratorFactories> {
41 public:
42 // Caller owns returned pointer, but should call Destroy() on it (instead of
43 // directly deleting) for proper destruction, as per the
44 // VideoDecodeAccelerator interface.
45 virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() = 0;
47 // Caller owns returned pointer, but should call Destroy() on it (instead of
48 // directly deleting) for proper destruction, as per the
49 // VideoEncodeAccelerator interface.
50 virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0;
52 // Allocate & delete native textures.
53 virtual bool CreateTextures(int32 count,
54 const gfx::Size& size,
55 std::vector<uint32>* texture_ids,
56 std::vector<gpu::Mailbox>* texture_mailboxes,
57 uint32 texture_target) = 0;
58 virtual void DeleteTexture(uint32 texture_id) = 0;
60 virtual void WaitSyncPoint(uint32 sync_point) = 0;
62 // Allocate & return a shared memory segment.
63 virtual scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) = 0;
65 // Returns the task runner the video accelerator runs on.
66 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0;
68 // Returns the supported codec profiles of video decode accelerator.
69 virtual VideoDecodeAccelerator::SupportedProfiles
70 GetVideoDecodeAcceleratorSupportedProfiles() = 0;
72 // Returns the supported codec profiles of video encode accelerator.
73 virtual VideoEncodeAccelerator::SupportedProfiles
74 GetVideoEncodeAcceleratorSupportedProfiles() = 0;
76 protected:
77 friend class base::RefCountedThreadSafe<GpuVideoAcceleratorFactories>;
78 virtual ~GpuVideoAcceleratorFactories() {}
81 } // namespace media
83 #endif // MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_