From d6ef47cd9c500227f5d07813f6464ee662575c45 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Mon, 11 Aug 2008 15:40:39 +0200 Subject: [PATCH] [146/906] remove filteredge --- gst-libs/gst/gl/gstglfilter.c | 38 ++++---- gst/gl/gstglfilteredge.c | 206 ------------------------------------------ gst/gl/gstglfilteredge.h | 53 ----------- gst/gl/gstglupload.c | 84 ++++++++--------- 4 files changed, 61 insertions(+), 320 deletions(-) delete mode 100644 gst/gl/gstglfilteredge.c delete mode 100644 gst/gl/gstglfilteredge.h diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index fa61126..4451eb4 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2008 Julien Isorce * Copyright (C) 2008 Filippo Argiolas @@ -129,7 +129,7 @@ gst_gl_filter_set_property (GObject * object, guint prop_id, { //GstGLFilter *filter = GST_GL_FILTER (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -143,7 +143,7 @@ gst_gl_filter_get_property (GObject * object, guint prop_id, { //GstGLFilter *filter = GST_GL_FILTER (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -155,17 +155,17 @@ static void gst_gl_filter_reset (GstGLFilter* filter) { GstGLFilterClass* filter_class = GST_GL_FILTER_GET_CLASS (filter); - + if (filter_class->onReset) filter_class->onReset (filter); - - if (filter->display) + + if (filter->display) { if (filter_class->display_reset_cb != NULL) { gst_gl_display_thread_add (filter->display, gst_gl_filter_stop_gl, filter); } //blocking call, delete the FBO - gst_gl_display_del_fbo (filter->display, filter->fbo, + gst_gl_display_del_fbo (filter->display, filter->fbo, filter->depthbuffer); g_object_unref (filter->display); filter->display = NULL; @@ -197,7 +197,7 @@ gst_gl_filter_start_gl (GstGLDisplay *display, gpointer data) { GstGLFilter *filter = GST_GL_FILTER (data); GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter); - + filter_class->display_init_cb (filter); } @@ -206,7 +206,7 @@ gst_gl_filter_stop_gl (GstGLDisplay *display, gpointer data) { GstGLFilter *filter = GST_GL_FILTER (data); GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter); - + filter_class->display_reset_cb (filter); } @@ -227,12 +227,12 @@ gst_gl_filter_transform_caps (GstBaseTransform* bt, gst_caps_merge_structure (ret, gst_structure_copy (structure)); - if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) + if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) { gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); gst_caps_merge_structure (ret, structure); - } + } else gst_structure_free (structure); @@ -251,7 +251,7 @@ gst_gl_filter_get_unit_size (GstBaseTransform* trans, GstCaps* caps, gint height = 0; ret = gst_gl_buffer_parse_caps (caps, &width, &height); - if (ret) + if (ret) *size = gst_gl_buffer_get_size (width, height); return TRUE; @@ -270,7 +270,7 @@ gst_gl_filter_prepare_output_buffer (GstBaseTransform* trans, if (filter->display == NULL) { GstGLFilterClass* filter_class = GST_GL_FILTER_GET_CLASS (filter); - + filter->display = g_object_ref (gl_inbuf->display); //blocking call, generate a FBO @@ -310,13 +310,13 @@ gst_gl_filter_set_caps (GstBaseTransform* bt, GstCaps* incaps, if (filter_class->set_caps) filter_class->set_caps (filter, incaps, outcaps); - if (!ret) + if (!ret) { GST_DEBUG ("bad caps"); return FALSE; } - GST_ERROR ("set_caps %d %d", filter->width, filter->height); + GST_DEBUG ("set_caps %d %d", filter->width, filter->height); return ret; } @@ -350,13 +350,13 @@ gst_gl_filter_do_transform (GstGLFilter* filter, /* convenience functions to simplify filter development */ void -gst_gl_filter_render_to_target (GstGLFilter *filter, +gst_gl_filter_render_to_target (GstGLFilter *filter, GLuint input, GLuint target, GLCB func, gpointer data) { - gst_gl_display_use_fbo (filter->display, filter->width, filter->height, - filter->fbo, filter->depthbuffer, target, - func, + gst_gl_display_use_fbo (filter->display, filter->width, filter->height, + filter->fbo, filter->depthbuffer, target, + func, filter->width, filter->height, input, 0, filter->width, 0, filter->height, GST_GL_DISPLAY_PROJECTION_ORTHO2D, diff --git a/gst/gl/gstglfilteredge.c b/gst/gl/gstglfilteredge.c deleted file mode 100644 index bbd664d..0000000 --- a/gst/gl/gstglfilteredge.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2008 Julien Isorce - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstglfilteredge.h" - -#define GST_CAT_DEFAULT gst_gl_filter_edge_debug -GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); - -static const GstElementDetails element_details = - GST_ELEMENT_DETAILS ("OpenGL edge filter", - "Filter/Effect", - "Edge detection using GLSL", - "Julien Isorce "); - -enum -{ - PROP_0 -}; - -#define DEBUG_INIT(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_gl_filter_edge_debug, "glfilteredge", 0, "glfilteredge element"); - -GST_BOILERPLATE_FULL (GstGLFilterEdge, gst_gl_filter_edge, GstGLFilter, - GST_TYPE_GL_FILTER, DEBUG_INIT); - -static void gst_gl_filter_edge_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_gl_filter_edge_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static void gst_gl_filter_edge_reset (GstGLFilter* filter); -static void gst_gl_filter_edge_init_shader (GstGLFilter* filter); -static gboolean gst_gl_filter_edge_filter (GstGLFilter * filter, - GstGLBuffer * inbuf, GstGLBuffer * outbuf); -static void gst_gl_filter_edge_callback (gint width, gint height, guint texture, gpointer stuff); - -static const gchar *sobel_fragment_source = - "uniform sampler2DRect tex;\n" - "void main(void) {\n" - " const int N = 8;\n" - " const vec2 delta[N] = vec2[N](\n" - " vec2( -1.0, -1.0 ),\n" - " vec2( -1.0 , 0.0 ),\n" - " vec2( -1.0 , 1.0 ),\n" - " vec2( 0.0 , 1.0 ),\n" - " vec2( 1.0 , 1.0 ),\n" - " vec2( 1.0 , 0.0 ),\n" - " vec2( 1.0 , -1.0 ),\n" - " vec2( 0.0 , -1.0 )\n" - " );\n" - " const float filterH[N] = float[N]\n" - " (-1.0, 0.0, 1.0, 2.0, 1.0, 0.0, -1.0, -2.0);\n" - " const float filterV[N] = float[N]\n" - " (-1.0, -2.0, -1.0, 0.0, 1.0, 2.0, 1.0, 0.0);\n" - " float gH = 0.0;\n" - " float gV = 0.0;\n" - " int i;\n" - " vec2 nxy = gl_TexCoord[0].xy;\n" - " for (i = 0; i < N; i++) {\n" - " vec4 vcolor_i = texture2DRect(tex, nxy + delta[i]);\n" - " float gray_i = (vcolor_i.r + vcolor_i.g + vcolor_i.b) / 3.0;\n" - " gH += gH + filterH[i] * gray_i;\n" - " gV += gV + filterV[i] * gray_i;\n" - " }\n" - " float g = sqrt(gH * gH + gV * gV) / 256.0;\n" - " gl_FragColor = vec4(g, g, g, 1.0);\n" - "}\n"; - -static void -gst_gl_filter_edge_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_set_details (element_class, &element_details); -} - -static void -gst_gl_filter_edge_class_init (GstGLFilterEdgeClass* klass) -{ - GObjectClass* gobject_class; - - gobject_class = (GObjectClass *) klass; - gobject_class->set_property = gst_gl_filter_edge_set_property; - gobject_class->get_property = gst_gl_filter_edge_get_property; - - GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filter_edge_filter; - GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_edge_init_shader; - GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_edge_reset; -} - -static void -gst_gl_filter_edge_init (GstGLFilterEdge* filter, - GstGLFilterEdgeClass* klass) -{ - filter->shader = NULL; -} - -static void -gst_gl_filter_edge_reset (GstGLFilter* filter) -{ - GstGLFilterEdge* edge_filter = GST_GL_FILTER_EDGE(filter); - - //blocking call, wait the opengl thread has destroyed the shader - gst_gl_display_del_shader (filter->display, edge_filter->shader); -} - -static void -gst_gl_filter_edge_set_property (GObject* object, guint prop_id, - const GValue* value, GParamSpec* pspec) -{ - //GstGLFilterEdge *filter = GST_GL_FILTER_EDGE (object); - - switch (prop_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_gl_filter_edge_get_property (GObject* object, guint prop_id, - GValue* value, GParamSpec* pspec) -{ - //GstGLFilterEdge *filter = GST_GL_FILTER_EDGE (object); - - switch (prop_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_gl_filter_edge_init_shader (GstGLFilter* filter) -{ - GstGLFilterEdge* edge_filter = GST_GL_FILTER_EDGE (filter); - - //blocking call, wait the opengl thread has compiled the shader program - gst_gl_display_gen_shader (filter->display, sobel_fragment_source, &edge_filter->shader); -} - -static gboolean -gst_gl_filter_edge_filter (GstGLFilter* filter, GstGLBuffer* inbuf, - GstGLBuffer* outbuf) -{ - gpointer edge_filter = GST_GL_FILTER_EDGE (filter); - - //blocking call, generate a FBO - gst_gl_display_use_fbo (filter->display, filter->width, filter->height, - filter->fbo, filter->depthbuffer, outbuf->texture, gst_gl_filter_edge_callback, - inbuf->width, inbuf->height, inbuf->texture, - 0, filter->width, 0, filter->height, - GST_GL_DISPLAY_PROJECTION_ORTHO2D, edge_filter); - - return TRUE; -} - -//opengl scene, params: input texture (not the output filter->texture) -static void -gst_gl_filter_edge_callback (gint width, gint height, guint texture, gpointer stuff) -{ - GstGLFilterEdge* edge_filter = GST_GL_FILTER_EDGE (stuff); - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - - gst_gl_shader_use (edge_filter->shader); - - glActiveTextureARB(GL_TEXTURE0_ARB); - gst_gl_shader_set_uniform_1i (edge_filter->shader, "tex", 0); - glBindTexture (GL_TEXTURE_RECTANGLE_ARB, texture); - - glBegin (GL_QUADS); - glTexCoord2i (0, 0); - glVertex2f (-1.0f, -1.0f); - glTexCoord2i (width, 0); - glVertex2f (1.0f, -1.0f); - glTexCoord2i (width, height); - glVertex2f (1.0f, 1.0f); - glTexCoord2i (0, height); - glVertex2f (-1.0f, 1.0f); - glEnd (); -} diff --git a/gst/gl/gstglfilteredge.h b/gst/gl/gstglfilteredge.h deleted file mode 100644 index 682e2fe..0000000 --- a/gst/gl/gstglfilteredge.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2008 Julien Isorce - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _GST_GL_FILTEREDGE_H_ -#define _GST_GL_FILTEREDGE_H_ - -#include "gstglfilter.h" - -G_BEGIN_DECLS - -#define GST_TYPE_GL_FILTER_EDGE (gst_gl_filter_edge_get_type()) -#define GST_GL_FILTER_EDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FILTER_EDGE,GstGLFilterEdge)) -#define GST_IS_GL_FILTER_EDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FILTER_EDGE)) -#define GST_GL_FILTER_EDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER_EDGE,GstGLFilterEdgeClass)) -#define GST_IS_GL_FILTER_EDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER_EDGE)) -#define GST_GL_FILTER_EDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER_EDGE,GstGLFilterEdgeClass)) - -typedef struct _GstGLFilterEdge GstGLFilterEdge; -typedef struct _GstGLFilterEdgeClass GstGLFilterEdgeClass; - -struct _GstGLFilterEdge -{ - GstGLFilter filter; - GstGLShader *shader; -}; - -struct _GstGLFilterEdgeClass -{ - GstGLFilterClass filter_class; -}; - -GType gst_gl_glfilteredge_get_type (void); - -G_END_DECLS - -#endif /* _GST_GLFILTEREDGE_H_ */ diff --git a/gst/gl/gstglupload.c b/gst/gl/gstglupload.c index 80ae0bf..caadbd9 100644 --- a/gst/gl/gstglupload.c +++ b/gst/gl/gstglupload.c @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2008 Julien Isorce * @@ -28,7 +28,7 @@ #define GST_CAT_DEFAULT gst_gl_upload_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -static const GstElementDetails element_details = +static const GstElementDetails element_details = GST_ELEMENT_DETAILS ("OpenGL upload", "Filter/Effect", "A from video to GL flow filter", @@ -80,7 +80,7 @@ static void gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection d GstCaps* caps, GstCaps* othercaps); static gboolean gst_gl_upload_start (GstBaseTransform* bt); static gboolean gst_gl_upload_stop (GstBaseTransform* bt); -static GstFlowReturn gst_gl_upload_prepare_output_buffer (GstBaseTransform* trans, +static GstFlowReturn gst_gl_upload_prepare_output_buffer (GstBaseTransform* trans, GstBuffer* input, gint size, GstCaps* caps, GstBuffer** buf); static GstFlowReturn gst_gl_upload_transform (GstBaseTransform* trans, GstBuffer* inbuf, GstBuffer * outbuf); @@ -134,7 +134,7 @@ gst_gl_upload_set_property (GObject* object, guint prop_id, { //GstGLUpload* upload = GST_GL_UPLOAD (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -148,7 +148,7 @@ gst_gl_upload_get_property (GObject* object, guint prop_id, { //GstGLUpload *upload = GST_GL_UPLOAD (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -158,8 +158,8 @@ gst_gl_upload_get_property (GObject* object, guint prop_id, static void gst_gl_upload_reset (GstGLUpload* upload) -{ - if (upload->display) +{ + if (upload->display) { g_object_unref (upload->display); upload->display = NULL; @@ -194,7 +194,7 @@ gst_gl_upload_transform_caps (GstBaseTransform* bt, const GValue* framerate_value = NULL; const GValue* par_value = NULL; - GST_ERROR ("transform caps %" GST_PTR_FORMAT, caps); + GST_DEBUG ("transform caps %" GST_PTR_FORMAT, caps); framerate_value = gst_structure_get_value (structure, "framerate"); par_value = gst_structure_get_value (structure, "pixel-aspect-ratio"); @@ -206,7 +206,7 @@ gst_gl_upload_transform_caps (GstBaseTransform* bt, gst_caps_append(newcaps, newothercaps); } - else + else newcaps = gst_caps_new_simple ("video/x-raw-gl", NULL); structure = gst_structure_copy (gst_caps_get_structure (newcaps, 0)); @@ -214,7 +214,7 @@ gst_gl_upload_transform_caps (GstBaseTransform* bt, gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); - + gst_structure_set_value (structure, "framerate", framerate_value); if (par_value) gst_structure_set_value (structure, "pixel-aspect-ratio", par_value); @@ -224,7 +224,7 @@ gst_gl_upload_transform_caps (GstBaseTransform* bt, gst_caps_merge_structure (newcaps, gst_structure_copy (structure)); - GST_ERROR ("new caps %" GST_PTR_FORMAT, newcaps); + GST_DEBUG ("new caps %" GST_PTR_FORMAT, newcaps); return newcaps; } @@ -250,7 +250,7 @@ gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection direction, to_par = gst_structure_get_value (outs, "pixel-aspect-ratio"); //we have both PAR but they might not be fixated - if (from_par && to_par) + if (from_par && to_par) { gint from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d; @@ -265,7 +265,7 @@ gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection direction, from_par_d = gst_value_get_fraction_denominator (from_par); //fixate the out PAR - if (!gst_value_is_fixed (to_par)) + if (!gst_value_is_fixed (to_par)) { GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", from_par_n, from_par_d); @@ -277,12 +277,12 @@ gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection direction, to_par_d = gst_value_get_fraction_denominator (to_par); //f both width and height are already fixed, we can't do anything - //about it anymore + //about it anymore if (gst_structure_get_int (outs, "width", &w)) ++count; if (gst_structure_get_int (outs, "height", &h)) ++count; - if (count == 2) + if (count == 2) { GST_DEBUG_OBJECT (base, "dimensions already set to %dx%d, not fixating", w, h); @@ -293,7 +293,7 @@ gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection direction, gst_structure_get_int (ins, "height", &from_h); if (!gst_video_calculate_display_ratio (&num, &den, from_w, from_h, - from_par_n, from_par_d, to_par_n, to_par_d)) + from_par_n, from_par_d, to_par_n, to_par_d)) { GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL), ("Error calculating the output scaled size - integer overflow")); @@ -310,35 +310,35 @@ gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection direction, //prefer those that have one of w/h the same as the incoming video //using wd / hd = num / den - //if one of the output width or height is fixed, we work from there - if (h) + //if one of the output width or height is fixed, we work from there + if (h) { GST_DEBUG_OBJECT (base, "height is fixed,scaling width"); w = (guint) gst_util_uint64_scale_int (h, num, den); - } - else if (w) + } + else if (w) { GST_DEBUG_OBJECT (base, "width is fixed, scaling height"); h = (guint) gst_util_uint64_scale_int (w, den, num); - } - else + } + else { //none of width or height is fixed, figure out both of them based only on //the input width and height - //check hd / den is an integer scale factor, and scale wd with the PAR - if (from_h % den == 0) + //check hd / den is an integer scale factor, and scale wd with the PAR + if (from_h % den == 0) { GST_DEBUG_OBJECT (base, "keeping video height"); h = from_h; w = (guint) gst_util_uint64_scale_int (h, num, den); - } - else if (from_w % num == 0) + } + else if (from_w % num == 0) { GST_DEBUG_OBJECT (base, "keeping video width"); w = from_w; h = (guint) gst_util_uint64_scale_int (w, den, num); - } - else + } + else { GST_DEBUG_OBJECT (base, "approximating but keeping video height"); h = from_h; @@ -350,14 +350,14 @@ gst_gl_upload_fixate_caps (GstBaseTransform* base, GstPadDirection direction, //now fixate gst_structure_fixate_field_nearest_int (outs, "width", w); gst_structure_fixate_field_nearest_int (outs, "height", h); - } - else + } + else { gint width, height; - if (gst_structure_get_int (ins, "width", &width)) + if (gst_structure_get_int (ins, "width", &width)) { - if (gst_structure_has_field (outs, "width")) + if (gst_structure_has_field (outs, "width")) gst_structure_fixate_field_nearest_int (outs, "width", width); } if (gst_structure_get_int (ins, "height", &height)) { @@ -387,7 +387,7 @@ gst_gl_upload_set_caps (GstBaseTransform* bt, GstCaps* incaps, ret |= gst_video_format_parse_caps (incaps, &upload->video_format, &upload->video_width, &upload->video_height); - if (!ret) + if (!ret) { GST_DEBUG ("caps connot be parsed"); return FALSE; @@ -395,14 +395,14 @@ gst_gl_upload_set_caps (GstBaseTransform* bt, GstCaps* incaps, //we have video and gl size, we can now init OpenGL stuffs upload->display = gst_gl_display_new (); - + //init unvisible opengl context - gst_gl_display_create_context (upload->display, + gst_gl_display_create_context (upload->display, 50, y_pos++ * (upload->gl_height+50) + 50, upload->gl_width, upload->gl_height, 0, FALSE); //init colorspace conversion if needed - gst_gl_display_init_upload (upload->display, upload->video_format, + gst_gl_display_init_upload (upload->display, upload->video_format, upload->gl_width, upload->gl_height); return ret; @@ -418,18 +418,18 @@ gst_gl_upload_get_unit_size (GstBaseTransform* trans, GstCaps* caps, gint height = 0; structure = gst_caps_get_structure (caps, 0); - if (gst_structure_has_name (structure, "video/x-raw-gl")) + if (gst_structure_has_name (structure, "video/x-raw-gl")) { ret = gst_gl_buffer_parse_caps (caps, &width, &height); - if (ret) + if (ret) *size = gst_gl_buffer_get_size (width, height); - } - else + } + else { GstVideoFormat video_format = GST_VIDEO_FORMAT_UNKNOWN; ret = gst_video_format_parse_caps (caps, &video_format, &width, &height); - if (ret) + if (ret) *size = gst_video_format_get_size (video_format, width, height); } @@ -470,7 +470,7 @@ gst_gl_upload_transform (GstBaseTransform* trans, GstBuffer* inbuf, //Depending on the colorspace, video is upload into several textures. //However, there is only one output texture. The one attached //to the upload FBO. - if (gst_gl_display_do_upload (upload->display, gl_outbuf->texture, + if (gst_gl_display_do_upload (upload->display, gl_outbuf->texture, upload->video_width, upload->video_height, GST_BUFFER_DATA (inbuf))) return GST_FLOW_OK; else -- 2.7.4