static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct stk1160 *dev = video_drvdata(file); struct vb2_queue *q = &dev->vb_vidq; if (vb2_is_busy(q)) return -EBUSY; vidioc_try_fmt_vid_cap(file, priv, f); /* We don't support any format changes */ return 0; }
static int vidioc_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format *f) { struct saa7146_fh *fh = __fh; struct saa7146_dev *dev = fh->dev; struct saa7146_vv *vv = dev->vv_data; int err; DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); if (IS_CAPTURE_ACTIVE(fh) != 0) { DEB_EE(("streaming capture is active\n")); return -EBUSY; } err = vidioc_try_fmt_vid_cap(file, fh, f); if (0 != err) return err; fh->video_fmt = f->fmt.pix; DEB_EE(("set to pixelformat '%4.4s'\n", (char *)&fh->video_fmt.pixelformat)); return 0; }
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct unicorn_fh *fh = priv; struct unicorn_dev *dev = ((struct unicorn_fh *)priv)->dev; int err; if (fh) { err = v4l2_prio_check(&dev->prio, &fh->prio); if (0 != err) { printk(KERN_INFO "%s()v4l2_prio_check fail \n", __func__); return err; } } dprintk_video(1, dev->name, "%s()\n", __func__); if(fh->input == MIRE_VIDEO_INPUT) { dprintk_video(1, dev->name, "%s() MIRE input selected\n", __func__); } else if(dev->sensor[fh->input]==NULL) { printk(KERN_INFO "%s() no device on this input %d \n", __func__,fh->input); return -EINVAL; } err = vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) { printk(KERN_WARNING "%s() vidioc_try_fmt_vid_cap fail\n", __func__); return err; } fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); fh->vidq.field = f->fmt.pix.field; if (fh->fmt->fourcc != V4L2_PIX_FMT_YUYV){ printk(KERN_INFO "%s() expected 0x%x \n", __func__,V4L2_PIX_FMT_YUYV); printk(KERN_INFO "%s()0x%x pixel format not supported \n", __func__,fh->fmt->fourcc); return -EINVAL; } if(fh->input == MIRE_VIDEO_INPUT) { err = 0; } else { err = v4l2_subdev_call(dev->sensor[fh->input], video, s_fmt, f); } fh->width = f->fmt.pix.width; fh->height = f->fmt.pix.height; dprintk_video(1, dev->name, "%s() width=%d height=%d field=%d err=%d\n", __func__, fh->width, fh->height, fh->vidq.field, err); return err; }