diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-03-15 19:26:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 03:53:31 -0400 |
commit | 333c8b97785d5afd5085ba3720b4d259623290f6 (patch) | |
tree | 3cba92af1765957c68f74042dea1873481554ede /include/linux/v4l2-subdev.h | |
parent | d3a7ed99759b18e4fd19b8ddd226f8085b8bd975 (diff) |
[media] v4l: v4l2_subdev userspace format API
Add a userspace API to get, set and enumerate the media format on a
subdev pad.
The format at the output of a subdev usually depends on the format at
its input(s). The try format operation is thus not suitable for probing
format at individual pads, as it can't modify the device state and thus
can't remember the format tried at the input to compute the output
format.
To fix the problem, pass an extra argument to the get/set format
operations to select the 'try' or 'active' format.
The try format is used when probing the subdev. Setting the try format
must not change the device configuration but can store data for later
reuse. Data storage is provided at the file-handle level so applications
probing the subdev concurently won't interfere with each other.
The active format is used when configuring the subdev. It's identical to
the format handled by the usual get/set operations.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/linux/v4l2-subdev.h')
-rw-r--r-- | include/linux/v4l2-subdev.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h new file mode 100644 index 000000000000..8dbb44873821 --- /dev/null +++ b/include/linux/v4l2-subdev.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * V4L2 subdev userspace API | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation | ||
5 | * | ||
6 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
7 | * Sakari Ailus <sakari.ailus@iki.fi> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_V4L2_SUBDEV_H | ||
24 | #define __LINUX_V4L2_SUBDEV_H | ||
25 | |||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/v4l2-mediabus.h> | ||
29 | |||
30 | /** | ||
31 | * enum v4l2_subdev_format_whence - Media bus format type | ||
32 | * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only | ||
33 | * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device | ||
34 | */ | ||
35 | enum v4l2_subdev_format_whence { | ||
36 | V4L2_SUBDEV_FORMAT_TRY = 0, | ||
37 | V4L2_SUBDEV_FORMAT_ACTIVE = 1, | ||
38 | }; | ||
39 | |||
40 | /** | ||
41 | * struct v4l2_subdev_format - Pad-level media bus format | ||
42 | * @which: format type (from enum v4l2_subdev_format_whence) | ||
43 | * @pad: pad number, as reported by the media API | ||
44 | * @format: media bus format (format code and frame size) | ||
45 | */ | ||
46 | struct v4l2_subdev_format { | ||
47 | __u32 which; | ||
48 | __u32 pad; | ||
49 | struct v4l2_mbus_framefmt format; | ||
50 | __u32 reserved[8]; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration | ||
55 | * @pad: pad number, as reported by the media API | ||
56 | * @index: format index during enumeration | ||
57 | * @code: format code (from enum v4l2_mbus_pixelcode) | ||
58 | */ | ||
59 | struct v4l2_subdev_mbus_code_enum { | ||
60 | __u32 pad; | ||
61 | __u32 index; | ||
62 | __u32 code; | ||
63 | __u32 reserved[9]; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * struct v4l2_subdev_frame_size_enum - Media bus format enumeration | ||
68 | * @pad: pad number, as reported by the media API | ||
69 | * @index: format index during enumeration | ||
70 | * @code: format code (from enum v4l2_mbus_pixelcode) | ||
71 | */ | ||
72 | struct v4l2_subdev_frame_size_enum { | ||
73 | __u32 index; | ||
74 | __u32 pad; | ||
75 | __u32 code; | ||
76 | __u32 min_width; | ||
77 | __u32 max_width; | ||
78 | __u32 min_height; | ||
79 | __u32 max_height; | ||
80 | __u32 reserved[9]; | ||
81 | }; | ||
82 | |||
83 | #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) | ||
84 | #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) | ||
85 | #define VIDIOC_SUBDEV_ENUM_MBUS_CODE \ | ||
86 | _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) | ||
87 | #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ | ||
88 | _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) | ||
89 | |||
90 | #endif | ||