home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / Linux / videodev.h < prev    next >
C/C++ Source or Header  |  2002-04-26  |  14KB  |  414 lines

  1. /* $Id: videodev.h,v 1.2 2002/04/26 23:09:17 smilcke Exp $ */
  2.  
  3. #ifndef __LINUX_VIDEODEV_H
  4. #define __LINUX_VIDEODEV_H
  5.  
  6. #include <linux/types.h>
  7. #include <linux/version.h>
  8.  
  9. #ifdef __KERNEL__
  10.  
  11. #include <linux/poll.h>
  12. //#include <linux/devfs_fs_kernel.h>
  13.  
  14. struct video_device
  15. {
  16.     struct module *owner;
  17.     char name[32];
  18.     int type;
  19.     int hardware;
  20.  
  21.     int (*open)(struct video_device *, int mode);
  22.     void (*close)(struct video_device *);
  23.     long (*read)(struct video_device *, char *, unsigned long, int noblock);
  24.     /* Do we need a write method ? */
  25.     long (*write)(struct video_device *, const char *, unsigned long, int noblock);
  26. #if LINUX_VERSION_CODE >= 0x020100
  27.     unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
  28. #endif
  29.     int (*ioctl)(struct video_device *, unsigned int , void *);
  30.     int (*mmap)(struct video_device *, const char *, unsigned long);
  31.     int (*initialize)(struct video_device *);    
  32.     void *priv;        /* Used to be 'private' but that upsets C++ */
  33.     int busy;
  34.     int minor;
  35. #ifdef TARGET_OS2
  36.    char devname[16];
  37. #else
  38.     devfs_handle_t devfs_handle;
  39. #endif
  40. };
  41.  
  42. #define VIDEO_MAJOR    81
  43. #if (defined(TARGET_OS2) && !defined(NOOS2LXAPI))
  44. extern int (*video_register_device)(struct video_device *, int type, int nr);
  45. #else
  46. extern int video_register_device(struct video_device *, int type, int nr);
  47. #endif
  48.  
  49. #define VFL_TYPE_GRABBER    0
  50. #define VFL_TYPE_VBI        1
  51. #define VFL_TYPE_RADIO        2
  52. #define VFL_TYPE_VTX        3
  53.  
  54. #if (defined(TARGET_OS2) && !defined(NOOS2LXAPI))
  55. extern void (*video_unregister_device)(struct video_device *);
  56. #else
  57. extern void video_unregister_device(struct video_device *);
  58. #endif
  59. #endif
  60.  
  61.  
  62. #define VID_TYPE_CAPTURE    1    /* Can capture */
  63. #define VID_TYPE_TUNER        2    /* Can tune */
  64. #define VID_TYPE_TELETEXT    4    /* Does teletext */
  65. #define VID_TYPE_OVERLAY    8    /* Overlay onto frame buffer */
  66. #define VID_TYPE_CHROMAKEY    16    /* Overlay by chromakey */
  67. #define VID_TYPE_CLIPPING    32    /* Can clip */
  68. #define VID_TYPE_FRAMERAM    64    /* Uses the frame buffer memory */
  69. #define VID_TYPE_SCALES        128    /* Scalable */
  70. #define VID_TYPE_MONOCHROME    256    /* Monochrome only */
  71. #define VID_TYPE_SUBCAPTURE    512    /* Can capture subareas of the image */
  72. #define VID_TYPE_MPEG_DECODER    1024    /* Can decode MPEG streams */
  73. #define VID_TYPE_MPEG_ENCODER    2048    /* Can encode MPEG streams */
  74. #define VID_TYPE_MJPEG_DECODER    4096    /* Can decode MJPEG streams */
  75. #define VID_TYPE_MJPEG_ENCODER    8192    /* Can encode MJPEG streams */
  76.  
  77. struct video_capability
  78. {
  79.     char name[32];
  80.     int type;
  81.     int channels;    /* Num channels */
  82.     int audios;    /* Num audio devices */
  83.     int maxwidth;    /* Supported width */
  84.     int maxheight;    /* And height */
  85.     int minwidth;    /* Supported width */
  86.     int minheight;    /* And height */
  87. };
  88.  
  89.  
  90. struct video_channel
  91. {
  92.     int channel;
  93.     char name[32];
  94.     int tuners;
  95.     __u32  flags;
  96. #define VIDEO_VC_TUNER        1    /* Channel has a tuner */
  97. #define VIDEO_VC_AUDIO        2    /* Channel has audio */
  98.     __u16  type;
  99. #define VIDEO_TYPE_TV        1
  100. #define VIDEO_TYPE_CAMERA    2    
  101.     __u16 norm;            /* Norm set by channel */
  102. };
  103.  
  104. struct video_tuner
  105. {
  106.     int tuner;
  107.     char name[32];
  108.     ulong rangelow, rangehigh;    /* Tuner range */
  109.     __u32 flags;
  110. #define VIDEO_TUNER_PAL        1
  111. #define VIDEO_TUNER_NTSC    2
  112. #define VIDEO_TUNER_SECAM    4
  113. #define VIDEO_TUNER_LOW        8    /* Uses KHz not MHz */
  114. #define VIDEO_TUNER_NORM    16    /* Tuner can set norm */
  115. #define VIDEO_TUNER_STEREO_ON    128    /* Tuner is seeing stereo */
  116. #define VIDEO_TUNER_RDS_ON      256     /* Tuner is seeing an RDS datastream */
  117. #define VIDEO_TUNER_MBS_ON      512     /* Tuner is seeing an MBS datastream */
  118. #ifdef TARGET_OS2
  119. #define VIDEO_TUNER_OS2_LOW    32768    /* Uses 1/100 MHz, not 1/16 MHz */
  120.                     /* Note: Only supported by tuner.c for now */
  121. #endif
  122.     __u16 mode;            /* PAL/NTSC/SECAM/OTHER */
  123. #define VIDEO_MODE_PAL        0
  124. #define VIDEO_MODE_NTSC        1
  125. #define VIDEO_MODE_SECAM    2
  126. #define VIDEO_MODE_AUTO        3
  127.     __u16 signal;            /* Signal strength 16bit scale */
  128. };
  129.  
  130. struct video_picture
  131. {
  132.     __u16    brightness;
  133.     __u16    hue;
  134.     __u16    colour;
  135.     __u16    contrast;
  136.     __u16    whiteness;    /* Black and white only */
  137.     __u16    depth;        /* Capture depth */
  138.     __u16   palette;    /* Palette in use */
  139. #define VIDEO_PALETTE_GREY    1    /* Linear greyscale */
  140. #define VIDEO_PALETTE_HI240    2    /* High 240 cube (BT848) */
  141. #define VIDEO_PALETTE_RGB565    3    /* 565 16 bit RGB */
  142. #define VIDEO_PALETTE_RGB24    4    /* 24bit RGB */
  143. #define VIDEO_PALETTE_RGB32    5    /* 32bit RGB */    
  144. #define VIDEO_PALETTE_RGB555    6    /* 555 15bit RGB */
  145. #define VIDEO_PALETTE_YUV422    7    /* YUV422 capture */
  146. #define VIDEO_PALETTE_YUYV    8
  147. #define VIDEO_PALETTE_UYVY    9    /* The great thing about standards is ... */
  148. #define VIDEO_PALETTE_YUV420    10
  149. #define VIDEO_PALETTE_YUV411    11    /* YUV411 capture */
  150. #define VIDEO_PALETTE_RAW    12    /* RAW capture (BT848) */
  151. #define VIDEO_PALETTE_YUV422P    13    /* YUV 4:2:2 Planar */
  152. #define VIDEO_PALETTE_YUV411P    14    /* YUV 4:1:1 Planar */
  153. #define VIDEO_PALETTE_YUV420P    15    /* YUV 4:2:0 Planar */
  154. #define VIDEO_PALETTE_YUV410P    16    /* YUV 4:1:0 Planar */
  155. #define VIDEO_PALETTE_PLANAR    13    /* start of planar entries */
  156. #define VIDEO_PALETTE_COMPONENT 7    /* start of component entries */
  157. };
  158.  
  159. struct video_audio
  160. {
  161.     int    audio;        /* Audio channel */
  162.     __u16    volume;        /* If settable */
  163.     __u16    bass, treble;
  164.     __u32    flags;
  165. #define VIDEO_AUDIO_MUTE    1
  166. #define VIDEO_AUDIO_MUTABLE    2
  167. #define VIDEO_AUDIO_VOLUME    4
  168. #define VIDEO_AUDIO_BASS    8
  169. #define VIDEO_AUDIO_TREBLE    16    
  170.     char    name[16];
  171. #define VIDEO_SOUND_MONO    1
  172. #define VIDEO_SOUND_STEREO    2
  173. #define VIDEO_SOUND_LANG1    4
  174. #define VIDEO_SOUND_LANG2    8
  175.         __u16   mode;
  176.         __u16    balance;    /* Stereo balance */
  177.         __u16    step;        /* Step actual volume uses */
  178. };
  179.  
  180. struct video_clip
  181. {
  182.     __s32    x,y;
  183.     __s32    width, height;
  184.     struct    video_clip *next;    /* For user use/driver use only */
  185. };
  186.  
  187. struct video_window
  188. {
  189.     __u32    x,y;            /* Position of window */
  190.     __u32    width,height;        /* Its size */
  191.     __u32    chromakey;
  192.     __u32    flags;
  193.     struct    video_clip *clips;    /* Set only */
  194.     int    clipcount;
  195. #define VIDEO_WINDOW_INTERLACE    1
  196. #define VIDEO_WINDOW_CHROMAKEY    16    /* Overlay by chromakey */
  197. #define VIDEO_CLIP_BITMAP    -1
  198. /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
  199. #define VIDEO_CLIPMAP_SIZE    (128 * 625)
  200. };
  201.  
  202. struct video_capture
  203. {
  204.     __u32     x,y;            /* Offsets into image */
  205.     __u32    width, height;        /* Area to capture */
  206.     __u16    decimation;        /* Decimation divder */
  207.     __u16    flags;            /* Flags for capture */
  208. #define VIDEO_CAPTURE_ODD        0    /* Temporal */
  209. #define VIDEO_CAPTURE_EVEN        1
  210. };
  211.  
  212. struct video_buffer
  213. {
  214.     void    *base;
  215.     int    height,width;
  216.     int    depth;
  217.     int    bytesperline;
  218. };
  219.  
  220. struct video_mmap
  221. {
  222.     unsigned    int frame;        /* Frame (0 - n) for double buffer */
  223.     int        height,width;
  224.     unsigned    int format;        /* should be VIDEO_PALETTE_* */
  225. };
  226.  
  227. struct video_key
  228. {
  229.     __u8    key[8];
  230.     __u32    flags;
  231. };
  232.  
  233.  
  234. #define VIDEO_MAX_FRAME        32
  235.  
  236. struct video_mbuf
  237. {
  238.     int    size;        /* Total memory to map */
  239.     int    frames;        /* Frames */
  240.     int    offsets[VIDEO_MAX_FRAME];
  241. };
  242.     
  243.  
  244. #define     VIDEO_NO_UNIT    (-1)
  245.  
  246.     
  247. struct video_unit
  248. {
  249.     int     video;        /* Video minor */
  250.     int    vbi;        /* VBI minor */
  251.     int    radio;        /* Radio minor */
  252.     int    audio;        /* Audio minor */
  253.     int    teletext;    /* Teletext minor */
  254. };
  255.  
  256. struct vbi_format {
  257.     __u32    sampling_rate;    /* in Hz */
  258.     __u32    samples_per_line;
  259.     __u32    sample_format;    /* VIDEO_PALETTE_RAW only (1 byte) */
  260.     __s32    start[2];    /* starting line for each frame */
  261.     __u32    count[2];    /* count of lines for each frame */
  262.     __u32    flags;
  263. #define    VBI_UNSYNC    1    /* can distingues between top/bottom field */
  264. #define    VBI_INTERLACED    2    /* lines are interlaced */
  265. };
  266.  
  267. /* video_info is biased towards hardware mpeg encode/decode */
  268. /* but it could apply generically to any hardware compressor/decompressor */
  269. struct video_info
  270. {
  271.     __u32    frame_count;    /* frames output since decode/encode began */
  272.     __u32    h_size;        /* current unscaled horizontal size */
  273.     __u32    v_size;        /* current unscaled veritcal size */
  274.     __u32    smpte_timecode;    /* current SMPTE timecode (for current GOP) */
  275.     __u32    picture_type;    /* current picture type */
  276.     __u32    temporal_reference;    /* current temporal reference */
  277.     __u8    user_data[256];    /* user data last found in compressed stream */
  278.     /* user_data[0] contains user data flags, user_data[1] has count */
  279. };
  280.  
  281. /* generic structure for setting playback modes */
  282. struct video_play_mode
  283. {
  284.     int    mode;
  285.     int    p1;
  286.     int    p2;
  287. };
  288.  
  289. /* for loading microcode / fpga programming */
  290. struct video_code
  291. {
  292.     char    loadwhat[16];    /* name or tag of file being passed */
  293.     int    datasize;
  294.     __u8    *data;
  295. };
  296.  
  297. #define VIDIOCGCAP           _IOR('v',1,struct video_capability)    /* Get capabilities */
  298. #define VIDIOCGCHAN           _IOWR('v',2,struct video_channel)    /* Get channel info (sources) */
  299. #define VIDIOCSCHAN           _IOW('v',3,struct video_channel)    /* Set channel     */
  300. #define VIDIOCGTUNER         _IOWR('v',4,struct video_tuner)        /* Get tuner abilities */
  301. #define VIDIOCSTUNER           _IOW('v',5,struct video_tuner)        /* Tune the tuner for the current channel */
  302. #define VIDIOCGPICT           _IOR('v',6,struct video_picture)    /* Get picture properties */
  303. #define VIDIOCSPICT          _IOW('v',7,struct video_picture)    /* Set picture properties */
  304. #define VIDIOCCAPTURE        _IOW('v',8,int)                         /* Start, end capture */
  305. #define VIDIOCGWIN           _IOR('v',9, struct video_window)       /* Get the video overlay window */
  306. #define VIDIOCSWIN           _IOW('v',10, struct video_window)    /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
  307. #define VIDIOCGFBUF           _IOR('v',11, struct video_buffer)    /* Get frame buffer */
  308. #define VIDIOCSFBUF        _IOW('v',12, struct video_buffer)    /* Set frame buffer - root only */
  309. #define VIDIOCKEY          _IOR('v',13, struct video_key)        /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
  310. #define VIDIOCGFREQ        _IOR('v',14, unsigned long)           /* Set tuner */
  311. #define VIDIOCSFREQ        _IOW('v',15, unsigned long)           /* Set tuner */
  312. #define VIDIOCGAUDIO       _IOR('v',16, struct video_audio)       /* Get audio info */
  313. #define VIDIOCSAUDIO       _IOW('v',17, struct video_audio)       /* Audio source, mute etc */
  314. #define VIDIOCSYNC         _IOW('v',18, int)                        /* Sync with mmap grabbing */
  315. #define VIDIOCMCAPTURE        _IOW('v',19, struct video_mmap)        /* Grab frames */
  316. #define VIDIOCGMBUF        _IOR('v',20, struct video_mbuf)        /* Memory map buffer info */
  317. #define VIDIOCGUNIT        _IOR('v',21, struct video_unit)        /* Get attached units */
  318. #define VIDIOCGCAPTURE        _IOR('v',22, struct video_capture)    /* Get subcapture */
  319. #define VIDIOCSCAPTURE        _IOW('v',23, struct video_capture)    /* Set subcapture */
  320. #define VIDIOCSPLAYMODE        _IOW('v',24, struct video_play_mode)/* Set output video mode/feature */
  321. #define VIDIOCSWRITEMODE    _IOW('v',25, int)                        /* Set write mode */
  322. #define VIDIOCGPLAYINFO        _IOR('v',26, struct video_info)        /* Get current playback info from hardware */
  323. #define VIDIOCSMICROCODE   _IOW('v',27, struct video_code)        /* Load microcode into hardware */
  324. #define VIDIOCGVBIFMT      _IOR('v',28, struct vbi_format)        /* Get VBI information */
  325. #define VIDIOCSVBIFMT      _IOW('v',29, struct vbi_format)        /* Set VBI information */
  326.  
  327. #ifdef TARGET_OS2
  328. #define VIDIOCSFREQSTEP    _IOW('v',33, int)                   /* Set frequency stepping */
  329. #endif
  330.  
  331.  
  332. #define BASE_VIDIOCPRIVATE    192        /* 192-255 are private */
  333.  
  334. /* VIDIOCSWRITEMODE */
  335. #define VID_WRITE_MPEG_AUD        0
  336. #define VID_WRITE_MPEG_VID        1
  337. #define VID_WRITE_OSD            2
  338. #define VID_WRITE_TTX            3
  339. #define VID_WRITE_CC            4
  340. #define VID_WRITE_MJPEG            5
  341.  
  342. /* VIDIOCSPLAYMODE */
  343. #define VID_PLAY_VID_OUT_MODE        0
  344.     /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
  345. #define VID_PLAY_GENLOCK        1
  346.     /* p1: 0 = OFF, 1 = ON */
  347.     /* p2: GENLOCK FINE DELAY value */
  348. #define VID_PLAY_NORMAL            2
  349. #define VID_PLAY_PAUSE            3
  350. #define VID_PLAY_SINGLE_FRAME        4
  351. #define VID_PLAY_FAST_FORWARD        5
  352. #define VID_PLAY_SLOW_MOTION        6
  353. #define VID_PLAY_IMMEDIATE_NORMAL    7
  354. #define VID_PLAY_SWITCH_CHANNELS    8
  355. #define VID_PLAY_FREEZE_FRAME        9
  356. #define VID_PLAY_STILL_MODE        10
  357. #define VID_PLAY_MASTER_MODE        11
  358.     /* p1: see below */
  359. #define        VID_PLAY_MASTER_NONE    1
  360. #define        VID_PLAY_MASTER_VIDEO    2
  361. #define        VID_PLAY_MASTER_AUDIO    3
  362. #define VID_PLAY_ACTIVE_SCANLINES    12
  363.     /* p1 = first active; p2 = last active */
  364. #define VID_PLAY_RESET            13
  365. #define VID_PLAY_END_MARK        14
  366.  
  367.  
  368.  
  369. #define VID_HARDWARE_BT848    1
  370. #define VID_HARDWARE_QCAM_BW    2
  371. #define VID_HARDWARE_PMS    3
  372. #define VID_HARDWARE_QCAM_C    4
  373. #define VID_HARDWARE_PSEUDO    5
  374. #define VID_HARDWARE_SAA5249    6
  375. #define VID_HARDWARE_AZTECH    7
  376. #define VID_HARDWARE_SF16MI    8
  377. #define VID_HARDWARE_RTRACK    9
  378. #define VID_HARDWARE_ZOLTRIX    10
  379. #define VID_HARDWARE_SAA7146    11
  380. #define VID_HARDWARE_VIDEUM    12    /* Reserved for Winnov videum */
  381. #define VID_HARDWARE_RTRACK2    13
  382. #define VID_HARDWARE_PERMEDIA2    14    /* Reserved for Permedia2 */
  383. #define VID_HARDWARE_RIVA128    15    /* Reserved for RIVA 128 */
  384. #define VID_HARDWARE_PLANB    16    /* PowerMac motherboard video-in */
  385. #define VID_HARDWARE_BROADWAY    17    /* Broadway project */
  386. #define VID_HARDWARE_GEMTEK    18
  387. #define VID_HARDWARE_TYPHOON    19
  388. #define VID_HARDWARE_VINO    20    /* SGI Indy Vino */
  389. #define VID_HARDWARE_CADET    21    /* Cadet radio */
  390. #define VID_HARDWARE_TRUST    22    /* Trust FM Radio */
  391. #define VID_HARDWARE_TERRATEC    23    /* TerraTec ActiveRadio */
  392. #define VID_HARDWARE_CPIA    24
  393. #define VID_HARDWARE_ZR36120    25    /* Zoran ZR36120/ZR36125 */
  394. #define VID_HARDWARE_ZR36067    26    /* Zoran ZR36067/36060 */
  395. #define VID_HARDWARE_OV511    27    
  396. #define VID_HARDWARE_ZR356700    28    /* Zoran 36700 series */
  397. #define VID_HARDWARE_W9966    29
  398. #define VID_HARDWARE_SE401    30    /* SE401 USB webcams */
  399. #define VID_HARDWARE_PWC    31    /* Philips webcams */
  400. #define VID_HARDWARE_MEYE    32    /* Sony Vaio MotionEye cameras */
  401. #define VID_HARDWARE_CPIA2    33
  402.  
  403. /*
  404.  *    Initialiser list
  405.  */
  406.  
  407. struct video_init
  408. {
  409.     char *name;
  410.     int (*init)(struct video_init *);
  411. };
  412.  
  413. #endif
  414.