diff options
author | Julien Moutte <julien@moutte.net> | 2005-10-24 17:04:01 +0000 |
---|---|---|
committer | Julien Moutte <julien@moutte.net> | 2005-10-24 17:04:01 +0000 |
commit | d69cf5631a422b4b09d830ed04f8bf2f1dfcde89 (patch) | |
tree | 5d2dc6ad80203be4600a1d392eee77f740ffc351 /sys | |
parent | a878cbdfe19145461d8ef49685b35fd9cd8058a6 (diff) |
sys/: Check the caps against our xcontext caps.
Original commit message from CVS:
2005-10-24 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_setcaps):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_setcaps): Check
the caps against our xcontext caps.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ximage/ximagesink.c | 10 | ||||
-rw-r--r-- | sys/xvimage/xvimagesink.c | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 099acfc8..1eafe6c8 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -1053,6 +1053,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps) GstXImageSink *ximagesink; gboolean ret = TRUE; GstStructure *structure; + GstCaps *intersection; const GValue *par; gint new_width, new_height; @@ -1065,6 +1066,15 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps) "sinkconnect possible caps %" GST_PTR_FORMAT " with given caps %" GST_PTR_FORMAT, ximagesink->xcontext->caps, caps); + intersection = gst_caps_intersect (ximagesink->xcontext->caps, caps); + GST_DEBUG_OBJECT (ximagesink, "intersection returned %" GST_PTR_FORMAT, + intersection); + if (gst_caps_is_empty (intersection)) { + return FALSE; + } + + gst_caps_unref (intersection); + structure = gst_caps_get_structure (caps, 0); /* We used to only get the new width and height if we don't diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index e422ed3e..c911afc2 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -1300,6 +1300,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps) { GstXvImageSink *xvimagesink; GstStructure *structure; + GstCaps *intersection; guint32 im_format = 0; gboolean ret; gint video_width, video_height; @@ -1315,6 +1316,15 @@ 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)) { + return FALSE; + } + + 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); |