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.
This commit is contained in:
parent
8690945e35
commit
f5469d42de
@ -1460,7 +1460,6 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
GstXImageSink *ximagesink;
|
GstXImageSink *ximagesink;
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstCaps *intersection;
|
|
||||||
const GValue *par;
|
const GValue *par;
|
||||||
gint new_width, new_height;
|
gint new_width, new_height;
|
||||||
const GValue *fps;
|
const GValue *fps;
|
||||||
@ -1475,15 +1474,8 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
GST_PTR_FORMAT, ximagesink->xcontext->caps, caps);
|
GST_PTR_FORMAT, ximagesink->xcontext->caps, caps);
|
||||||
|
|
||||||
/* We intersect those caps with our template to make sure they are correct */
|
/* We intersect those caps with our template to make sure they are correct */
|
||||||
intersection = gst_caps_intersect (ximagesink->xcontext->caps, caps);
|
if (!gst_caps_can_intersect (ximagesink->xcontext->caps, caps))
|
||||||
GST_DEBUG_OBJECT (ximagesink, "intersection returned %" GST_PTR_FORMAT,
|
goto incompatible_caps;
|
||||||
intersection);
|
|
||||||
if (gst_caps_is_empty (intersection)) {
|
|
||||||
gst_caps_unref (intersection);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_caps_unref (intersection);
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
@ -1554,6 +1546,11 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
incompatible_caps:
|
||||||
|
{
|
||||||
|
GST_ERROR_OBJECT (ximagesink, "caps incompatible");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
wrong_aspect:
|
wrong_aspect:
|
||||||
{
|
{
|
||||||
GST_INFO_OBJECT (ximagesink, "pixel aspect ratio does not match");
|
GST_INFO_OBJECT (ximagesink, "pixel aspect ratio does not match");
|
||||||
|
@ -2039,14 +2039,9 @@ gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
|
|||||||
GstXvImageFormat *format = list->data;
|
GstXvImageFormat *format = list->data;
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
GstCaps *icaps = NULL;
|
if (gst_caps_can_intersect (caps, format->caps)) {
|
||||||
|
|
||||||
icaps = gst_caps_intersect (caps, format->caps);
|
|
||||||
if (!gst_caps_is_empty (icaps)) {
|
|
||||||
gst_caps_unref (icaps);
|
|
||||||
return format->format;
|
return format->format;
|
||||||
}
|
}
|
||||||
gst_caps_unref (icaps);
|
|
||||||
}
|
}
|
||||||
list = g_list_next (list);
|
list = g_list_next (list);
|
||||||
}
|
}
|
||||||
@ -2074,7 +2069,6 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
{
|
{
|
||||||
GstXvImageSink *xvimagesink;
|
GstXvImageSink *xvimagesink;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstCaps *intersection;
|
|
||||||
guint32 im_format = 0;
|
guint32 im_format = 0;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
gint video_width, video_height;
|
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 %"
|
"In setcaps. Possible caps %" GST_PTR_FORMAT ", setting caps %"
|
||||||
GST_PTR_FORMAT, xvimagesink->xcontext->caps, caps);
|
GST_PTR_FORMAT, xvimagesink->xcontext->caps, caps);
|
||||||
|
|
||||||
intersection = gst_caps_intersect (xvimagesink->xcontext->caps, caps);
|
if (!gst_caps_intersect (xvimagesink->xcontext->caps, caps))
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "intersection returned %" GST_PTR_FORMAT,
|
|
||||||
intersection);
|
|
||||||
if (gst_caps_is_empty (intersection))
|
|
||||||
goto incompatible_caps;
|
goto incompatible_caps;
|
||||||
|
|
||||||
gst_caps_unref (intersection);
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
ret = gst_structure_get_int (structure, "width", &video_width);
|
ret = gst_structure_get_int (structure, "width", &video_width);
|
||||||
ret &= gst_structure_get_int (structure, "height", &video_height);
|
ret &= gst_structure_get_int (structure, "height", &video_height);
|
||||||
@ -2242,7 +2231,6 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
incompatible_caps:
|
incompatible_caps:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (xvimagesink, "caps incompatible");
|
GST_ERROR_OBJECT (xvimagesink, "caps incompatible");
|
||||||
gst_caps_unref (intersection);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
incomplete_caps:
|
incomplete_caps:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user