summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2010-05-06 08:15:16 +0300
committerStefan Kost <ensonic@users.sf.net>2010-05-06 08:22:36 +0300
commitf5469d42deb05fcc32f1226ff6c25d9dd978dc43 (patch)
treee02180a8f766e9e1fe47a9e2a759ca06cda4f94e /sys
parent8690945e35001fe640eeb447f9423b9879e37b5d (diff)
x(v)imagesink: use gst_caps_can_intersect() more
In place where we just need to know whether caps intersect, we can use this quicker function.
Diffstat (limited to 'sys')
-rw-r--r--sys/ximage/ximagesink.c17
-rw-r--r--sys/xvimage/xvimagesink.c16
2 files changed, 9 insertions, 24 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c
index e7f489298..58b0d5f59 100644
--- a/sys/ximage/ximagesink.c
+++ b/sys/ximage/ximagesink.c
@@ -1460,7 +1460,6 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GstXImageSink *ximagesink;
gboolean ret = TRUE;
GstStructure *structure;
- GstCaps *intersection;
const GValue *par;
gint new_width, new_height;
const GValue *fps;
@@ -1475,15 +1474,8 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GST_PTR_FORMAT, ximagesink->xcontext->caps, caps);
/* We intersect those caps with our template to make sure they are correct */
- intersection = gst_caps_intersect (ximagesink->xcontext->caps, caps);
- GST_DEBUG_OBJECT (ximagesink, "intersection returned %" GST_PTR_FORMAT,
- intersection);
- if (gst_caps_is_empty (intersection)) {
- gst_caps_unref (intersection);
- return FALSE;
- }
-
- gst_caps_unref (intersection);
+ if (!gst_caps_can_intersect (ximagesink->xcontext->caps, caps))
+ goto incompatible_caps;
structure = gst_caps_get_structure (caps, 0);
@@ -1554,6 +1546,11 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
return TRUE;
/* ERRORS */
+incompatible_caps:
+ {
+ GST_ERROR_OBJECT (ximagesink, "caps incompatible");
+ return FALSE;
+ }
wrong_aspect:
{
GST_INFO_OBJECT (ximagesink, "pixel aspect ratio does not match");
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index f2af4953f..b26dd3e4e 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -2039,14 +2039,9 @@ gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
GstXvImageFormat *format = list->data;
if (format) {
- GstCaps *icaps = NULL;
-
- icaps = gst_caps_intersect (caps, format->caps);
- if (!gst_caps_is_empty (icaps)) {
- gst_caps_unref (icaps);
+ if (gst_caps_can_intersect (caps, format->caps)) {
return format->format;
}
- gst_caps_unref (icaps);
}
list = g_list_next (list);
}
@@ -2074,7 +2069,6 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
{
GstXvImageSink *xvimagesink;
GstStructure *structure;
- GstCaps *intersection;
guint32 im_format = 0;
gboolean ret;
gint video_width, video_height;
@@ -2093,14 +2087,9 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
"In setcaps. Possible caps %" GST_PTR_FORMAT ", setting caps %"
GST_PTR_FORMAT, xvimagesink->xcontext->caps, caps);
- intersection = gst_caps_intersect (xvimagesink->xcontext->caps, caps);
- GST_DEBUG_OBJECT (xvimagesink, "intersection returned %" GST_PTR_FORMAT,
- intersection);
- if (gst_caps_is_empty (intersection))
+ if (!gst_caps_intersect (xvimagesink->xcontext->caps, caps))
goto incompatible_caps;
- gst_caps_unref (intersection);
-
structure = gst_caps_get_structure (caps, 0);
ret = gst_structure_get_int (structure, "width", &video_width);
ret &= gst_structure_get_int (structure, "height", &video_height);
@@ -2242,7 +2231,6 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
incompatible_caps:
{
GST_ERROR_OBJECT (xvimagesink, "caps incompatible");
- gst_caps_unref (intersection);
return FALSE;
}
incomplete_caps: