Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285788
b: refs/heads/master
c: 0e8caac
h: refs/heads/master
v: v3
  • Loading branch information
Tomasz Stanislawski authored and Mauro Carvalho Chehab committed Jan 11, 2012
1 parent b6f84ba commit a274e3a
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dab734ec95168488c4b32632e968ce885a083078
refs/heads/master: 0e8caaceff160ad821c83d798fc03812cb810560
2 changes: 2 additions & 0 deletions trunk/drivers/media/video/v4l2-compat-ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOC_CROPCAP:
case VIDIOC_G_CROP:
case VIDIOC_S_CROP:
case VIDIOC_G_SELECTION:
case VIDIOC_S_SELECTION:
case VIDIOC_G_JPEGCOMP:
case VIDIOC_S_JPEGCOMP:
case VIDIOC_QUERYSTD:
Expand Down
34 changes: 34 additions & 0 deletions trunk/drivers/media/video/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ static const char *v4l2_ioctls[] = {
[_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP",
[_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP",
[_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP",
[_IOC_NR(VIDIOC_G_SELECTION)] = "VIDIOC_G_SELECTION",
[_IOC_NR(VIDIOC_S_SELECTION)] = "VIDIOC_S_SELECTION",
[_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP",
[_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP",
[_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD",
Expand Down Expand Up @@ -1571,6 +1573,38 @@ static long __video_do_ioctl(struct file *file,
ret = ops->vidioc_s_crop(file, fh, p);
break;
}
case VIDIOC_G_SELECTION:
{
struct v4l2_selection *p = arg;

if (!ops->vidioc_g_selection)
break;

dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));

ret = ops->vidioc_g_selection(file, fh, p);
if (!ret)
dbgrect(vfd, "", &p->r);
break;
}
case VIDIOC_S_SELECTION:
{
struct v4l2_selection *p = arg;

if (!ops->vidioc_s_selection)
break;

if (ret_prio) {
ret = ret_prio;
break;
}

dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
dbgrect(vfd, "", &p->r);

ret = ops->vidioc_s_selection(file, fh, p);
break;
}
case VIDIOC_CROPCAP:
{
struct v4l2_cropcap *p = arg;
Expand Down
46 changes: 46 additions & 0 deletions trunk/include/linux/videodev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,48 @@ struct v4l2_crop {
struct v4l2_rect c;
};

/* Hints for adjustments of selection rectangle */
#define V4L2_SEL_FLAG_GE 0x00000001
#define V4L2_SEL_FLAG_LE 0x00000002

/* Selection targets */

/* current cropping area */
#define V4L2_SEL_TGT_CROP_ACTIVE 0
/* default cropping area */
#define V4L2_SEL_TGT_CROP_DEFAULT 1
/* cropping bounds */
#define V4L2_SEL_TGT_CROP_BOUNDS 2
/* current composing area */
#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256
/* default composing area */
#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257
/* composing bounds */
#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258
/* current composing area plus all padding pixels */
#define V4L2_SEL_TGT_COMPOSE_PADDED 259

/**
* struct v4l2_selection - selection info
* @type: buffer type (do not use *_MPLANE types)
* @target: selection target, used to choose one of possible rectangles
* @flags: constraints flags
* @r: coordinates of selection window
* @reserved: for future use, rounds structure size to 64 bytes, set to zero
*
* Hardware may use multiple helper window to process a video stream.
* The structure is used to exchange this selection areas between
* an application and a driver.
*/
struct v4l2_selection {
__u32 type;
__u32 target;
__u32 flags;
struct v4l2_rect r;
__u32 reserved[9];
};


/*
* A N A L O G V I D E O S T A N D A R D
*/
Expand Down Expand Up @@ -2259,6 +2301,10 @@ struct v4l2_create_buffers {
#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)

/* Experimental selection API */
#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)

/* Reminder: when adding new ioctls please add support for them to
drivers/media/video/v4l2-compat-ioctl32.c as well! */

Expand Down
4 changes: 4 additions & 0 deletions trunk/include/media/v4l2-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ struct v4l2_ioctl_ops {
struct v4l2_crop *a);
int (*vidioc_s_crop) (struct file *file, void *fh,
struct v4l2_crop *a);
int (*vidioc_g_selection) (struct file *file, void *fh,
struct v4l2_selection *s);
int (*vidioc_s_selection) (struct file *file, void *fh,
struct v4l2_selection *s);
/* Compression ioctls */
int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
struct v4l2_jpegcompression *a);
Expand Down

0 comments on commit a274e3a

Please sign in to comment.