Commit 580a52ec authored by Hyunjun Ko's avatar Hyunjun Ko Committed by Sreerenj Balachandran
Browse files

msdkenc: use bufferpool

1\ Proposes msdk bufferpool to upstream.
  - If upstream has accepted the proposed msdk bufferpool,
    encoder can get msdk surface from the buffer directly.
  - If not, encoder get msdk surface its own msdk bufferpool
    and copy from upstream's frame to the surface.

2\ Replace arrays of surfaces with msdk bufferpool.

3\ In case of using VPP, there should be another msdk bufferpool
   with NV12 info so that it could convert first and encode.

Calls gst_msdk_set_frame_allocator and uses video memory only on linux.
and uses system memory on Windows until d3d allocator is implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
parent 2542b2d3
This diff is collapsed.
......@@ -73,7 +73,6 @@ struct _GstMsdkEnc
GstMsdkContext *context;
mfxVideoParam param;
guint num_surfaces;
mfxFrameSurface1 *surfaces;
guint num_tasks;
MsdkEncTask *tasks;
guint next_task;
......@@ -82,11 +81,17 @@ struct _GstMsdkEnc
mfxVideoParam vpp_param;
guint num_vpp_surfaces;
/* Input interfaces, output above */
mfxFrameSurface1 *vpp_surfaces;
mfxFrameAllocResponse vpp_alloc_resp;
mfxFrameAllocResponse alloc_resp;
mfxExtBuffer *extra_params[MAX_EXTRA_PARAMS];
guint num_extra_params;
GstBufferPool *msdk_pool;
GstBufferPool *msdk_converted_pool;
GstVideoInfo aligned_info;
gboolean use_video_memory;
/* element properties */
gboolean hardware;
......
......@@ -30,6 +30,8 @@
*/
#include "msdk.h"
#include "gstmsdkvideomemory.h"
#include "gstmsdksystemmemory.h"
GST_DEBUG_CATEGORY_EXTERN (gst_msdkenc_debug);
#define GST_CAT_DEFAULT gst_msdkenc_debug
......@@ -453,3 +455,32 @@ gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
return;
}
gboolean
gst_msdk_is_msdk_buffer (GstBuffer * buf)
{
GstAllocator *allocator;
GstMemory *mem = gst_buffer_peek_memory (buf, 0);
allocator = GST_MEMORY_CAST (mem)->allocator;
if (allocator && (GST_IS_MSDK_VIDEO_ALLOCATOR (allocator) ||
GST_IS_MSDK_SYSTEM_ALLOCATOR (allocator)))
return TRUE;
else
return FALSE;
}
mfxFrameSurface1 *
gst_msdk_get_surface_from_buffer (GstBuffer * buf)
{
GstAllocator *allocator;
GstMemory *mem = gst_buffer_peek_memory (buf, 0);
allocator = GST_MEMORY_CAST (mem)->allocator;
if (GST_IS_MSDK_VIDEO_ALLOCATOR (allocator))
return GST_MSDK_VIDEO_MEMORY_CAST (mem)->surface;
else
return GST_MSDK_SYSTEM_MEMORY_CAST (mem)->surface;
}
......@@ -69,6 +69,12 @@ gint gst_msdk_get_mfx_fourcc_from_format (GstVideoFormat format);
void gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
GstVideoInfo * info);
gboolean
gst_msdk_is_msdk_buffer (GstBuffer * buf);
mfxFrameSurface1 *
gst_msdk_get_surface_from_buffer (GstBuffer * buf);
G_END_DECLS
#endif /* __MSDK_H__ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment