auto{audio,video}{src,sink}: use can_intersect to avoid a caps copy

This commit is contained in:
Stefan Kost 2010-05-06 15:38:35 +03:00
parent 0148a230ac
commit 899d03dcc6
4 changed files with 8 additions and 16 deletions

View file

@ -243,7 +243,7 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink)
GSList *errors = NULL; GSList *errors = NULL;
GstBus *bus = gst_bus_new (); GstBus *bus = gst_bus_new ();
GstPad *el_pad = NULL; GstPad *el_pad = NULL;
GstCaps *el_caps = NULL, *intersect = NULL; GstCaps *el_caps = NULL;
gboolean no_match = TRUE; gboolean no_match = TRUE;
list = gst_registry_feature_filter (gst_registry_get_default (), list = gst_registry_feature_filter (gst_registry_get_default (),
@ -273,10 +273,8 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink)
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT, "Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT,
sink->filter_caps, el_caps); sink->filter_caps, el_caps);
intersect = gst_caps_intersect (sink->filter_caps, el_caps); no_match = !gst_caps_can_intersect (sink->filter_caps, el_caps);
no_match = gst_caps_is_empty (intersect);
gst_caps_unref (el_caps); gst_caps_unref (el_caps);
gst_caps_unref (intersect);
if (no_match) { if (no_match) {
GST_DEBUG_OBJECT (sink, "Incompatible caps"); GST_DEBUG_OBJECT (sink, "Incompatible caps");

View file

@ -244,7 +244,7 @@ gst_auto_audio_src_find_best (GstAutoAudioSrc * src)
GSList *errors = NULL; GSList *errors = NULL;
GstBus *bus = gst_bus_new (); GstBus *bus = gst_bus_new ();
GstPad *el_pad = NULL; GstPad *el_pad = NULL;
GstCaps *el_caps = NULL, *intersect = NULL; GstCaps *el_caps = NULL;
gboolean no_match = TRUE; gboolean no_match = TRUE;
list = gst_registry_feature_filter (gst_registry_get_default (), list = gst_registry_feature_filter (gst_registry_get_default (),
@ -274,10 +274,8 @@ gst_auto_audio_src_find_best (GstAutoAudioSrc * src)
GST_DEBUG_OBJECT (src, GST_DEBUG_OBJECT (src,
"Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT, "Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT,
src->filter_caps, el_caps); src->filter_caps, el_caps);
intersect = gst_caps_intersect (src->filter_caps, el_caps); no_match = !gst_caps_can_intersect (src->filter_caps, el_caps);
no_match = gst_caps_is_empty (intersect);
gst_caps_unref (el_caps); gst_caps_unref (el_caps);
gst_caps_unref (intersect);
if (no_match) { if (no_match) {
GST_DEBUG_OBJECT (src, "Incompatible caps"); GST_DEBUG_OBJECT (src, "Incompatible caps");

View file

@ -243,7 +243,7 @@ gst_auto_video_sink_find_best (GstAutoVideoSink * sink)
GSList *errors = NULL; GSList *errors = NULL;
GstBus *bus = gst_bus_new (); GstBus *bus = gst_bus_new ();
GstPad *el_pad = NULL; GstPad *el_pad = NULL;
GstCaps *el_caps = NULL, *intersect = NULL; GstCaps *el_caps = NULL;
gboolean no_match = TRUE; gboolean no_match = TRUE;
list = gst_registry_feature_filter (gst_registry_get_default (), list = gst_registry_feature_filter (gst_registry_get_default (),
@ -270,10 +270,8 @@ gst_auto_video_sink_find_best (GstAutoVideoSink * sink)
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT, "Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT,
sink->filter_caps, el_caps); sink->filter_caps, el_caps);
intersect = gst_caps_intersect (sink->filter_caps, el_caps); no_match = !gst_caps_can_intersect (sink->filter_caps, el_caps);
no_match = gst_caps_is_empty (intersect);
gst_caps_unref (el_caps); gst_caps_unref (el_caps);
gst_caps_unref (intersect);
if (no_match) { if (no_match) {
GST_DEBUG_OBJECT (sink, "Incompatible caps"); GST_DEBUG_OBJECT (sink, "Incompatible caps");

View file

@ -244,7 +244,7 @@ gst_auto_video_src_find_best (GstAutoVideoSrc * src)
GSList *errors = NULL; GSList *errors = NULL;
GstBus *bus = gst_bus_new (); GstBus *bus = gst_bus_new ();
GstPad *el_pad = NULL; GstPad *el_pad = NULL;
GstCaps *el_caps = NULL, *intersect = NULL; GstCaps *el_caps = NULL;
gboolean no_match = TRUE; gboolean no_match = TRUE;
list = gst_registry_feature_filter (gst_registry_get_default (), list = gst_registry_feature_filter (gst_registry_get_default (),
@ -271,10 +271,8 @@ gst_auto_video_src_find_best (GstAutoVideoSrc * src)
GST_DEBUG_OBJECT (src, GST_DEBUG_OBJECT (src,
"Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT, "Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT,
src->filter_caps, el_caps); src->filter_caps, el_caps);
intersect = gst_caps_intersect (src->filter_caps, el_caps); no_match = !gst_caps_can_intersect (src->filter_caps, el_caps);
no_match = gst_caps_is_empty (intersect);
gst_caps_unref (el_caps); gst_caps_unref (el_caps);
gst_caps_unref (intersect);
if (no_match) { if (no_match) {
GST_DEBUG_OBJECT (src, "Incompatible caps"); GST_DEBUG_OBJECT (src, "Incompatible caps");