diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-04-14 10:40:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-16 17:10:59 -0400 |
commit | e90878ab151f733b67d725a1e1e5aee04f431ce5 (patch) | |
tree | f262f30c6e54cacd7841eaffe9d8e0ae5b098c10 /drivers/media/pci/cx25821 | |
parent | 0df13d99f7c90e3f96408c0ba425e9fb1e48bbd3 (diff) |
[media] cx25821: add output format ioctls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/pci/cx25821')
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-video.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index dca339183672..70e33b125969 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c | |||
@@ -851,6 +851,48 @@ static int cx25821_vidioc_s_output(struct file *file, void *priv, unsigned int o | |||
851 | return o ? -EINVAL : 0; | 851 | return o ? -EINVAL : 0; |
852 | } | 852 | } |
853 | 853 | ||
854 | static int cx25821_vidioc_try_fmt_vid_out(struct file *file, void *priv, | ||
855 | struct v4l2_format *f) | ||
856 | { | ||
857 | struct cx25821_channel *chan = video_drvdata(file); | ||
858 | struct cx25821_dev *dev = chan->dev; | ||
859 | const struct cx25821_fmt *fmt; | ||
860 | |||
861 | fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); | ||
862 | if (NULL == fmt) | ||
863 | return -EINVAL; | ||
864 | f->fmt.pix.width = 720; | ||
865 | f->fmt.pix.height = (dev->tvnorm & V4L2_STD_625_50) ? 576 : 480; | ||
866 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; | ||
867 | f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3; | ||
868 | f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; | ||
869 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | ||
870 | f->fmt.pix.priv = 0; | ||
871 | return 0; | ||
872 | } | ||
873 | |||
874 | static int vidioc_s_fmt_vid_out(struct file *file, void *priv, | ||
875 | struct v4l2_format *f) | ||
876 | { | ||
877 | struct cx25821_channel *chan = video_drvdata(file); | ||
878 | int err; | ||
879 | |||
880 | err = cx25821_vidioc_try_fmt_vid_out(file, priv, f); | ||
881 | |||
882 | if (0 != err) | ||
883 | return err; | ||
884 | |||
885 | chan->fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); | ||
886 | chan->vidq.field = f->fmt.pix.field; | ||
887 | chan->width = f->fmt.pix.width; | ||
888 | chan->height = f->fmt.pix.height; | ||
889 | if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_Y41P) | ||
890 | chan->pixel_formats = PIXEL_FRMT_411; | ||
891 | else | ||
892 | chan->pixel_formats = PIXEL_FRMT_422; | ||
893 | return 0; | ||
894 | } | ||
895 | |||
854 | static const struct v4l2_ctrl_ops cx25821_ctrl_ops = { | 896 | static const struct v4l2_ctrl_ops cx25821_ctrl_ops = { |
855 | .s_ctrl = cx25821_s_ctrl, | 897 | .s_ctrl = cx25821_s_ctrl, |
856 | }; | 898 | }; |
@@ -905,6 +947,10 @@ static const struct v4l2_file_operations video_out_fops = { | |||
905 | 947 | ||
906 | static const struct v4l2_ioctl_ops video_out_ioctl_ops = { | 948 | static const struct v4l2_ioctl_ops video_out_ioctl_ops = { |
907 | .vidioc_querycap = cx25821_vidioc_querycap, | 949 | .vidioc_querycap = cx25821_vidioc_querycap, |
950 | .vidioc_enum_fmt_vid_out = cx25821_vidioc_enum_fmt_vid_cap, | ||
951 | .vidioc_g_fmt_vid_out = cx25821_vidioc_g_fmt_vid_cap, | ||
952 | .vidioc_try_fmt_vid_out = cx25821_vidioc_try_fmt_vid_out, | ||
953 | .vidioc_s_fmt_vid_out = vidioc_s_fmt_vid_out, | ||
908 | .vidioc_g_std = cx25821_vidioc_g_std, | 954 | .vidioc_g_std = cx25821_vidioc_g_std, |
909 | .vidioc_s_std = cx25821_vidioc_s_std, | 955 | .vidioc_s_std = cx25821_vidioc_s_std, |
910 | .vidioc_enum_output = cx25821_vidioc_enum_output, | 956 | .vidioc_enum_output = cx25821_vidioc_enum_output, |