mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +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 *
|
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;
|
GstFlowReturn ret;
|
||||||
GstVideoFrame inframe, outframe;
|
GstVideoFrame inframe, outframe;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
GstBuffer *buf;
|
||||||
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");
|
|
||||||
|
|
||||||
if (!gst_buffer_pool_set_active (self->pool, TRUE))
|
if (!gst_buffer_pool_set_active (self->pool, TRUE))
|
||||||
goto activate_pool_failed;
|
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
|
static GstFlowReturn
|
||||||
gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue