summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/adder/gstadder.c6
-rw-r--r--gst/videorate/gstvideorate.c18
-rw-r--r--gst/videoscale/gstvideoscale.c4
-rw-r--r--gst/videotestsrc/gstvideotestsrc.c6
4 files changed, 18 insertions, 16 deletions
diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c
index a9de5f4cf..c004c4109 100644
--- a/gst/adder/gstadder.c
+++ b/gst/adder/gstadder.c
@@ -190,10 +190,8 @@ gst_adder_sink_getcaps (GstPad * pad, GstCaps * filter)
/* get the allowed caps on this sinkpad */
sinkcaps = gst_pad_get_current_caps (pad);
if (sinkcaps == NULL) {
- sinkcaps = (GstCaps *) gst_pad_get_pad_template_caps (pad);
- if (sinkcaps)
- gst_caps_ref (sinkcaps);
- else
+ sinkcaps = gst_pad_get_pad_template_caps (pad);
+ if (!sinkcaps)
sinkcaps = gst_caps_new_any ();
}
diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c
index bcdc8d6a9..baffebe2e 100644
--- a/gst/videorate/gstvideorate.c
+++ b/gst/videorate/gstvideorate.c
@@ -233,8 +233,7 @@ static gboolean
gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
GstPad * out_pad, GstCaps ** out_caps, GstCaps * filter)
{
- GstCaps *intersect;
- const GstCaps *in_templ;
+ GstCaps *intersect, *in_templ;
gint i;
GSList *extra_structures = NULL;
GSList *iter;
@@ -242,6 +241,7 @@ gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
in_templ = gst_pad_get_pad_template_caps (in_pad);
intersect =
gst_caps_intersect_full (in_caps, in_templ, GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (in_templ);
/* all possible framerates are allowed */
for (i = 0; i < gst_caps_get_size (intersect); i++) {
@@ -310,12 +310,14 @@ gst_video_rate_getcaps (GstPad * pad, GstCaps * filter)
}
} else {
/* no peer, our padtemplate is enough then */
- if (filter)
- caps =
- gst_caps_intersect_full (filter, gst_pad_get_pad_template_caps (pad),
- GST_CAPS_INTERSECT_FIRST);
- else
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
+ if (filter) {
+ GstCaps *intersection;
+ intersection =
+ gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (caps);
+ caps = intersection;
+ }
}
return caps;
diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c
index 73f764e76..a3c4e08c9 100644
--- a/gst/videoscale/gstvideoscale.c
+++ b/gst/videoscale/gstvideoscale.c
@@ -180,14 +180,14 @@ static GstPadTemplate *
gst_video_scale_src_template_factory (void)
{
return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_caps_ref (gst_video_scale_get_capslist ()));
+ gst_video_scale_get_capslist ());
}
static GstPadTemplate *
gst_video_scale_sink_template_factory (void)
{
return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- gst_caps_ref (gst_video_scale_get_capslist ()));
+ gst_video_scale_get_capslist ());
}
diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c
index c44d46bc2..45cd8b767 100644
--- a/gst/videotestsrc/gstvideotestsrc.c
+++ b/gst/videotestsrc/gstvideotestsrc.c
@@ -172,6 +172,7 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class;
GstPushSrcClass *gstpushsrc_class;
+ GstCaps *templ_caps;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
@@ -296,9 +297,10 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
"Video test source", "Source/Video",
"Creates a test video stream", "David A. Schleef <ds@schleef.org>");
+ templ_caps = gst_video_test_src_getcaps (NULL, NULL);
gst_element_class_add_pad_template (gstelement_class,
- gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_video_test_src_getcaps (NULL, NULL)));
+ gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps));
+ gst_caps_unref (templ_caps);
gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
gstbasesrc_class->set_caps = gst_video_test_src_setcaps;