aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-11-25 13:37:48 (GMT)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-10-23 13:26:52 (GMT)
commitc3493902c4b473168278d3273965d2c6a168dd1c (patch)
tree05be847e84d1446de38b84ee4675f93821fe735f
parent56285bc44ff1d59168b3e4668bd3d9675ca60ab7 (diff)
uvcvideo: MPEG2-TS supportuvcvideo-wip-mpeg
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--drivers/media/usb/uvc/uvc_driver.c1
-rw-r--r--drivers/media/usb/uvc/uvc_queue.c12
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c4
-rw-r--r--drivers/media/usb/uvc/uvc_video.c2
-rw-r--r--drivers/media/usb/uvc/uvcvideo.h3
5 files changed, 18 insertions, 4 deletions
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 6bee9d9..572415d 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -435,6 +435,7 @@ static int uvc_parse_format(struct uvc_device *dev,
format->fcc = V4L2_PIX_FMT_MPEG;
format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
format->bpp = 0;
+ format->psize = 188;
ftype = 0;
/* Create a dummy frame descriptor. */
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index 18a91fa..b1a973d 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -36,6 +36,16 @@
* the driver.
*/
+unsigned int uvc_queue_frame_size(const struct uvc_format *format,
+ const struct uvc_streaming_control *ctrl)
+{
+ if (!(format->flags & UVC_FMT_FLAG_STREAM) ||
+ (ctrl->bmFramingInfo & UVC_PC_FRAMING_INFO_FID))
+ return ctrl->dwMaxVideoFrameSize;
+ else
+ return format->psize * 500;
+}
+
/* -----------------------------------------------------------------------------
* videobuf2 queue operations
*/
@@ -53,7 +63,7 @@ static int uvc_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
*nplanes = 1;
- sizes[0] = stream->ctrl.dwMaxVideoFrameSize;
+ sizes[0] = uvc_queue_frame_size(stream->cur_format, &stream->ctrl);
return 0;
}
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index d6aa402..0c525c1 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -247,7 +247,7 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
fmt->fmt.pix.height = frame->wHeight;
fmt->fmt.pix.field = V4L2_FIELD_NONE;
fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
- fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize;
+ fmt->fmt.pix.sizeimage = uvc_queue_frame_size(format, probe);
fmt->fmt.pix.colorspace = format->colorspace;
fmt->fmt.pix.priv = 0;
@@ -284,7 +284,7 @@ static int uvc_v4l2_get_format(struct uvc_streaming *stream,
fmt->fmt.pix.height = frame->wHeight;
fmt->fmt.pix.field = V4L2_FIELD_NONE;
fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
- fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize;
+ fmt->fmt.pix.sizeimage = uvc_queue_frame_size(format, &stream->ctrl);
fmt->fmt.pix.colorspace = format->colorspace;
fmt->fmt.pix.priv = 0;
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 4bdad38..e3c388e 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1475,7 +1475,7 @@ static int uvc_init_video_isoc(struct uvc_streaming *stream,
u32 size;
psize = uvc_endpoint_max_bpi(stream->dev->udev, ep);
- size = stream->ctrl.dwMaxVideoFrameSize;
+ size = uvc_queue_frame_size(stream->cur_format, &stream->ctrl);
npackets = uvc_alloc_urb_buffers(stream, size, psize, gfp_flags);
if (npackets == 0)
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index fc0d30f..7d540d8 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -312,6 +312,7 @@ struct uvc_format {
__u8 colorspace;
__u32 fcc;
__u32 flags;
+ __u32 psize;
char name[32];
@@ -641,6 +642,8 @@ static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
{
return vb2_is_streaming(&queue->queue);
}
+unsigned int uvc_queue_frame_size(const struct uvc_format *format,
+ const struct uvc_streaming_control *ctrl);
/* V4L2 interface */
extern const struct v4l2_file_operations uvc_fops;

Privacy Policy