Fix height/width caps negotiation

Original commit message from CVS:
Fix height/width caps negotiation
This commit is contained in:
David Schleef 2003-04-17 07:34:18 +00:00
parent b3c728ed0d
commit 7d7d7df539

View file

@ -149,8 +149,6 @@ gst_videotestsrc_srcconnect (GstPad * pad, GstCaps * caps)
GST_DEBUG (0, "gst_videotestsrc_srcconnect"); GST_DEBUG (0, "gst_videotestsrc_srcconnect");
videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad)); videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
gst_caps_debug(caps,"moo");
videotestsrc->fourcc = paintinfo_find_by_caps(caps); videotestsrc->fourcc = paintinfo_find_by_caps(caps);
if(!videotestsrc->fourcc){ if(!videotestsrc->fourcc){
return GST_PAD_LINK_DELAYED; return GST_PAD_LINK_DELAYED;
@ -162,16 +160,8 @@ gst_videotestsrc_srcconnect (GstPad * pad, GstCaps * caps)
gst_caps_get_int (caps, "width", &videotestsrc->width); gst_caps_get_int (caps, "width", &videotestsrc->width);
gst_caps_get_int (caps, "height", &videotestsrc->height); gst_caps_get_int (caps, "height", &videotestsrc->height);
#if 0
/* FIXME */
if (videotestsrc->forced_format && videotestsrc->format != videotestsrc->forced_format) {
return GST_PAD_LINK_REFUSED;
}
#endif
videotestsrc->make_image = gst_videotestsrc_smpte; videotestsrc->make_image = gst_videotestsrc_smpte;
videotestsrc->make_image = gst_videotestsrc_snow; videotestsrc->make_image = gst_videotestsrc_snow;
/* videotestsrc->make_image = gst_videotestsrc_colors_yuv; */
videotestsrc->bpp = videotestsrc->fourcc->bitspp; videotestsrc->bpp = videotestsrc->fourcc->bitspp;
GST_DEBUG (0, "size %d x %d", videotestsrc->width, videotestsrc->height); GST_DEBUG (0, "size %d x %d", videotestsrc->width, videotestsrc->height);
@ -235,9 +225,15 @@ gst_videotestsrc_getcaps (GstPad * pad, GstCaps * caps)
caps1 = gst_videotestsrc_get_capslist (); caps1 = gst_videotestsrc_get_capslist ();
} }
caps2 = GST_CAPS_NEW("ack","video/raw", if(vts->width){
"width", GST_PROPS_INT (640), caps2 = GST_CAPS_NEW("ack","video/raw",
"height", GST_PROPS_INT (480)); "width",GST_PROPS_INT(vts->width),
"height",GST_PROPS_INT(vts->height));
}else{
caps2 = GST_CAPS_NEW("ack","video/raw",
"width",GST_PROPS_INT_RANGE(16,4096),
"height",GST_PROPS_INT_RANGE(16,4096));
}
return gst_caps_intersect(caps1,caps2); return gst_caps_intersect(caps1,caps2);
} }
@ -249,7 +245,6 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc)
videotestsrc->srcpad = videotestsrc->srcpad =
gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (videotestsrc_src_template_factory), "src"); gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (videotestsrc_src_template_factory), "src");
/*gst_pad_set_negotiate_function(videotestsrc->srcpad,videotestsrc_negotiate_src); */
gst_pad_set_getcaps_function (videotestsrc->srcpad, gst_videotestsrc_getcaps); gst_pad_set_getcaps_function (videotestsrc->srcpad, gst_videotestsrc_getcaps);
gst_element_add_pad (GST_ELEMENT (videotestsrc), videotestsrc->srcpad); gst_element_add_pad (GST_ELEMENT (videotestsrc), videotestsrc->srcpad);
gst_pad_set_get_function (videotestsrc->srcpad, gst_videotestsrc_get); gst_pad_set_get_function (videotestsrc->srcpad, gst_videotestsrc_get);