mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
kmssink: Factor out copying to dump buffer
This will be used to copy any upstream memory in order to return it on resolution change, allocation query or drain query. https://bugzilla.gnome.org/show_bug.cgi?id=782774
This commit is contained in:
parent
8a070cf9af
commit
6e3fe4eaab
1 changed files with 23 additions and 16 deletions
|
@ -1136,26 +1136,12 @@ wrap_mem:
|
|||
}
|
||||
|
||||
static GstBuffer *
|
||||
gst_kms_sink_get_input_buffer (GstKMSSink * self, GstBuffer * inbuf)
|
||||
gst_kms_sink_copy_to_dumb_buffer (GstKMSSink * self, GstBuffer * inbuf)
|
||||
{
|
||||
GstMemory *mem;
|
||||
GstBuffer *buf;
|
||||
GstFlowReturn ret;
|
||||
GstVideoFrame inframe, outframe;
|
||||
gboolean success;
|
||||
|
||||
mem = gst_buffer_peek_memory (inbuf, 0);
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
if (gst_is_kms_memory (mem))
|
||||
return gst_buffer_ref (inbuf);
|
||||
|
||||
buf = NULL;
|
||||
if (gst_kms_sink_import_dmabuf (self, inbuf, &buf))
|
||||
return buf;
|
||||
|
||||
GST_CAT_INFO_OBJECT (CAT_PERFORMANCE, self, "frame copy");
|
||||
GstBuffer *buf;
|
||||
|
||||
if (!gst_buffer_pool_set_active (self->pool, TRUE))
|
||||
goto activate_pool_failed;
|
||||
|
@ -1215,6 +1201,27 @@ error_map_src_buffer:
|
|||
}
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
gst_kms_sink_get_input_buffer (GstKMSSink * self, GstBuffer * inbuf)
|
||||
{
|
||||
GstMemory *mem;
|
||||
GstBuffer *buf = NULL;
|
||||
|
||||
mem = gst_buffer_peek_memory (inbuf, 0);
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
if (gst_is_kms_memory (mem))
|
||||
return gst_buffer_ref (inbuf);
|
||||
|
||||
if (gst_kms_sink_import_dmabuf (self, inbuf, &buf))
|
||||
return buf;
|
||||
|
||||
GST_CAT_INFO_OBJECT (CAT_PERFORMANCE, self, "frame copy");
|
||||
|
||||
return gst_kms_sink_copy_to_dumb_buffer (self, inbuf);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue