Index: media/video/video_decode_accelerator.h |
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h |
index abe2673626f860fffdd1cc8ffbf4c747647cff24..a9b4446908d8610fa4ab21beef72c39dd0934127 100644 |
--- a/media/video/video_decode_accelerator.h |
+++ b/media/video/video_decode_accelerator.h |
@@ -17,6 +17,7 @@ |
#include "media/base/video_decoder_config.h" |
#include "media/video/picture.h" |
#include "ui/gfx/geometry/size.h" |
+#include "ui/gfx/gpu_memory_buffer.h" |
typedef unsigned int GLenum; |
@@ -112,6 +113,18 @@ class MEDIA_EXPORT VideoDecodeAccelerator { |
// an output SurfaceView on Android. It's only valid when not equal to |
// |kNoSurfaceID|. |
int surface_id = kNoSurfaceID; |
+ |
+ // Specifies the allocation and handling mode for output PictureBuffers. |
+ // When set to ALLOCATE, the VDA is expected to allocate backing memory |
+ // for PictureBuffers at the time of AssignPictureBuffers() call. |
+ // When set to IMPORT, the VDA will not allocate, but after receiving |
+ // AssignPictureBuffers() call, it will expect a call to |
+ // ImportBufferForPicture() for each PictureBuffer before use. |
+ enum class OutputMode { |
kcwu
2016/03/22 05:42:54
Move type definition to head of struct.
Pawel Osciak
2016/03/28 01:31:29
Done.
|
+ ALLOCATE, |
+ IMPORT, |
+ }; |
+ OutputMode output_mode = OutputMode::ALLOCATE; |
}; |
// Interface for collaborating with picture interface to provide memory for |
@@ -203,6 +216,19 @@ class MEDIA_EXPORT VideoDecodeAccelerator { |
virtual void AssignPictureBuffers( |
const std::vector<PictureBuffer>& buffers) = 0; |
+ // Imports |gpu_memory_buffer_handles| as backing memory for picture buffer |
+ // associated with |picture_buffer_id|. The n-th element in |
+ // |gpu_memory_buffer_handles| should be a handle to a GpuMemoryBuffer backing |
+ // the n-th plane of the PictureBuffer. This can only be be used if the VDA |
+ // has been Initialize()d with config.output_mode = IMPORT, and should be |
+ // preceded by a call to AssignPictureBuffers() to set up the number of |
+ // PictureBuffers and their details. |
+ // After this call, the VDA becomes the owner of the GpuMemoryBufferHandles, |
+ // and is responsible for closing them after use, also on import failure. |
+ virtual void ImportBufferForPicture( |
+ int32_t picture_buffer_id, |
+ const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles); |
+ |
// Sends picture buffers to be reused by the decoder. This needs to be called |
// for each buffer that has been processed so that decoder may know onto which |
// picture buffers it can write the output to. |
@@ -267,6 +293,11 @@ class MEDIA_EXPORT VideoDecodeAccelerator { |
// TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 |
virtual GLenum GetSurfaceInternalFormat() const; |
+ // In IMPORT OutputMode, return the format that the VDA requires for imported |
+ // picture buffers. In ALLOCATE mode, return the format that VDA is currently |
+ // using or will be using for output picture buffers allocated by it. |
+ virtual VideoPixelFormat GetOutputFormat() const; |
+ |
protected: |
// Do not delete directly; use Destroy() or own it with a scoped_ptr, which |
// will Destroy() it properly by default. |