niimaqsrc: Output caps supports both actual bpp and bpp=16

The src caps now have two structures, the first contains the actual bpp of the camera, (10, 12, or 14), and the second has the standard bpp=16. This enables the element to be used both with ffmpegcolorspace (and other elements which only accept bpp=16) but also with our elements like videolevels.
This commit is contained in:
Joshua M. Doe 2010-04-22 14:19:38 -04:00
parent 54ee4258a0
commit bfdbf89aa8

View File

@ -446,9 +446,6 @@ gst_niimaqsrc_init (GstNiImaqSrc * src, GstNiImaqSrcClass * g_class)
/* set source as live (no preroll) */
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
/* force pad to only accept fixed caps */
gst_pad_use_fixed_caps (srcpad);
/* initialize member variables */
src->timestamp_offset = 0;
src->caps = NULL;
@ -830,9 +827,6 @@ gst_niimaqsrc_get_cam_caps (GstNiImaqSrc * src)
rval &= imgGetAttribute (src->iid, IMG_ATTR_ROI_HEIGHT, &val);
height = val;
/* TODO: support both actual bpp and bpp=16 */
bpp = depth;
if (rval) {
GST_ELEMENT_ERROR (src, STREAM, FAILED,
("attempt to read attributes failed"),
@ -857,11 +851,10 @@ gst_niimaqsrc_get_cam_caps (GstNiImaqSrc * src)
/* if (8 < bpp < 16), then append structure with bpp=16 so ffmpegcolorspace
* and other elements can work directly with this src */
/* TODO: support both actual bpp (10,12,14) and 16 */
/*if (bpp > 8) {
if (bpp > 8 && bpp < 16) {
gst_niimaqsrc_set_caps_color (gs, 16, 16);
gst_caps_append_structure (gcaps, gst_structure_copy (gs));
}*/
}
gst_object_unref (gs);
GST_DEBUG_OBJECT (gcaps, "are the camera caps");
@ -929,14 +922,6 @@ gst_niimaqsrc_start (GstBaseSrc * src)
("Failed to get caps from IMAQ"));
goto error;
}
pad = gst_element_get_static_pad (GST_ELEMENT (src), "src");
ret = gst_pad_set_caps (pad, gst_caps_copy (filter->caps));
gst_object_unref (pad);
if (!ret) {
GST_ELEMENT_ERROR (filter, RESOURCE, FAILED, ("Failed set caps to src pad"),
("Failed set caps to src pad"));
goto error;
}
GST_LOG_OBJECT (filter, "Creating ring with %d buffers", filter->bufsize);