aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index edef2a579617..15cac1812122 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -712,6 +712,7 @@ static int ivtv_debug_ioctls(struct file *filp, unsigned int cmd, void *arg)
712int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void *arg) 712int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void *arg)
713{ 713{
714 struct ivtv_open_id *id = NULL; 714 struct ivtv_open_id *id = NULL;
715 struct yuv_playback_info *yi = &itv->yuv_info;
715 u32 data[CX2341X_MBOX_MAX_DATA]; 716 u32 data[CX2341X_MBOX_MAX_DATA];
716 int streamtype = 0; 717 int streamtype = 0;
717 718
@@ -741,7 +742,8 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
741 742
742 memset(vcap, 0, sizeof(*vcap)); 743 memset(vcap, 0, sizeof(*vcap));
743 strcpy(vcap->driver, IVTV_DRIVER_NAME); /* driver name */ 744 strcpy(vcap->driver, IVTV_DRIVER_NAME); /* driver name */
744 strcpy(vcap->card, itv->card_name); /* card type */ 745 strncpy(vcap->card, itv->card_name,
746 sizeof(vcap->card)-1); /* card type */
745 strcpy(vcap->bus_info, pci_name(itv->dev)); /* bus info... */ 747 strcpy(vcap->bus_info, pci_name(itv->dev)); /* bus info... */
746 vcap->version = IVTV_DRIVER_VERSION; /* version */ 748 vcap->version = IVTV_DRIVER_VERSION; /* version */
747 vcap->capabilities = itv->v4l2_cap; /* capabilities */ 749 vcap->capabilities = itv->v4l2_cap; /* capabilities */
@@ -827,8 +829,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
827 case VIDIOC_CROPCAP: { 829 case VIDIOC_CROPCAP: {
828 struct v4l2_cropcap *cropcap = arg; 830 struct v4l2_cropcap *cropcap = arg;
829 831
830 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && 832 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
831 cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
832 return -EINVAL; 833 return -EINVAL;
833 cropcap->bounds.top = cropcap->bounds.left = 0; 834 cropcap->bounds.top = cropcap->bounds.left = 0;
834 cropcap->bounds.width = 720; 835 cropcap->bounds.width = 720;
@@ -837,8 +838,14 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
837 cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10; 838 cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10;
838 cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11; 839 cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11;
839 } else if (streamtype == IVTV_DEC_STREAM_TYPE_YUV) { 840 } else if (streamtype == IVTV_DEC_STREAM_TYPE_YUV) {
840 cropcap->bounds.width = itv->yuv_info.osd_full_w; 841 if (yi->track_osd) {
841 cropcap->bounds.height = itv->yuv_info.osd_full_h; 842 cropcap->bounds.width = yi->osd_full_w;
843 cropcap->bounds.height = yi->osd_full_h;
844 } else {
845 cropcap->bounds.width = 720;
846 cropcap->bounds.height =
847 itv->is_out_50hz ? 576 : 480;
848 }
842 cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10; 849 cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10;
843 cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11; 850 cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11;
844 } else { 851 } else {
@@ -856,7 +863,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
856 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && 863 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
857 (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { 864 (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
858 if (streamtype == IVTV_DEC_STREAM_TYPE_YUV) { 865 if (streamtype == IVTV_DEC_STREAM_TYPE_YUV) {
859 itv->yuv_info.main_rect = crop->c; 866 yi->main_rect = crop->c;
860 return 0; 867 return 0;
861 } else { 868 } else {
862 if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, 869 if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
@@ -867,9 +874,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
867 } 874 }
868 return -EINVAL; 875 return -EINVAL;
869 } 876 }
870 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 877 return -EINVAL;
871 return -EINVAL;
872 return itv->video_dec_func(itv, VIDIOC_S_CROP, arg);
873 } 878 }
874 879
875 case VIDIOC_G_CROP: { 880 case VIDIOC_G_CROP: {
@@ -878,14 +883,12 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
878 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && 883 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
879 (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { 884 (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
880 if (streamtype == IVTV_DEC_STREAM_TYPE_YUV) 885 if (streamtype == IVTV_DEC_STREAM_TYPE_YUV)
881 crop->c = itv->yuv_info.main_rect; 886 crop->c = yi->main_rect;
882 else 887 else
883 crop->c = itv->main_rect; 888 crop->c = itv->main_rect;
884 return 0; 889 return 0;
885 } 890 }
886 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 891 return -EINVAL;
887 return -EINVAL;
888 return itv->video_dec_func(itv, VIDIOC_G_CROP, arg);
889 } 892 }
890 893
891 case VIDIOC_ENUM_FMT: { 894 case VIDIOC_ENUM_FMT: {
@@ -1070,11 +1073,10 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
1070 itv->main_rect.height = itv->params.height; 1073 itv->main_rect.height = itv->params.height;
1071 ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, 1074 ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
1072 720, itv->main_rect.height, 0, 0); 1075 720, itv->main_rect.height, 0, 0);
1073 itv->yuv_info.main_rect = itv->main_rect; 1076 yi->main_rect = itv->main_rect;
1074 if (!itv->osd_info) { 1077 if (!itv->osd_info) {
1075 itv->yuv_info.osd_full_w = 720; 1078 yi->osd_full_w = 720;
1076 itv->yuv_info.osd_full_h = 1079 yi->osd_full_h = itv->is_out_50hz ? 576 : 480;
1077 itv->is_out_50hz ? 576 : 480;
1078 } 1080 }
1079 } 1081 }
1080 break; 1082 break;
@@ -1272,6 +1274,8 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
1272 else 1274 else
1273 fb->flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA; 1275 fb->flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA;
1274 } 1276 }
1277 if (yi->track_osd)
1278 fb->flags |= V4L2_FBUF_FLAG_OVERLAY;
1275 break; 1279 break;
1276 } 1280 }
1277 1281
@@ -1285,6 +1289,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
1285 (fb->flags & (V4L2_FBUF_FLAG_LOCAL_ALPHA|V4L2_FBUF_FLAG_LOCAL_INV_ALPHA)) != 0; 1289 (fb->flags & (V4L2_FBUF_FLAG_LOCAL_ALPHA|V4L2_FBUF_FLAG_LOCAL_INV_ALPHA)) != 0;
1286 itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0; 1290 itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
1287 ivtv_set_osd_alpha(itv); 1291 ivtv_set_osd_alpha(itv);
1292 yi->track_osd = (fb->flags & V4L2_FBUF_FLAG_OVERLAY) != 0;
1288 break; 1293 break;
1289 } 1294 }
1290 1295
@@ -1628,6 +1633,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
1628 if (ivtv_debug & IVTV_DBGFLG_IOCTL) { 1633 if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
1629 printk(KERN_INFO "ivtv%d ioctl: ", itv->num); 1634 printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
1630 v4l_printk_ioctl(cmd); 1635 v4l_printk_ioctl(cmd);
1636 printk("\n");
1631 } 1637 }
1632 return ivtv_debug_ioctls(filp, cmd, arg); 1638 return ivtv_debug_ioctls(filp, cmd, arg);
1633 1639
@@ -1671,6 +1677,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
1671 if (ivtv_debug & IVTV_DBGFLG_IOCTL) { 1677 if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
1672 printk(KERN_INFO "ivtv%d ioctl: ", itv->num); 1678 printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
1673 v4l_printk_ioctl(cmd); 1679 v4l_printk_ioctl(cmd);
1680 printk("\n");
1674 } 1681 }
1675 return ivtv_v4l2_ioctls(itv, filp, cmd, arg); 1682 return ivtv_v4l2_ioctls(itv, filp, cmd, arg);
1676 1683
@@ -1684,6 +1691,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
1684 if (ivtv_debug & IVTV_DBGFLG_IOCTL) { 1691 if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
1685 printk(KERN_INFO "ivtv%d ioctl: ", itv->num); 1692 printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
1686 v4l_printk_ioctl(cmd); 1693 v4l_printk_ioctl(cmd);
1694 printk("\n");
1687 } 1695 }
1688 return ivtv_control_ioctls(itv, cmd, arg); 1696 return ivtv_control_ioctls(itv, cmd, arg);
1689 1697