diff options
Diffstat (limited to 'sys/v4l2/gstv4l2object.c')
-rw-r--r-- | sys/v4l2/gstv4l2object.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index c3ed4223..ee57d5f6 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -1422,7 +1422,8 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) NULL); break; case V4L2_PIX_FMT_MPEG: /* MPEG */ - structure = gst_structure_new_empty ("video/mpegts"); + structure = gst_structure_new ("video/mpegts", + "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); break; case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */ break; @@ -1935,7 +1936,8 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, guint32 w, h; if (pixelformat == GST_MAKE_FOURCC ('M', 'P', 'E', 'G')) - return gst_caps_new_empty_simple ("video/mpegts"); + return gst_caps_new_simple ("video/mpegts", + "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); memset (&size, 0, sizeof (struct v4l2_frmsizeenum)); size.index = 0; @@ -2365,17 +2367,6 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) GST_V4L2_CHECK_OPEN (v4l2object); GST_V4L2_CHECK_NOT_ACTIVE (v4l2object); - /* 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; @@ -2388,6 +2379,12 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) 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 || @@ -2414,8 +2411,13 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) format.fmt.pix.height, GST_FOURCC_ARGS (format.fmt.pix.pixelformat), format.fmt.pix.bytesperline); - if (format.fmt.pix.width != width || format.fmt.pix.height != height) - goto invalid_dimensions; + /* we set the dimensions just in case but don't validate them afterwards + * For some codecs the dimensions are *not* in the bitstream, IIRC VC1 + * in ASF mode for example. */ + if (info.finfo->format != GST_VIDEO_FORMAT_ENCODED) { + if (format.fmt.pix.width != width || format.fmt.pix.height != height) + goto invalid_dimensions; + } if (format.fmt.pix.pixelformat != pixelformat) goto invalid_pixelformat; |