diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-05-27 10:11:39 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-05-27 10:11:39 -0300 |
commit | e869f37a082df276cbc412d3f7da04fd3b41fed4 (patch) | |
tree | a4067ce193263515f64018aaec0d618fe5864e86 /linux/drivers/media/video/uvc/uvc_video.c | |
parent | fc06889a7cb90e50621ecaaf22f2f575b5ae6a44 (diff) | |
parent | f8a7ff5ce3d73304b156a0ed39d309050c903a82 (diff) | |
download | mediapointer-dvb-s2-e869f37a082df276cbc412d3f7da04fd3b41fed4.tar.gz mediapointer-dvb-s2-e869f37a082df276cbc412d3f7da04fd3b41fed4.tar.bz2 |
merge: http://linuxtv.org/hg/~awalls/cx18-av-core
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/uvc/uvc_video.c')
-rw-r--r-- | linux/drivers/media/video/uvc/uvc_video.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/linux/drivers/media/video/uvc/uvc_video.c b/linux/drivers/media/video/uvc/uvc_video.c index c5df33de9..07e755ba7 100644 --- a/linux/drivers/media/video/uvc/uvc_video.c +++ b/linux/drivers/media/video/uvc/uvc_video.c @@ -65,7 +65,8 @@ static void uvc_fixup_video_ctrl(struct uvc_video_device *video, struct uvc_streaming_control *ctrl) { struct uvc_format *format; - struct uvc_frame *frame; + struct uvc_frame *frame = NULL; + unsigned int i; if (ctrl->bFormatIndex <= 0 || ctrl->bFormatIndex > video->streaming->nformats) @@ -73,11 +74,15 @@ static void uvc_fixup_video_ctrl(struct uvc_video_device *video, format = &video->streaming->format[ctrl->bFormatIndex - 1]; - if (ctrl->bFrameIndex <= 0 || - ctrl->bFrameIndex > format->nframes) - return; + for (i = 0; i < format->nframes; ++i) { + if (format->frame[i].bFrameIndex == ctrl->bFrameIndex) { + frame = &format->frame[i]; + break; + } + } - frame = &format->frame[ctrl->bFrameIndex - 1]; + if (frame == NULL) + return; if (!(format->flags & UVC_FMT_FLAG_COMPRESSED) || (ctrl->dwMaxVideoFrameSize == 0 && @@ -1093,7 +1098,7 @@ int uvc_video_init(struct uvc_video_device *video) /* Zero bFrameIndex might be correct. Stream-based formats (including * MPEG-2 TS and DV) do not support frames but have a dummy frame * descriptor with bFrameIndex set to zero. If the default frame - * descriptor is not found, use the first avalable frame. + * descriptor is not found, use the first available frame. */ for (i = format->nframes; i > 0; --i) { frame = &format->frame[i-1]; |