diff options
Diffstat (limited to 'chromium/media/filters/gpu_video_accelerator_factories.h')
-rw-r--r-- | chromium/media/filters/gpu_video_accelerator_factories.h | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/chromium/media/filters/gpu_video_accelerator_factories.h b/chromium/media/filters/gpu_video_accelerator_factories.h index c152c2a4bda..a6859c78f22 100644 --- a/chromium/media/filters/gpu_video_accelerator_factories.h +++ b/chromium/media/filters/gpu_video_accelerator_factories.h @@ -5,62 +5,73 @@ #ifndef MEDIA_FILTERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ #define MEDIA_FILTERS_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ +#include <vector> + #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "media/video/video_decode_accelerator.h" -#include "media/video/video_encode_accelerator.h" +#include "gpu/command_buffer/common/mailbox.h" +#include "media/base/media_export.h" + +class SkBitmap; namespace base { -class MessageLoopProxy; +class SingleThreadTaskRunner; class SharedMemory; } -class SkBitmap; +namespace gfx { +class Rect; +class Size; +} namespace media { +class VideoDecodeAccelerator; +class VideoEncodeAccelerator; + // Helper interface for specifying factories needed to instantiate a hardware // video accelerator. +// Threading model: +// * The GpuVideoAcceleratorFactories may be constructed on any thread. +// * The GpuVideoAcceleratorFactories has an associated message loop, which may +// be retrieved as |GetMessageLoop()|. +// * All calls to the Factories after construction must be made on its message +// loop. class MEDIA_EXPORT GpuVideoAcceleratorFactories : public base::RefCountedThreadSafe<GpuVideoAcceleratorFactories> { public: - // Caller owns returned pointer. - virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator( - VideoCodecProfile profile, - VideoDecodeAccelerator::Client* client) = 0; + // Caller owns returned pointer, but should call Destroy() on it (instead of + // directly deleting) for proper destruction, as per the + // VideoDecodeAccelerator interface. + virtual scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() = 0; - // Caller owns returned pointer. - virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator( - VideoEncodeAccelerator::Client* client) = 0; + // Caller owns returned pointer, but should call Destroy() on it (instead of + // directly deleting) for proper destruction, as per the + // VideoEncodeAccelerator interface. + virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0; // Allocate & delete native textures. - virtual uint32 CreateTextures(int32 count, - const gfx::Size& size, - std::vector<uint32>* texture_ids, - std::vector<gpu::Mailbox>* texture_mailboxes, - uint32 texture_target) = 0; + virtual bool CreateTextures(int32 count, + const gfx::Size& size, + std::vector<uint32>* texture_ids, + std::vector<gpu::Mailbox>* texture_mailboxes, + uint32 texture_target) = 0; virtual void DeleteTexture(uint32 texture_id) = 0; virtual void WaitSyncPoint(uint32 sync_point) = 0; - // Read pixels from a native texture and store into |pixels| as RGBA. + // Read pixels within |visible_rect| boundaries from a native texture and + // store into |pixels| as RGBA. virtual void ReadPixels(uint32 texture_id, - const gfx::Size& size, + const gfx::Rect& visible_rect, const SkBitmap& pixels) = 0; // Allocate & return a shared memory segment. Caller is responsible for // Close()ing the returned pointer. virtual base::SharedMemory* CreateSharedMemory(size_t size) = 0; - // Returns the message loop the video accelerator runs on. - virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() = 0; - - // Abort any outstanding factory operations and error any future - // attempts at factory operations - virtual void Abort() = 0; - - // Returns true if Abort() has been called. - virtual bool IsAborted() = 0; + // Returns the task runner the video accelerator runs on. + virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; protected: friend class base::RefCountedThreadSafe<GpuVideoAcceleratorFactories>; |