From 9c52a9cd0993b34d0cf02a8fea4fd39b4e8609c0 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 29 Dec 2007 00:37:41 +0000 Subject: Major cleanup of code. Convert glupload to BaseTransform. Original commit message from CVS: * configure.ac: * sys/glsink/glextensions.c: * sys/glsink/glextensions.h: * sys/glsink/glimagesink.c: * sys/glsink/glimagesink.h: * sys/glsink/gstglbuffer.c: * sys/glsink/gstglbuffer.h: * sys/glsink/gstglconvert.c: * sys/glsink/gstgldisplay.c: * sys/glsink/gstgldisplay.h: * sys/glsink/gstgldownload.c: * sys/glsink/gstglfilter.c: * sys/glsink/gstglfilter.h: * sys/glsink/gstglfilterexample.c: * sys/glsink/gstgltestsrc.c: * sys/glsink/gstglupload.c: Major cleanup of code. Convert glupload to BaseTransform. Handle caps negotiation mostly correctly. Reenable in build. --- sys/glsink/gstgldownload.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'sys/glsink/gstgldownload.c') diff --git a/sys/glsink/gstgldownload.c b/sys/glsink/gstgldownload.c index b5a3f1b2..4c460b9b 100644 --- a/sys/glsink/gstgldownload.c +++ b/sys/glsink/gstgldownload.c @@ -217,6 +217,8 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, download = GST_GL_DOWNLOAD (bt); + GST_ERROR ("transform caps %" GST_PTR_FORMAT, caps); + structure = gst_caps_get_structure (caps, 0); width_value = gst_structure_get_value (structure, "width"); @@ -227,7 +229,9 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, if (direction == GST_PAD_SINK) { newcaps = gst_caps_new_simple ("video/x-raw-rgb", NULL); } else { - newcaps = gst_caps_new_simple ("video/x-raw-gl", NULL); + newcaps = gst_caps_new_simple ("video/x-raw-gl", + "format", G_TYPE_INT, GST_GL_BUFFER_FORMAT_RGBA, + "is_yuv", G_TYPE_BOOLEAN, FALSE, NULL); } newstruct = gst_caps_get_structure (newcaps, 0); gst_structure_set_value (newstruct, "width", width_value); @@ -240,6 +244,8 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, 1, 1, NULL); } + GST_ERROR ("new caps %" GST_PTR_FORMAT, newcaps); + return newcaps; } @@ -258,7 +264,7 @@ gst_gl_download_set_caps (GstBaseTransform * bt, GstCaps * incaps, &download->width, &download->height); if (!ret) { - GST_DEBUG ("bad caps"); + GST_ERROR ("bad caps"); return FALSE; } @@ -271,30 +277,27 @@ gst_gl_download_get_unit_size (GstBaseTransform * trans, GstCaps * caps, { gboolean ret; GstStructure *structure; + int width; + int height; structure = gst_caps_get_structure (caps, 0); if (gst_structure_has_name (structure, "video/x-raw-gl")) { - int width; - int height; - - ret = gst_structure_get_int (structure, "width", &width); - ret &= gst_structure_get_int (structure, "height", &height); + GstGLBufferFormat format; - /* FIXME */ - *size = width * height * 4; + ret = gst_gl_buffer_format_parse_caps (caps, &format, &width, &height); + if (ret) { + *size = gst_gl_buffer_format_get_size (format, width, height); + } } else { - int width; - int height; + GstVideoFormat format; - ret = gst_structure_get_int (structure, "width", &width); - ret &= gst_structure_get_int (structure, "height", &height); - - /* FIXME */ - *size = width * height * 4; + ret = gst_video_format_parse_caps (caps, &format, &width, &height); + if (ret) { + *size = gst_video_format_get_size (format, width, height); + } } - - return TRUE; + return ret; } static GstFlowReturn -- cgit v1.2.1