Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / media / renderers / gpu_video_accelerator_factories.h
blobc77f86aeac9987daac72a307aba9797107d27ca7
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_encode_accelerator.h"
16 namespace base {
17 class SingleThreadTaskRunner;
18 class SharedMemory;
21 namespace gfx {
22 class Rect;
23 class Size;
26 namespace media {
28 class VideoDecodeAccelerator;
30 // Helper interface for specifying factories needed to instantiate a hardware
31 // video accelerator.
32 // Threading model:
33 // * The GpuVideoAcceleratorFactories may be constructed on any thread.
34 // * The GpuVideoAcceleratorFactories has an associated message loop, which may
35 // be retrieved as |GetMessageLoop()|.
36 // * All calls to the Factories after construction must be made on its message
37 // loop.
38 class MEDIA_EXPORT GpuVideoAcceleratorFactories
39 : public base::RefCountedThreadSafe<GpuVideoAcceleratorFactories> {
40 public:
41 // Caller owns returned pointer, but should call Destroy() on it (instead of
42 // directly deleting) for proper destruction, as per the
43 // VideoDecodeAccelerator interface.
44 virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() = 0;
46 // Caller owns returned pointer, but should call Destroy() on it (instead of
47 // directly deleting) for proper destruction, as per the
48 // VideoEncodeAccelerator interface.
49 virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0;
51 // Allocate & delete native textures.
52 virtual bool CreateTextures(int32 count,
53 const gfx::Size& size,
54 std::vector<uint32>* texture_ids,
55 std::vector<gpu::Mailbox>* texture_mailboxes,
56 uint32 texture_target) = 0;
57 virtual void DeleteTexture(uint32 texture_id) = 0;
59 virtual void WaitSyncPoint(uint32 sync_point) = 0;
61 // Allocate & return a shared memory segment.
62 virtual scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) = 0;
64 // Returns the task runner the video accelerator runs on.
65 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0;
67 // Returns the supported codec profiles of video encode accelerator.
68 virtual std::vector<VideoEncodeAccelerator::SupportedProfile>
69 GetVideoEncodeAcceleratorSupportedProfiles() = 0;
71 protected:
72 friend class base::RefCountedThreadSafe<GpuVideoAcceleratorFactories>;
73 virtual ~GpuVideoAcceleratorFactories() {}
76 } // namespace media
78 #endif // MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_