"%" GST_FOURCC_FORMAT " stride: %d", width, height,
GST_FOURCC_ARGS (pixelformat), v4l2object->bytesperline[0]);
- /* MPEG-TS source cameras don't get their format set for some reason.
- * It looks wrong and we weren't able to track down the reason for that code
- * so it is disabled until someone who has an mpeg-ts camera complains...
- */
-#if 0
- /* Only unconditionally accept mpegts for sources */
- if ((v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
- (pixelformat == GST_MAKE_FOURCC ('M', 'P', 'E', 'G')))
- goto done;
-#endif
-
memset (&format, 0x00, sizeof (struct v4l2_format));
format.type = v4l2object->type;
GST_FOURCC_ARGS (format.fmt.pix.pixelformat),
format.fmt.pix_mp.colorspace, format.fmt.pix_mp.num_planes);
+ /* If no size in caps, use configured size */
+ if (width == 0 && height == 0) {
+ width = format.fmt.pix_mp.width;
+ height = format.fmt.pix_mp.height;
+ }
+
if (format.type != v4l2object->type ||
format.fmt.pix_mp.width != width ||
format.fmt.pix_mp.height != height ||
GST_FOURCC_ARGS (format.fmt.pix.pixelformat),
format.fmt.pix.bytesperline, format.fmt.pix.colorspace);
+ /* If no size in caps, use configured size */
+ if (width == 0 && height == 0) {
+ width = format.fmt.pix_mp.width;
+ height = format.fmt.pix_mp.height;
+ }
+
if (format.type != v4l2object->type ||
format.fmt.pix.width != width ||
format.fmt.pix.height != height ||
for (i = 0; i < gst_caps_get_size (caps); ++i) {
structure = gst_caps_get_structure (caps, i);
- /* We are fixating to a resonable 320x200 resolution
+ /* We are fixating to a reasonable 320x200 resolution
and the maximum framerate resolution for that size */
- gst_structure_fixate_field_nearest_int (structure, "width", 320);
- gst_structure_fixate_field_nearest_int (structure, "height", 200);
- gst_structure_fixate_field_nearest_fraction (structure, "framerate",
- G_MAXINT, 1);
- gst_structure_fixate_field (structure, "format");
+ if (gst_structure_has_field (structure, "width"))
+ gst_structure_fixate_field_nearest_int (structure, "width", 320);
+
+ if (gst_structure_has_field (structure, "height"))
+ gst_structure_fixate_field_nearest_int (structure, "height", 200);
+
+ if (gst_structure_has_field (structure, "framerate"))
+ gst_structure_fixate_field_nearest_fraction (structure, "framerate",
+ G_MAXINT, 1);
+
+ if (gst_structure_has_field (structure, "format"))
+ gst_structure_fixate_field (structure, "format");
}
GST_DEBUG_OBJECT (basesrc, "fixated caps %" GST_PTR_FORMAT, caps);