mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
download: only start a download transfer for sysmem caps features
This commit is contained in:
parent
57042af9d6
commit
d5a39896dc
2 changed files with 21 additions and 10 deletions
|
@ -32,8 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstGLDownloadElement, gst_gl_download_element,
|
G_DEFINE_TYPE_WITH_CODE (GstGLDownloadElement, gst_gl_download_element,
|
||||||
GST_TYPE_GL_BASE_FILTER,
|
GST_TYPE_GL_BASE_FILTER,
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_gl_download_element_debug, "gldownloadelement",
|
GST_DEBUG_CATEGORY_INIT (gst_gl_download_element_debug, "gldownloadelement",
|
||||||
0, "download element");
|
0, "download element"););
|
||||||
);
|
|
||||||
|
|
||||||
static gboolean gst_gl_download_element_get_unit_size (GstBaseTransform * trans,
|
static gboolean gst_gl_download_element_get_unit_size (GstBaseTransform * trans,
|
||||||
GstCaps * caps, gsize * size);
|
GstCaps * caps, gsize * size);
|
||||||
|
@ -161,18 +160,30 @@ static GstFlowReturn
|
||||||
gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
|
gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
|
||||||
GstBuffer * inbuf, GstBuffer ** outbuf)
|
GstBuffer * inbuf, GstBuffer ** outbuf)
|
||||||
{
|
{
|
||||||
|
GstCaps *src_caps = gst_pad_get_current_caps (bt->srcpad);
|
||||||
|
GstCapsFeatures *features = NULL;
|
||||||
gint i, n;
|
gint i, n;
|
||||||
|
|
||||||
*outbuf = inbuf;
|
*outbuf = inbuf;
|
||||||
|
|
||||||
|
if (src_caps)
|
||||||
|
features = gst_caps_get_features (src_caps, 0);
|
||||||
|
|
||||||
n = gst_buffer_n_memory (*outbuf);
|
n = gst_buffer_n_memory (*outbuf);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
GstMemory *mem = gst_buffer_peek_memory (*outbuf, i);
|
GstMemory *mem = gst_buffer_peek_memory (*outbuf, i);
|
||||||
|
|
||||||
if (gst_is_gl_memory (mem))
|
if (gst_is_gl_memory (mem)) {
|
||||||
gst_gl_memory_download_transfer ((GstGLMemory *) mem);
|
if (!features || gst_caps_features_contains (features,
|
||||||
|
GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY)) {
|
||||||
|
gst_gl_memory_download_transfer ((GstGLMemory *) mem);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src_caps)
|
||||||
|
gst_caps_unref (src_caps);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,14 +389,14 @@ gst_gl_context_egl_create_context (GstGLContext * context,
|
||||||
gst_gl_context_egl_get_error_string ());
|
gst_gl_context_egl_get_error_string ());
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
/* FIXME do we want a window vfunc ? */
|
||||||
|
#if GST_GL_HAVE_WINDOW_X11
|
||||||
|
if (GST_GL_IS_WINDOW_X11 (context->window)) {
|
||||||
|
gst_gl_window_x11_create_window ((GstGLWindowX11 *) context->window);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (other_context == NULL) {
|
if (other_context == NULL) {
|
||||||
/* FIXME do we want a window vfunc ? */
|
|
||||||
#if GST_GL_HAVE_WINDOW_X11
|
|
||||||
if (GST_GL_IS_WINDOW_X11 (context->window)) {
|
|
||||||
gst_gl_window_x11_create_window ((GstGLWindowX11 *) context->window);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if GST_GL_HAVE_WINDOW_WAYLAND
|
#if GST_GL_HAVE_WINDOW_WAYLAND
|
||||||
if (GST_GL_IS_WINDOW_WAYLAND_EGL (context->window)) {
|
if (GST_GL_IS_WINDOW_WAYLAND_EGL (context->window)) {
|
||||||
gst_gl_window_wayland_egl_create_window ((GstGLWindowWaylandEGL *)
|
gst_gl_window_wayland_egl_create_window ((GstGLWindowWaylandEGL *)
|
||||||
|
|
Loading…
Reference in a new issue