summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-04-19 21:54:57 +0200
committerBenjamin Otte <otte@redhat.com>2010-04-19 22:03:07 +0200
commita8d00fb971fe988a4e4c4e9d10c11414852e1628 (patch)
tree459d8680c8dd909c9fb9b117f309e8123d3c0e0c
parent3cf1b3f10494308a576f84a483c5c38b1b0014e5 (diff)
Only allocate a buffer if the format doesn't require a specific type
If there's a specified type but that type doesn't provide a buffer, we return an error, currently GST_FLOW_ERROR_NOT_SUPPORTED, but that might change in the future.
-rw-r--r--gst-libs/gst/cairo/gstcairopad.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gst-libs/gst/cairo/gstcairopad.c b/gst-libs/gst/cairo/gstcairopad.c
index 3a0ce71..9cbaadb 100644
--- a/gst-libs/gst/cairo/gstcairopad.c
+++ b/gst-libs/gst/cairo/gstcairopad.c
@@ -162,8 +162,13 @@ gst_cairo_pad_alloc_buffer_full (GstPad * pad,
gst_caps_unref (caps);
}
if (*buffer == NULL) {
- *buffer = gst_cairo_buffer_new (format);
- gst_buffer_set_caps (*buffer, caps);
+ if (gst_cairo_format_get_surface_type (format) == CAIRO_SURFACE_TYPE_IMAGE) {
+ *buffer = gst_cairo_buffer_new (format);
+ gst_buffer_set_caps (*buffer, caps);
+ } else {
+ /* FIXME: get a good error here */
+ ret = GST_FLOW_NOT_SUPPORTED;
+ }
} else if (!gst_cairo_format_is_native (format)) {
/* We need to clear the buffer to keep Cairo's guarantee that new
* surfaces are memset to zero.