The C and C++ Include Header Files
/usr/include/linux/media.h
$ cat -n /usr/include/linux/media.h 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * Multimedia device API 4 * 5 * Copyright (C) 2010 Nokia Corporation 6 * 7 * Contacts: Laurent Pinchart
8 * Sakari Ailus
9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 */ 19 20 #ifndef __LINUX_MEDIA_H 21 #define __LINUX_MEDIA_H 22 23 #include
24 #include
25 #include
26 27 struct media_device_info { 28 char driver[16]; 29 char model[32]; 30 char serial[40]; 31 char bus_info[32]; 32 __u32 media_version; 33 __u32 hw_revision; 34 __u32 driver_version; 35 __u32 reserved[31]; 36 }; 37 38 /* 39 * Base number ranges for entity functions 40 * 41 * NOTE: Userspace should not rely on these ranges to identify a group 42 * of function types, as newer functions can be added with any name within 43 * the full u32 range. 44 * 45 * Some older functions use the MEDIA_ENT_F_OLD_*_BASE range. Do not 46 * change this, this is for backwards compatibility. When adding new 47 * functions always use MEDIA_ENT_F_BASE. 48 */ 49 #define MEDIA_ENT_F_BASE 0x00000000 50 #define MEDIA_ENT_F_OLD_BASE 0x00010000 51 #define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000 52 53 /* 54 * Initial value to be used when a new entity is created 55 * Drivers should change it to something useful. 56 */ 57 #define MEDIA_ENT_F_UNKNOWN MEDIA_ENT_F_BASE 58 59 /* 60 * Subdevs are initialized with MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN in order 61 * to preserve backward compatibility. Drivers must change to the proper 62 * subdev type before registering the entity. 63 */ 64 #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE 65 66 /* 67 * DVB entity functions 68 */ 69 #define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 0x00001) 70 #define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 0x00002) 71 #define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 0x00003) 72 #define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 0x00004) 73 74 /* 75 * I/O entity functions 76 */ 77 #define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1) 78 #define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 0x01001) 79 #define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 0x01002) 80 #define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 0x01003) 81 82 /* 83 * Sensor functions 84 */ 85 #define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1) 86 #define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2) 87 #define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3) 88 89 /* 90 * Digital TV, analog TV, radio and/or software defined radio tuner functions. 91 * 92 * It is a responsibility of the master/bridge drivers to add connectors 93 * and links for MEDIA_ENT_F_TUNER. Please notice that some old tuners 94 * may require the usage of separate I2C chips to decode analog TV signals, 95 * when the master/bridge chipset doesn't have its own TV standard decoder. 96 * On such cases, the IF-PLL staging is mapped via one or two entities: 97 * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. 98 */ 99 #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) 100 101 /* 102 * Analog TV IF-PLL decoder functions 103 * 104 * It is a responsibility of the master/bridge drivers to create links 105 * for MEDIA_ENT_F_IF_VID_DECODER and MEDIA_ENT_F_IF_AUD_DECODER. 106 */ 107 #define MEDIA_ENT_F_IF_VID_DECODER (MEDIA_ENT_F_BASE + 0x02001) 108 #define MEDIA_ENT_F_IF_AUD_DECODER (MEDIA_ENT_F_BASE + 0x02002) 109 110 /* 111 * Audio entity functions 112 */ 113 #define MEDIA_ENT_F_AUDIO_CAPTURE (MEDIA_ENT_F_BASE + 0x03001) 114 #define MEDIA_ENT_F_AUDIO_PLAYBACK (MEDIA_ENT_F_BASE + 0x03002) 115 #define MEDIA_ENT_F_AUDIO_MIXER (MEDIA_ENT_F_BASE + 0x03003) 116 117 /* 118 * Processing entity functions 119 */ 120 #define MEDIA_ENT_F_PROC_VIDEO_COMPOSER (MEDIA_ENT_F_BASE + 0x4001) 121 #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER (MEDIA_ENT_F_BASE + 0x4002) 122 #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV (MEDIA_ENT_F_BASE + 0x4003) 123 #define MEDIA_ENT_F_PROC_VIDEO_LUT (MEDIA_ENT_F_BASE + 0x4004) 124 #define MEDIA_ENT_F_PROC_VIDEO_SCALER (MEDIA_ENT_F_BASE + 0x4005) 125 #define MEDIA_ENT_F_PROC_VIDEO_STATISTICS (MEDIA_ENT_F_BASE + 0x4006) 126 #define MEDIA_ENT_F_PROC_VIDEO_ENCODER (MEDIA_ENT_F_BASE + 0x4007) 127 #define MEDIA_ENT_F_PROC_VIDEO_DECODER (MEDIA_ENT_F_BASE + 0x4008) 128 #define MEDIA_ENT_F_PROC_VIDEO_ISP (MEDIA_ENT_F_BASE + 0x4009) 129 130 /* 131 * Switch and bridge entity functions 132 */ 133 #define MEDIA_ENT_F_VID_MUX (MEDIA_ENT_F_BASE + 0x5001) 134 #define MEDIA_ENT_F_VID_IF_BRIDGE (MEDIA_ENT_F_BASE + 0x5002) 135 136 /* 137 * Video decoder/encoder functions 138 */ 139 #define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4) 140 #define MEDIA_ENT_F_DV_DECODER (MEDIA_ENT_F_BASE + 0x6001) 141 #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002) 142 143 /* Entity flags */ 144 #define MEDIA_ENT_FL_DEFAULT (1 << 0) 145 #define MEDIA_ENT_FL_CONNECTOR (1 << 1) 146 147 /* OR with the entity id value to find the next entity */ 148 #define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) 149 150 struct media_entity_desc { 151 __u32 id; 152 char name[32]; 153 __u32 type; 154 __u32 revision; 155 __u32 flags; 156 __u32 group_id; 157 __u16 pads; 158 __u16 links; 159 160 __u32 reserved[4]; 161 162 union { 163 /* Node specifications */ 164 struct { 165 __u32 major; 166 __u32 minor; 167 } dev; 168 169 /* 170 * TODO: this shouldn't have been added without 171 * actual drivers that use this. When the first real driver 172 * appears that sets this information, special attention 173 * should be given whether this information is 1) enough, and 174 * 2) can deal with udev rules that rename devices. The struct 175 * dev would not be sufficient for this since that does not 176 * contain the subdevice information. In addition, struct dev 177 * can only refer to a single device, and not to multiple (e.g. 178 * pcm and mixer devices). 179 */ 180 struct { 181 __u32 card; 182 __u32 device; 183 __u32 subdevice; 184 } alsa; 185 186 /* 187 * DEPRECATED: previous node specifications. Kept just to 188 * avoid breaking compilation. Use media_entity_desc.dev 189 * instead. 190 */ 191 struct { 192 __u32 major; 193 __u32 minor; 194 } v4l; 195 struct { 196 __u32 major; 197 __u32 minor; 198 } fb; 199 int dvb; 200 201 /* Sub-device specifications */ 202 /* Nothing needed yet */ 203 __u8 raw[184]; 204 }; 205 }; 206 207 #define MEDIA_PAD_FL_SINK (1 << 0) 208 #define MEDIA_PAD_FL_SOURCE (1 << 1) 209 #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) 210 211 struct media_pad_desc { 212 __u32 entity; /* entity ID */ 213 __u16 index; /* pad index */ 214 __u32 flags; /* pad flags */ 215 __u32 reserved[2]; 216 }; 217 218 #define MEDIA_LNK_FL_ENABLED (1 << 0) 219 #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) 220 #define MEDIA_LNK_FL_DYNAMIC (1 << 2) 221 222 #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) 223 # define MEDIA_LNK_FL_DATA_LINK (0 << 28) 224 # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) 225 226 struct media_link_desc { 227 struct media_pad_desc source; 228 struct media_pad_desc sink; 229 __u32 flags; 230 __u32 reserved[2]; 231 }; 232 233 struct media_links_enum { 234 __u32 entity; 235 /* Should have enough room for pads elements */ 236 struct media_pad_desc *pads; 237 /* Should have enough room for links elements */ 238 struct media_link_desc *links; 239 __u32 reserved[4]; 240 }; 241 242 /* Interface type ranges */ 243 244 #define MEDIA_INTF_T_DVB_BASE 0x00000100 245 #define MEDIA_INTF_T_V4L_BASE 0x00000200 246 247 /* Interface types */ 248 249 #define MEDIA_INTF_T_DVB_FE (MEDIA_INTF_T_DVB_BASE) 250 #define MEDIA_INTF_T_DVB_DEMUX (MEDIA_INTF_T_DVB_BASE + 1) 251 #define MEDIA_INTF_T_DVB_DVR (MEDIA_INTF_T_DVB_BASE + 2) 252 #define MEDIA_INTF_T_DVB_CA (MEDIA_INTF_T_DVB_BASE + 3) 253 #define MEDIA_INTF_T_DVB_NET (MEDIA_INTF_T_DVB_BASE + 4) 254 255 #define MEDIA_INTF_T_V4L_VIDEO (MEDIA_INTF_T_V4L_BASE) 256 #define MEDIA_INTF_T_V4L_VBI (MEDIA_INTF_T_V4L_BASE + 1) 257 #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) 258 #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) 259 #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) 260 #define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) 261 262 #define MEDIA_INTF_T_ALSA_BASE 0x00000300 263 #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) 264 #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) 265 #define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2) 266 267 268 /* 269 * MC next gen API definitions 270 */ 271 272 /* 273 * Appeared in 4.19.0. 274 * 275 * The media_version argument comes from the media_version field in 276 * struct media_device_info. 277 */ 278 #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ 279 ((media_version) >= ((4 << 16) | (19 << 8) | 0)) 280 281 struct media_v2_entity { 282 __u32 id; 283 char name[64]; 284 __u32 function; /* Main function of the entity */ 285 __u32 flags; 286 __u32 reserved[5]; 287 } __attribute__ ((packed)); 288 289 /* Should match the specific fields at media_intf_devnode */ 290 struct media_v2_intf_devnode { 291 __u32 major; 292 __u32 minor; 293 } __attribute__ ((packed)); 294 295 struct media_v2_interface { 296 __u32 id; 297 __u32 intf_type; 298 __u32 flags; 299 __u32 reserved[9]; 300 301 union { 302 struct media_v2_intf_devnode devnode; 303 __u32 raw[16]; 304 }; 305 } __attribute__ ((packed)); 306 307 /* 308 * Appeared in 4.19.0. 309 * 310 * The media_version argument comes from the media_version field in 311 * struct media_device_info. 312 */ 313 #define MEDIA_V2_PAD_HAS_INDEX(media_version) \ 314 ((media_version) >= ((4 << 16) | (19 << 8) | 0)) 315 316 struct media_v2_pad { 317 __u32 id; 318 __u32 entity_id; 319 __u32 flags; 320 __u32 index; 321 __u32 reserved[4]; 322 } __attribute__ ((packed)); 323 324 struct media_v2_link { 325 __u32 id; 326 __u32 source_id; 327 __u32 sink_id; 328 __u32 flags; 329 __u32 reserved[6]; 330 } __attribute__ ((packed)); 331 332 struct media_v2_topology { 333 __u64 topology_version; 334 335 __u32 num_entities; 336 __u32 reserved1; 337 __u64 ptr_entities; 338 339 __u32 num_interfaces; 340 __u32 reserved2; 341 __u64 ptr_interfaces; 342 343 __u32 num_pads; 344 __u32 reserved3; 345 __u64 ptr_pads; 346 347 __u32 num_links; 348 __u32 reserved4; 349 __u64 ptr_links; 350 } __attribute__ ((packed)); 351 352 /* ioctls */ 353 354 #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) 355 #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) 356 #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) 357 #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) 358 #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) 359 #define MEDIA_IOC_REQUEST_ALLOC _IOR ('|', 0x05, int) 360 361 /* 362 * These ioctls are called on the request file descriptor as returned 363 * by MEDIA_IOC_REQUEST_ALLOC. 364 */ 365 #define MEDIA_REQUEST_IOC_QUEUE _IO('|', 0x80) 366 #define MEDIA_REQUEST_IOC_REINIT _IO('|', 0x81) 367 368 369 /* 370 * Legacy symbols used to avoid userspace compilation breakages. 371 * Do not use any of this in new applications! 372 * 373 * Those symbols map the entity function into types and should be 374 * used only on legacy programs for legacy hardware. Don't rely 375 * on those for MEDIA_IOC_G_TOPOLOGY. 376 */ 377 #define MEDIA_ENT_TYPE_SHIFT 16 378 #define MEDIA_ENT_TYPE_MASK 0x00ff0000 379 #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff 380 381 #define MEDIA_ENT_T_DEVNODE_UNKNOWN (MEDIA_ENT_F_OLD_BASE | \ 382 MEDIA_ENT_SUBTYPE_MASK) 383 384 #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE 385 #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L 386 #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_F_OLD_BASE + 2) 387 #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_F_OLD_BASE + 3) 388 #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_F_OLD_BASE + 4) 389 390 #define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN 391 #define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L 392 #define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN 393 #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR 394 #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH 395 #define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS 396 #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER 397 #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER 398 399 #define MEDIA_ENT_F_DTV_DECODER MEDIA_ENT_F_DV_DECODER 400 401 /* 402 * There is still no full ALSA support in the media controller. These 403 * defines should not have been added and we leave them here only 404 * in case some application tries to use these defines. 405 * 406 * The ALSA defines that are in use have been moved into __KERNEL__ 407 * scope. As support gets added to these interface types, they should 408 * be moved into __KERNEL__ scope with the code that uses them. 409 */ 410 #define MEDIA_INTF_T_ALSA_COMPRESS (MEDIA_INTF_T_ALSA_BASE + 3) 411 #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4) 412 #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5) 413 #define MEDIA_INTF_T_ALSA_SEQUENCER (MEDIA_INTF_T_ALSA_BASE + 6) 414 #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) 415 416 /* Obsolete symbol for media_version, no longer used in the kernel */ 417 #define MEDIA_API_VERSION ((0 << 16) | (1 << 8) | 0) 418 419 420 #endif /* __LINUX_MEDIA_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2024 MyWebUniversity.com ™