@@ -103,6 +103,11 @@ static struct uvc_format_desc uvc_fmts[] = {
.guid = UVC_GUID_FORMAT_BY8,
.fcc = V4L2_PIX_FMT_SBGGR8,
},
+ {
+ .name = "MPEG2 TS",
+ .guid = UVC_GUID_FORMAT_MPEG,
+ .fcc = V4L2_PIX_FMT_MPEG,
+ },
};
/* ------------------------------------------------------------------------
@@ -398,6 +403,33 @@ static int uvc_parse_format(struct uvc_device *dev,
break;
case UVC_VS_FORMAT_MPEG2TS:
+ n = dev->uvc_version >= 0x0110 ? 23 : 7;
+ if (buflen < n) {
+ uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
+ "interface %d FORMAT error\n",
+ dev->udev->devnum,
+ alts->desc.bInterfaceNumber);
+ return -EINVAL;
+ }
+
+ strlcpy(format->name, "MPEG2 TS", sizeof format->name);
+ format->fcc = V4L2_PIX_FMT_MPEG;
+ format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
+ format->bpp = 0;
+ ftype = 0;
+
+ /* Create a dummy frame descriptor. */
+ frame = &format->frame[0];
+ memset(&format->frame[0], 0, sizeof format->frame[0]);
+ frame->bFrameIntervalType = 0;
+ frame->dwDefaultFrameInterval = 1;
+ frame->dwFrameInterval = *intervals;
+ *(*intervals)++ = 1;
+ *(*intervals)++ = 10000000;
+ *(*intervals)++ = 1;
+ format->nframes = 1;
+ break;
+
case UVC_VS_FORMAT_STREAM_BASED:
/* Not supported yet. */
default:
@@ -673,6 +705,14 @@ static int uvc_parse_streaming(struct uvc_device *dev,
break;
case UVC_VS_FORMAT_MPEG2TS:
+ /* MPEG2TS format has no frame descriptor. We will create a
+ * dummy frame descriptor with a dummy frame interval range.
+ */
+ nformats++;
+ nframes++;
+ nintervals += 3;
+ break;
+
case UVC_VS_FORMAT_STREAM_BASED:
uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
"interface %d FORMAT %u is not supported.\n",
@@ -724,6 +764,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
switch (buffer[2]) {
case UVC_VS_FORMAT_UNCOMPRESSED:
case UVC_VS_FORMAT_MJPEG:
+ case UVC_VS_FORMAT_MPEG2TS:
case UVC_VS_FORMAT_DV:
case UVC_VS_FORMAT_FRAME_BASED:
format->frame = frame;
@@ -152,6 +152,9 @@ struct uvc_xu_control {
#define UVC_GUID_FORMAT_BY8 \
{ 'B', 'Y', '8', ' ', 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_MPEG \
+ { 'M', 'P', 'E', 'G', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
/* ------------------------------------------------------------------------
* Driver specific constants.