mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 13:55:41 +00:00
gl: initial support for texture targets other than GL_TEXTURE_2D
Make GstGLMemory hold the texture target (tex_target) the texture it represents (tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and gst_gl_download_perform_with_data to take the texture target as an argument. This change is needed to support wrapping textures created outside libgstgl, which might be bound to a target other than GL_TEXTURE_2D. For example on OSX textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE. With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the target of textures created with libgstgl. API: modify GstGLMemory API: modify gst_gl_memory_wrapped_texture API: gst_gl_download_perform_with_data
This commit is contained in:
parent
490444637f
commit
4860e179fa
1 changed files with 6 additions and 3 deletions
|
@ -1127,7 +1127,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
GList *walk;
|
GList *walk;
|
||||||
guint out_tex;
|
guint out_tex, out_tex_target;
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
guint array_index = 0;
|
guint array_index = 0;
|
||||||
GstVideoFrame out_frame;
|
GstVideoFrame out_frame;
|
||||||
|
@ -1153,6 +1153,8 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
|
||||||
|
|
||||||
if (!to_download) {
|
if (!to_download) {
|
||||||
out_tex = *(guint *) out_frame.data[0];
|
out_tex = *(guint *) out_frame.data[0];
|
||||||
|
out_tex_target =
|
||||||
|
((GstGLMemory *) gst_buffer_peek_memory (outbuf, 0))->tex_target;
|
||||||
} else {
|
} else {
|
||||||
GST_INFO ("Output Buffer does not contain correct memory, "
|
GST_INFO ("Output Buffer does not contain correct memory, "
|
||||||
"attempting to wrap for download");
|
"attempting to wrap for download");
|
||||||
|
@ -1162,6 +1164,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
|
||||||
|
|
||||||
gst_gl_download_set_format (mix->download, &out_frame.info);
|
gst_gl_download_set_format (mix->download, &out_frame.info);
|
||||||
out_tex = mix->out_tex_id;
|
out_tex = mix->out_tex_id;
|
||||||
|
out_tex_target = GL_TEXTURE_2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_OBJECT_LOCK (mix);
|
GST_OBJECT_LOCK (mix);
|
||||||
|
@ -1215,8 +1218,8 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
|
||||||
g_mutex_unlock (&priv->gl_resource_lock);
|
g_mutex_unlock (&priv->gl_resource_lock);
|
||||||
|
|
||||||
if (to_download) {
|
if (to_download) {
|
||||||
if (!gst_gl_download_perform_with_data (mix->download, out_tex,
|
if (!gst_gl_download_perform_with_data (mix->download,
|
||||||
out_frame.data)) {
|
out_tex, out_tex_target, out_frame.data)) {
|
||||||
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
|
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
|
||||||
"Failed to download video frame"), (NULL));
|
"Failed to download video frame"), (NULL));
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue