saa7134-video.c (0e8025b9f6011a6bd69d01080d584bc95a89d02e) saa7134-video.c (4f996594ceaf6c3f9bc42b40c40b0f7f87b79c86)
1/*
2 *
3 * device driver for philips saa7134 based TV cards
4 * video4linux video interface
5 *
6 * (c) 2001-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 1939 unchanged lines hidden (view full) ---

1948
1949 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1950 crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1951 return -EINVAL;
1952 crop->c = dev->crop_current;
1953 return 0;
1954}
1955
1/*
2 *
3 * device driver for philips saa7134 based TV cards
4 * video4linux video interface
5 *
6 * (c) 2001-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 1939 unchanged lines hidden (view full) ---

1948
1949 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1950 crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1951 return -EINVAL;
1952 crop->c = dev->crop_current;
1953 return 0;
1954}
1955
1956static int saa7134_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
1956static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *crop)
1957{
1958 struct saa7134_fh *fh = f;
1959 struct saa7134_dev *dev = fh->dev;
1960 struct v4l2_rect *b = &dev->crop_bounds;
1957{
1958 struct saa7134_fh *fh = f;
1959 struct saa7134_dev *dev = fh->dev;
1960 struct v4l2_rect *b = &dev->crop_bounds;
1961 struct v4l2_rect *c = &dev->crop_current;
1961
1962 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1963 crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1964 return -EINVAL;
1965 if (crop->c.height < 0)
1966 return -EINVAL;
1967 if (crop->c.width < 0)
1968 return -EINVAL;
1969
1970 if (res_locked(fh->dev, RESOURCE_OVERLAY))
1971 return -EBUSY;
1972 if (res_locked(fh->dev, RESOURCE_VIDEO))
1973 return -EBUSY;
1974
1962
1963 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1964 crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1965 return -EINVAL;
1966 if (crop->c.height < 0)
1967 return -EINVAL;
1968 if (crop->c.width < 0)
1969 return -EINVAL;
1970
1971 if (res_locked(fh->dev, RESOURCE_OVERLAY))
1972 return -EBUSY;
1973 if (res_locked(fh->dev, RESOURCE_VIDEO))
1974 return -EBUSY;
1975
1975 if (crop->c.top < b->top)
1976 crop->c.top = b->top;
1977 if (crop->c.top > b->top + b->height)
1978 crop->c.top = b->top + b->height;
1979 if (crop->c.height > b->top - crop->c.top + b->height)
1980 crop->c.height = b->top - crop->c.top + b->height;
1976 *c = crop->c;
1977 if (c->top < b->top)
1978 c->top = b->top;
1979 if (c->top > b->top + b->height)
1980 c->top = b->top + b->height;
1981 if (c->height > b->top - c->top + b->height)
1982 c->height = b->top - c->top + b->height;
1981
1983
1982 if (crop->c.left < b->left)
1983 crop->c.left = b->left;
1984 if (crop->c.left > b->left + b->width)
1985 crop->c.left = b->left + b->width;
1986 if (crop->c.width > b->left - crop->c.left + b->width)
1987 crop->c.width = b->left - crop->c.left + b->width;
1988
1989 dev->crop_current = crop->c;
1984 if (c->left < b->left)
1985 c->left = b->left;
1986 if (c->left > b->left + b->width)
1987 c->left = b->left + b->width;
1988 if (c->width > b->left - c->left + b->width)
1989 c->width = b->left - c->left + b->width;
1990 return 0;
1991}
1992
1993static int saa7134_g_tuner(struct file *file, void *priv,
1994 struct v4l2_tuner *t)
1995{
1996 struct saa7134_fh *fh = priv;
1997 struct saa7134_dev *dev = fh->dev;

--- 664 unchanged lines hidden ---
1990 return 0;
1991}
1992
1993static int saa7134_g_tuner(struct file *file, void *priv,
1994 struct v4l2_tuner *t)
1995{
1996 struct saa7134_fh *fh = priv;
1997 struct saa7134_dev *dev = fh->dev;

--- 664 unchanged lines hidden ---