cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / media / renderers / gpu_video_accelerator_factories.h
blob51740ada926619bb886560ed2485fb22c6200bc9
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/base/video_types.h"
16 #include "media/video/video_decode_accelerator.h"
17 #include "media/video/video_encode_accelerator.h"
18 #include "ui/gfx/gpu_memory_buffer.h"
20 namespace base {
21 class SingleThreadTaskRunner;
22 class SharedMemory;
25 namespace gfx {
26 class Rect;
27 class Size;
30 namespace media {
32 class VideoDecodeAccelerator;
34 // Helper interface for specifying factories needed to instantiate a hardware
35 // video accelerator.
36 // Threading model:
37 // * The GpuVideoAcceleratorFactories may be constructed on any thread.
38 // * The GpuVideoAcceleratorFactories has an associated message loop, which may
39 // be retrieved as |GetMessageLoop()|.
40 // * All calls to the Factories after construction must be made on its message
41 // loop.
42 class MEDIA_EXPORT GpuVideoAcceleratorFactories
43 : public base::RefCountedThreadSafe<GpuVideoAcceleratorFactories> {
44 public:
45 // Return whether GPU encoding/decoding is enabled.
46 virtual bool IsGpuVideoAcceleratorEnabled() = 0;
47 // Caller owns returned pointer, but should call Destroy() on it (instead of
48 // directly deleting) for proper destruction, as per the
49 // VideoDecodeAccelerator interface.
50 virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() = 0;
52 // Caller owns returned pointer, but should call Destroy() on it (instead of
53 // directly deleting) for proper destruction, as per the
54 // VideoEncodeAccelerator interface.
55 virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0;
57 // Allocate & delete native textures.
58 virtual bool CreateTextures(int32 count,
59 const gfx::Size& size,
60 std::vector<uint32>* texture_ids,
61 std::vector<gpu::Mailbox>* texture_mailboxes,
62 uint32 texture_target) = 0;
63 virtual void DeleteTexture(uint32 texture_id) = 0;
65 virtual void WaitSyncPoint(uint32 sync_point) = 0;
67 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
68 const gfx::Size& size,
69 gfx::BufferFormat format,
70 gfx::BufferUsage usage) = 0;
72 virtual bool ShouldUseGpuMemoryBuffersForVideoFrames() const = 0;
73 virtual unsigned ImageTextureTarget() = 0;
74 // Pixel format of the hardware video frames created when GpuMemoryBuffers
75 // video frames are enabled.
76 virtual VideoPixelFormat VideoFrameOutputFormat() = 0;
78 virtual gpu::gles2::GLES2Interface* GetGLES2Interface() = 0;
80 // Allocate & return a shared memory segment.
81 virtual scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) = 0;
83 // Returns the task runner the video accelerator runs on.
84 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0;
86 // Returns the supported codec profiles of video decode accelerator.
87 virtual VideoDecodeAccelerator::SupportedProfiles
88 GetVideoDecodeAcceleratorSupportedProfiles() = 0;
90 // Returns the supported codec profiles of video encode accelerator.
91 virtual VideoEncodeAccelerator::SupportedProfiles
92 GetVideoEncodeAcceleratorSupportedProfiles() = 0;
94 protected:
95 friend class base::RefCountedThreadSafe<GpuVideoAcceleratorFactories>;
96 virtual ~GpuVideoAcceleratorFactories() {}
99 } // namespace media
101 #endif // MEDIA_RENDERERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_