gst: Update for caps/pad template related API changes

This commit is contained in:
Sebastian Dröge 2011-05-17 13:04:27 +02:00
parent 5348de76b1
commit a46485e357
4 changed files with 18 additions and 16 deletions

View file

@ -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 ();
}

View file

@ -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;

View file

@ -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 ());
}

View file

@ -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;