linux/include/uapi/linux/media.h
<<
>>
Prefs
   1/*
   2 * Multimedia device 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_MEDIA_H
  24#define __LINUX_MEDIA_H
  25
  26#include <linux/ioctl.h>
  27#include <linux/types.h>
  28#include <linux/version.h>
  29
  30#define MEDIA_API_VERSION       KERNEL_VERSION(0, 1, 0)
  31
  32struct media_device_info {
  33        char driver[16];
  34        char model[32];
  35        char serial[40];
  36        char bus_info[32];
  37        __u32 media_version;
  38        __u32 hw_revision;
  39        __u32 driver_version;
  40        __u32 reserved[31];
  41};
  42
  43#define MEDIA_ENT_ID_FLAG_NEXT          (1 << 31)
  44
  45#define MEDIA_ENT_TYPE_SHIFT            16
  46#define MEDIA_ENT_TYPE_MASK             0x00ff0000
  47#define MEDIA_ENT_SUBTYPE_MASK          0x0000ffff
  48
  49#define MEDIA_ENT_T_DEVNODE             (1 << MEDIA_ENT_TYPE_SHIFT)
  50#define MEDIA_ENT_T_DEVNODE_V4L         (MEDIA_ENT_T_DEVNODE + 1)
  51#define MEDIA_ENT_T_DEVNODE_FB          (MEDIA_ENT_T_DEVNODE + 2)
  52#define MEDIA_ENT_T_DEVNODE_ALSA        (MEDIA_ENT_T_DEVNODE + 3)
  53#define MEDIA_ENT_T_DEVNODE_DVB_FE      (MEDIA_ENT_T_DEVNODE + 4)
  54#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX   (MEDIA_ENT_T_DEVNODE + 5)
  55#define MEDIA_ENT_T_DEVNODE_DVB_DVR     (MEDIA_ENT_T_DEVNODE + 6)
  56#define MEDIA_ENT_T_DEVNODE_DVB_CA      (MEDIA_ENT_T_DEVNODE + 7)
  57#define MEDIA_ENT_T_DEVNODE_DVB_NET     (MEDIA_ENT_T_DEVNODE + 8)
  58
  59/* Legacy symbol. Use it to avoid userspace compilation breakages */
  60#define MEDIA_ENT_T_DEVNODE_DVB         MEDIA_ENT_T_DEVNODE_DVB_FE
  61
  62#define MEDIA_ENT_T_V4L2_SUBDEV         (2 << MEDIA_ENT_TYPE_SHIFT)
  63#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR  (MEDIA_ENT_T_V4L2_SUBDEV + 1)
  64#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH   (MEDIA_ENT_T_V4L2_SUBDEV + 2)
  65#define MEDIA_ENT_T_V4L2_SUBDEV_LENS    (MEDIA_ENT_T_V4L2_SUBDEV + 3)
  66/* A converter of analogue video to its digital representation. */
  67#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4)
  68
  69#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER   (MEDIA_ENT_T_V4L2_SUBDEV + 5)
  70
  71#define MEDIA_ENT_FL_DEFAULT            (1 << 0)
  72
  73struct media_entity_desc {
  74        __u32 id;
  75        char name[32];
  76        __u32 type;
  77        __u32 revision;
  78        __u32 flags;
  79        __u32 group_id;
  80        __u16 pads;
  81        __u16 links;
  82
  83        __u32 reserved[4];
  84
  85        union {
  86                /* Node specifications */
  87                struct {
  88                        __u32 major;
  89                        __u32 minor;
  90                } dev;
  91
  92#if 1
  93                /*
  94                 * TODO: this shouldn't have been added without
  95                 * actual drivers that use this. When the first real driver
  96                 * appears that sets this information, special attention
  97                 * should be given whether this information is 1) enough, and
  98                 * 2) can deal with udev rules that rename devices. The struct
  99                 * dev would not be sufficient for this since that does not
 100                 * contain the subdevice information. In addition, struct dev
 101                 * can only refer to a single device, and not to multiple (e.g.
 102                 * pcm and mixer devices).
 103                 *
 104                 * So for now mark this as a to do.
 105                 */
 106                struct {
 107                        __u32 card;
 108                        __u32 device;
 109                        __u32 subdevice;
 110                } alsa;
 111#endif
 112
 113#if 1
 114                /*
 115                 * DEPRECATED: previous node specifications. Kept just to
 116                 * avoid breaking compilation, but media_entity_desc.dev
 117                 * should be used instead. In particular, alsa and dvb
 118                 * fields below are wrong: for all devnodes, there should
 119                 * be just major/minor inside the struct, as this is enough
 120                 * to represent any devnode, no matter what type.
 121                 */
 122                struct {
 123                        __u32 major;
 124                        __u32 minor;
 125                } v4l;
 126                struct {
 127                        __u32 major;
 128                        __u32 minor;
 129                } fb;
 130                int dvb;
 131#endif
 132
 133                /* Sub-device specifications */
 134                /* Nothing needed yet */
 135                __u8 raw[184];
 136        };
 137};
 138
 139#define MEDIA_PAD_FL_SINK               (1 << 0)
 140#define MEDIA_PAD_FL_SOURCE             (1 << 1)
 141#define MEDIA_PAD_FL_MUST_CONNECT       (1 << 2)
 142
 143struct media_pad_desc {
 144        __u32 entity;           /* entity ID */
 145        __u16 index;            /* pad index */
 146        __u32 flags;            /* pad flags */
 147        __u32 reserved[2];
 148};
 149
 150#define MEDIA_LNK_FL_ENABLED            (1 << 0)
 151#define MEDIA_LNK_FL_IMMUTABLE          (1 << 1)
 152#define MEDIA_LNK_FL_DYNAMIC            (1 << 2)
 153
 154struct media_link_desc {
 155        struct media_pad_desc source;
 156        struct media_pad_desc sink;
 157        __u32 flags;
 158        __u32 reserved[2];
 159};
 160
 161struct media_links_enum {
 162        __u32 entity;
 163        /* Should have enough room for pads elements */
 164        struct media_pad_desc __user *pads;
 165        /* Should have enough room for links elements */
 166        struct media_link_desc __user *links;
 167        __u32 reserved[4];
 168};
 169
 170#define MEDIA_IOC_DEVICE_INFO           _IOWR('|', 0x00, struct media_device_info)
 171#define MEDIA_IOC_ENUM_ENTITIES         _IOWR('|', 0x01, struct media_entity_desc)
 172#define MEDIA_IOC_ENUM_LINKS            _IOWR('|', 0x02, struct media_links_enum)
 173#define MEDIA_IOC_SETUP_LINK            _IOWR('|', 0x03, struct media_link_desc)
 174
 175#endif /* __LINUX_MEDIA_H */
 176