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 */ /* get the allowed caps on this sinkpad */
sinkcaps = gst_pad_get_current_caps (pad); sinkcaps = gst_pad_get_current_caps (pad);
if (sinkcaps == NULL) { if (sinkcaps == NULL) {
sinkcaps = (GstCaps *) gst_pad_get_pad_template_caps (pad); sinkcaps = gst_pad_get_pad_template_caps (pad);
if (sinkcaps) if (!sinkcaps)
gst_caps_ref (sinkcaps);
else
sinkcaps = gst_caps_new_any (); sinkcaps = gst_caps_new_any ();
} }

View File

@ -233,8 +233,7 @@ static gboolean
gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps, gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
GstPad * out_pad, GstCaps ** out_caps, GstCaps * filter) GstPad * out_pad, GstCaps ** out_caps, GstCaps * filter)
{ {
GstCaps *intersect; GstCaps *intersect, *in_templ;
const GstCaps *in_templ;
gint i; gint i;
GSList *extra_structures = NULL; GSList *extra_structures = NULL;
GSList *iter; 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); in_templ = gst_pad_get_pad_template_caps (in_pad);
intersect = intersect =
gst_caps_intersect_full (in_caps, in_templ, GST_CAPS_INTERSECT_FIRST); gst_caps_intersect_full (in_caps, in_templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (in_templ);
/* all possible framerates are allowed */ /* all possible framerates are allowed */
for (i = 0; i < gst_caps_get_size (intersect); i++) { for (i = 0; i < gst_caps_get_size (intersect); i++) {
@ -310,12 +310,14 @@ gst_video_rate_getcaps (GstPad * pad, GstCaps * filter)
} }
} else { } else {
/* no peer, our padtemplate is enough then */ /* no peer, our padtemplate is enough then */
if (filter) caps = gst_pad_get_pad_template_caps (pad);
caps = if (filter) {
gst_caps_intersect_full (filter, gst_pad_get_pad_template_caps (pad), GstCaps *intersection;
GST_CAPS_INTERSECT_FIRST); intersection =
else gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); gst_caps_unref (caps);
caps = intersection;
}
} }
return caps; return caps;

View File

@ -180,14 +180,14 @@ static GstPadTemplate *
gst_video_scale_src_template_factory (void) gst_video_scale_src_template_factory (void)
{ {
return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, 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 * static GstPadTemplate *
gst_video_scale_sink_template_factory (void) gst_video_scale_sink_template_factory (void)
{ {
return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, 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; GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
GstPushSrcClass *gstpushsrc_class; GstPushSrcClass *gstpushsrc_class;
GstCaps *templ_caps;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
@ -296,9 +297,10 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
"Video test source", "Source/Video", "Video test source", "Source/Video",
"Creates a test video stream", "David A. Schleef <ds@schleef.org>"); "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_element_class_add_pad_template (gstelement_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps));
gst_video_test_src_getcaps (NULL, NULL))); gst_caps_unref (templ_caps);
gstbasesrc_class->get_caps = gst_video_test_src_getcaps; gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
gstbasesrc_class->set_caps = gst_video_test_src_setcaps; gstbasesrc_class->set_caps = gst_video_test_src_setcaps;