Lines Matching defs:stream
211 static int uvc_v4l2_try_format(struct uvc_streaming *stream,
225 if (fmt->type != stream->type)
229 uvc_dbg(stream->dev, FORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u\n",
238 for (i = 0; i < stream->nformats; ++i) {
239 format = &stream->formats[i];
244 if (i == stream->nformats) {
245 format = stream->def_format;
274 uvc_dbg(stream->dev, FORMAT, "Unsupported size %ux%u\n",
281 uvc_dbg(stream->dev, FORMAT,
305 mutex_lock(&stream->mutex);
306 if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS)
308 stream->ctrl.dwMaxVideoFrameSize;
311 ret = uvc_probe_video(stream, probe);
312 mutex_unlock(&stream->mutex);
322 for (i = 0; i < stream->nformats; ++i) {
323 if (probe->bFormatIndex == stream->formats[i].index) {
324 format = &stream->formats[i];
329 if (i == stream->nformats)
330 uvc_dbg(stream->dev, FORMAT,
342 uvc_dbg(stream->dev, FORMAT,
364 static int uvc_v4l2_get_format(struct uvc_streaming *stream,
371 if (fmt->type != stream->type)
374 mutex_lock(&stream->mutex);
375 format = stream->cur_format;
376 frame = stream->cur_frame;
388 fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize;
394 mutex_unlock(&stream->mutex);
398 static int uvc_v4l2_set_format(struct uvc_streaming *stream,
406 if (fmt->type != stream->type)
409 ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame);
413 mutex_lock(&stream->mutex);
415 if (uvc_queue_allocated(&stream->queue)) {
420 stream->ctrl = probe;
421 stream->cur_format = format;
422 stream->cur_frame = frame;
425 mutex_unlock(&stream->mutex);
429 static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream,
434 if (parm->type != stream->type)
437 mutex_lock(&stream->mutex);
438 numerator = stream->ctrl.dwFrameInterval;
439 mutex_unlock(&stream->mutex);
445 parm->type = stream->type;
447 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
464 static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
475 if (parm->type != stream->type)
485 uvc_dbg(stream->dev, FORMAT, "Setting frame interval to %u/%u (%u)\n",
488 mutex_lock(&stream->mutex);
490 if (uvc_queue_streaming(&stream->queue)) {
491 mutex_unlock(&stream->mutex);
495 format = stream->cur_format;
496 frame = stream->cur_frame;
497 probe = stream->ctrl;
505 if (&format->frames[i] == stream->cur_frame)
508 if (format->frames[i].wWidth != stream->cur_frame->wWidth ||
509 format->frames[i].wHeight != stream->cur_frame->wHeight)
524 ret = uvc_probe_video(stream, &probe);
526 mutex_unlock(&stream->mutex);
530 stream->ctrl = probe;
531 stream->cur_frame = frame;
532 mutex_unlock(&stream->mutex);
585 if (atomic_inc_return(&handle->stream->active) != 1) {
586 atomic_dec(&handle->stream->active);
597 atomic_dec(&handle->stream->active);
613 struct uvc_streaming *stream;
617 stream = video_drvdata(file);
618 uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
620 ret = usb_autopm_get_interface(stream->dev->intf);
627 usb_autopm_put_interface(stream->dev->intf);
631 mutex_lock(&stream->dev->lock);
632 if (stream->dev->users == 0) {
633 ret = uvc_status_start(stream->dev, GFP_KERNEL);
635 mutex_unlock(&stream->dev->lock);
636 usb_autopm_put_interface(stream->dev->intf);
642 stream->dev->users++;
643 mutex_unlock(&stream->dev->lock);
645 v4l2_fh_init(&handle->vfh, &stream->vdev);
647 handle->chain = stream->chain;
648 handle->stream = stream;
658 struct uvc_streaming *stream = handle->stream;
660 uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
664 uvc_queue_release(&stream->queue);
673 mutex_lock(&stream->dev->lock);
674 if (--stream->dev->users == 0)
675 uvc_status_stop(stream->dev);
676 mutex_unlock(&stream->dev->lock);
678 usb_autopm_put_interface(stream->dev->intf);
687 struct uvc_streaming *stream = handle->stream;
690 strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card));
691 usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));
698 static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream,
705 if (fmt->type != stream->type || fmt->index >= stream->nformats)
712 format = &stream->formats[fmt->index];
724 struct uvc_streaming *stream = handle->stream;
726 return uvc_ioctl_enum_fmt(stream, fmt);
733 struct uvc_streaming *stream = handle->stream;
735 return uvc_ioctl_enum_fmt(stream, fmt);
742 struct uvc_streaming *stream = handle->stream;
744 return uvc_v4l2_get_format(stream, fmt);
751 struct uvc_streaming *stream = handle->stream;
753 return uvc_v4l2_get_format(stream, fmt);
760 struct uvc_streaming *stream = handle->stream;
767 return uvc_v4l2_set_format(stream, fmt);
774 struct uvc_streaming *stream = handle->stream;
781 return uvc_v4l2_set_format(stream, fmt);
788 struct uvc_streaming *stream = handle->stream;
791 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL);
798 struct uvc_streaming *stream = handle->stream;
801 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL);
808 struct uvc_streaming *stream = handle->stream;
815 mutex_lock(&stream->mutex);
816 ret = uvc_request_buffers(&stream->queue, rb);
817 mutex_unlock(&stream->mutex);
831 struct uvc_streaming *stream = handle->stream;
836 return uvc_query_buffer(&stream->queue, buf);
842 struct uvc_streaming *stream = handle->stream;
847 return uvc_queue_buffer(&stream->queue,
848 stream->vdev.v4l2_dev->mdev, buf);
855 struct uvc_streaming *stream = handle->stream;
860 return uvc_export_buffer(&stream->queue, exp);
866 struct uvc_streaming *stream = handle->stream;
871 return uvc_dequeue_buffer(&stream->queue, buf,
879 struct uvc_streaming *stream = handle->stream;
886 return uvc_create_buffers(&stream->queue, cb);
893 struct uvc_streaming *stream = handle->stream;
899 mutex_lock(&stream->mutex);
900 ret = uvc_queue_streamon(&stream->queue, type);
901 mutex_unlock(&stream->mutex);
910 struct uvc_streaming *stream = handle->stream;
915 mutex_lock(&stream->mutex);
916 uvc_queue_streamoff(&stream->queue, type);
917 mutex_unlock(&stream->mutex);
1195 struct uvc_streaming *stream = handle->stream;
1197 if (sel->type != stream->type)
1203 if (stream->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1208 if (stream->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
1217 mutex_lock(&stream->mutex);
1218 sel->r.width = stream->cur_frame->wWidth;
1219 sel->r.height = stream->cur_frame->wHeight;
1220 mutex_unlock(&stream->mutex);
1229 struct uvc_streaming *stream = handle->stream;
1231 return uvc_v4l2_get_streamparm(stream, parm);
1238 struct uvc_streaming *stream = handle->stream;
1245 return uvc_v4l2_set_streamparm(stream, parm);
1252 struct uvc_streaming *stream = handle->stream;
1259 for (i = 0; i < stream->nformats; i++) {
1260 if (stream->formats[i].fcc == fsize->pixel_format) {
1261 format = &stream->formats[i];
1292 struct uvc_streaming *stream = handle->stream;
1300 for (i = 0; i < stream->nformats; i++) {
1301 if (stream->formats[i].fcc == fival->pixel_format) {
1302 format = &stream->formats[i];
1515 struct uvc_streaming *stream = handle->stream;
1517 uvc_dbg(stream->dev, CALLS, "%s: not implemented\n", __func__);
1524 struct uvc_streaming *stream = handle->stream;
1526 uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
1528 return uvc_queue_mmap(&stream->queue, vma);
1534 struct uvc_streaming *stream = handle->stream;
1536 uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
1538 return uvc_queue_poll(&stream->queue, file, wait);
1547 struct uvc_streaming *stream = handle->stream;
1549 uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
1551 return uvc_queue_get_unmapped_area(&stream->queue, pgoff);