summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-04-20 15:44:18 +0200
committerBenjamin Otte <otte@redhat.com>2010-04-20 15:44:18 +0200
commit6d5cbb6526ed1faf7ff382adb3f41839ef8971ed (patch)
tree8e53c0d6796e6a51da1611a4cc43064e610ac081
parentb368cf710f261ea9c60bd33a6cddd98d24db9c7d (diff)
Make sure non-cairo buffers work for surface-type==0 again
-rw-r--r--gst-libs/gst/cairo/gstcairobuffer.c3
-rw-r--r--gst-libs/gst/cairo/gstcairocaps.h3
-rw-r--r--gst-libs/gst/cairo/gstcairocaps2format.h4
-rw-r--r--gst-libs/gst/cairo/gstcairoformat.c10
4 files changed, 13 insertions, 7 deletions
diff --git a/gst-libs/gst/cairo/gstcairobuffer.c b/gst-libs/gst/cairo/gstcairobuffer.c
index b110705..0d8df7b 100644
--- a/gst-libs/gst/cairo/gstcairobuffer.c
+++ b/gst-libs/gst/cairo/gstcairobuffer.c
@@ -171,7 +171,8 @@ gst_cairo_create_surface (GstBuffer * buffer, const GstCairoFormat * format)
int strides[4];
guint i;
- g_return_val_if_fail (!gst_cairo_format_is_native (format), NULL);
+ g_return_val_if_fail (gst_cairo_format_get_surface_type (format) ==
+ CAIRO_SURFACE_TYPE_IMAGE, NULL);
for (i = 0; i < format->n_planes; i++) {
planes[i] = (char *) (data + gst_cairo_format_get_offset (format, i));
diff --git a/gst-libs/gst/cairo/gstcairocaps.h b/gst-libs/gst/cairo/gstcairocaps.h
index 9a959c8..47c2d9b 100644
--- a/gst-libs/gst/cairo/gstcairocaps.h
+++ b/gst-libs/gst/cairo/gstcairocaps.h
@@ -32,7 +32,8 @@ GstCaps * gst_cairo_caps_default (const cairo_surface_typ
GstCaps * gst_cairo_caps_expand (const GstCaps * caps,
GstCairoFormatOption expand);
-GstCaps * gst_cairo_caps_expand_surface_types (GstCaps * caps,
+GstCaps * gst_cairo_caps_expand_for_surface_types (const GstCaps * caps,
+ GstCairoFormatOption expand,
const cairo_surface_type_t * types);
diff --git a/gst-libs/gst/cairo/gstcairocaps2format.h b/gst-libs/gst/cairo/gstcairocaps2format.h
index 9fc39ce..4e9fdf7 100644
--- a/gst-libs/gst/cairo/gstcairocaps2format.h
+++ b/gst-libs/gst/cairo/gstcairocaps2format.h
@@ -25,9 +25,9 @@
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-GST_CAIRO_CAPS_FORMAT (-1, CAIRO_COLOR_SPACE_ARGB, 1, GST_VIDEO_FORMAT_BGRA, "video/x-cairo, surface-type = [0, MAX], width = " GST_VIDEO_SIZE_RANGE ", height = " GST_VIDEO_SIZE_RANGE ", framerate = " GST_VIDEO_FPS_RANGE)
+GST_CAIRO_CAPS_FORMAT (CAIRO_FORMAT_INVALID, CAIRO_COLOR_SPACE_ARGB, 1, GST_VIDEO_FORMAT_BGRA, "video/x-cairo, surface-type = [0, MAX], width = " GST_VIDEO_SIZE_RANGE ", height = " GST_VIDEO_SIZE_RANGE ", framerate = " GST_VIDEO_FPS_RANGE)
#else
-GST_CAIRO_CAPS_FORMAT (-1, CAIRO_COLOR_SPACE_ARGB, 1, GST_VIDEO_FORMAT_ARGB, "video/x-cairo, surface-type = [0, MAX], width = " GST_VIDEO_SIZE_RANGE ", height = " GST_VIDEO_SIZE_RANGE ", framerate = " GST_VIDEO_FPS_RANGE)
+GST_CAIRO_CAPS_FORMAT (CAIRO_FORMAT_INVALID, CAIRO_COLOR_SPACE_ARGB, 1, GST_VIDEO_FORMAT_ARGB, "video/x-cairo, surface-type = [0, MAX], width = " GST_VIDEO_SIZE_RANGE ", height = " GST_VIDEO_SIZE_RANGE ", framerate = " GST_VIDEO_FPS_RANGE)
#endif
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
diff --git a/gst-libs/gst/cairo/gstcairoformat.c b/gst-libs/gst/cairo/gstcairoformat.c
index 68a6f7a..679849f 100644
--- a/gst-libs/gst/cairo/gstcairoformat.c
+++ b/gst-libs/gst/cairo/gstcairoformat.c
@@ -192,7 +192,7 @@ gst_cairo_format_free (GstCairoFormat * format)
gboolean
gst_cairo_format_is_native (const GstCairoFormat * format)
{
- return format->format == -1;
+ return format->format == CAIRO_FORMAT_INVALID;
}
/**
@@ -398,13 +398,13 @@ gst_cairo_format_get_offset (const GstCairoFormat * format, guint plane)
case CAIRO_FORMAT_PACKED_YVYU:
case CAIRO_FORMAT_PACKED_UYVY:
case CAIRO_FORMAT_PACKED_VYUY:
+ case CAIRO_FORMAT_INVALID:
return 0;
case CAIRO_FORMAT_PLANAR_444:
case CAIRO_FORMAT_PLANAR_422:
case CAIRO_FORMAT_PLANAR_420:
return gst_video_format_get_component_offset (format->video_format,
plane, format->width, format->height);
- case CAIRO_FORMAT_INVALID:
default:
g_assert_not_reached ();
return 0;
@@ -440,7 +440,11 @@ gst_cairo_format_get_stride (const GstCairoFormat * format, guint plane)
cairo_format_t
gst_cairo_format_get_cairo_format (const GstCairoFormat * format)
{
- return format->format;
+ if (format->format == CAIRO_FORMAT_INVALID &&
+ format->surface_type == CAIRO_SURFACE_TYPE_IMAGE)
+ return CAIRO_FORMAT_ARGB32;
+ else
+ return format->format;
}
cairo_color_space_t