linux/include/linux/v4l2-subdev.h
<<
>>
Prefs
   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 */
  35enum 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 */
  46struct 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_crop - Pad-level crop settings
  55 * @which: format type (from enum v4l2_subdev_format_whence)
  56 * @pad: pad number, as reported by the media API
  57 * @rect: pad crop rectangle boundaries
  58 */
  59struct v4l2_subdev_crop {
  60        __u32 which;
  61        __u32 pad;
  62        struct v4l2_rect rect;
  63        __u32 reserved[8];
  64};
  65
  66/**
  67 * struct v4l2_subdev_mbus_code_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 */
  72struct v4l2_subdev_mbus_code_enum {
  73        __u32 pad;
  74        __u32 index;
  75        __u32 code;
  76        __u32 reserved[9];
  77};
  78
  79/**
  80 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
  81 * @pad: pad number, as reported by the media API
  82 * @index: format index during enumeration
  83 * @code: format code (from enum v4l2_mbus_pixelcode)
  84 */
  85struct v4l2_subdev_frame_size_enum {
  86        __u32 index;
  87        __u32 pad;
  88        __u32 code;
  89        __u32 min_width;
  90        __u32 max_width;
  91        __u32 min_height;
  92        __u32 max_height;
  93        __u32 reserved[9];
  94};
  95
  96/**
  97 * struct v4l2_subdev_frame_interval - Pad-level frame rate
  98 * @pad: pad number, as reported by the media API
  99 * @interval: frame interval in seconds
 100 */
 101struct v4l2_subdev_frame_interval {
 102        __u32 pad;
 103        struct v4l2_fract interval;
 104        __u32 reserved[9];
 105};
 106
 107/**
 108 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
 109 * @pad: pad number, as reported by the media API
 110 * @index: frame interval index during enumeration
 111 * @code: format code (from enum v4l2_mbus_pixelcode)
 112 * @width: frame width in pixels
 113 * @height: frame height in pixels
 114 * @interval: frame interval in seconds
 115 */
 116struct v4l2_subdev_frame_interval_enum {
 117        __u32 index;
 118        __u32 pad;
 119        __u32 code;
 120        __u32 width;
 121        __u32 height;
 122        struct v4l2_fract interval;
 123        __u32 reserved[9];
 124};
 125
 126#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE                    (1 << 0)
 127#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE                    (1 << 1)
 128#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG                (1 << 2)
 129
 130/* active cropping area */
 131#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL                 0x0000
 132/* cropping bounds */
 133#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS                 0x0002
 134/* current composing area */
 135#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL              0x0100
 136/* composing bounds */
 137#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS              0x0102
 138
 139
 140/**
 141 * struct v4l2_subdev_selection - selection info
 142 *
 143 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
 144 * @pad: pad number, as reported by the media API
 145 * @target: selection target, used to choose one of possible rectangles
 146 * @flags: constraint flags
 147 * @r: coordinates of the selection window
 148 * @reserved: for future use, set to zero for now
 149 *
 150 * Hardware may use multiple helper windows to process a video stream.
 151 * The structure is used to exchange this selection areas between
 152 * an application and a driver.
 153 */
 154struct v4l2_subdev_selection {
 155        __u32 which;
 156        __u32 pad;
 157        __u32 target;
 158        __u32 flags;
 159        struct v4l2_rect r;
 160        __u32 reserved[8];
 161};
 162
 163#define VIDIOC_SUBDEV_G_FMT     _IOWR('V',  4, struct v4l2_subdev_format)
 164#define VIDIOC_SUBDEV_S_FMT     _IOWR('V',  5, struct v4l2_subdev_format)
 165#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
 166                        _IOWR('V', 21, struct v4l2_subdev_frame_interval)
 167#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
 168                        _IOWR('V', 22, struct v4l2_subdev_frame_interval)
 169#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
 170                        _IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
 171#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
 172                        _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
 173#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
 174                        _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
 175#define VIDIOC_SUBDEV_G_CROP    _IOWR('V', 59, struct v4l2_subdev_crop)
 176#define VIDIOC_SUBDEV_S_CROP    _IOWR('V', 60, struct v4l2_subdev_crop)
 177#define VIDIOC_SUBDEV_G_SELECTION \
 178        _IOWR('V', 61, struct v4l2_subdev_selection)
 179#define VIDIOC_SUBDEV_S_SELECTION \
 180        _IOWR('V', 62, struct v4l2_subdev_selection)
 181
 182#endif
 183