zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

video.h (6368B) - Raw


      1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
      2 /*
      3  * video.h - DEPRECATED MPEG-TS video decoder API
      4  *
      5  * NOTE: should not be used on future drivers
      6  *
      7  * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
      8  *                  & Ralph  Metzler <ralph@convergence.de>
      9  *                    for convergence integrated media GmbH
     10  */
     11 
     12 #ifndef _DVBVIDEO_H_
     13 #define _DVBVIDEO_H_
     14 
     15 #include <linux/types.h>
     16 #include <time.h>
     17 
     18 typedef enum {
     19 	VIDEO_FORMAT_4_3,     /* Select 4:3 format */
     20 	VIDEO_FORMAT_16_9,    /* Select 16:9 format. */
     21 	VIDEO_FORMAT_221_1    /* 2.21:1 */
     22 } video_format_t;
     23 
     24 
     25 typedef enum {
     26 	VIDEO_PAN_SCAN,       /* use pan and scan format */
     27 	VIDEO_LETTER_BOX,     /* use letterbox format */
     28 	VIDEO_CENTER_CUT_OUT  /* use center cut out format */
     29 } video_displayformat_t;
     30 
     31 typedef struct {
     32 	int w;
     33 	int h;
     34 	video_format_t aspect_ratio;
     35 } video_size_t;
     36 
     37 typedef enum {
     38 	VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
     39 	VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
     40 			       comes from the user through the write
     41 			       system call */
     42 } video_stream_source_t;
     43 
     44 
     45 typedef enum {
     46 	VIDEO_STOPPED, /* Video is stopped */
     47 	VIDEO_PLAYING, /* Video is currently playing */
     48 	VIDEO_FREEZED  /* Video is freezed */
     49 } video_play_state_t;
     50 
     51 
     52 /* Decoder commands */
     53 #define VIDEO_CMD_PLAY        (0)
     54 #define VIDEO_CMD_STOP        (1)
     55 #define VIDEO_CMD_FREEZE      (2)
     56 #define VIDEO_CMD_CONTINUE    (3)
     57 
     58 /* Flags for VIDEO_CMD_FREEZE */
     59 #define VIDEO_CMD_FREEZE_TO_BLACK	(1 << 0)
     60 
     61 /* Flags for VIDEO_CMD_STOP */
     62 #define VIDEO_CMD_STOP_TO_BLACK		(1 << 0)
     63 #define VIDEO_CMD_STOP_IMMEDIATELY	(1 << 1)
     64 
     65 /* Play input formats: */
     66 /* The decoder has no special format requirements */
     67 #define VIDEO_PLAY_FMT_NONE         (0)
     68 /* The decoder requires full GOPs */
     69 #define VIDEO_PLAY_FMT_GOP          (1)
     70 
     71 /* The structure must be zeroed before use by the application
     72    This ensures it can be extended safely in the future. */
     73 struct video_command {
     74 	__u32 cmd;
     75 	__u32 flags;
     76 	union {
     77 		struct {
     78 			__u64 pts;
     79 		} stop;
     80 
     81 		struct {
     82 			/* 0 or 1000 specifies normal speed,
     83 			   1 specifies forward single stepping,
     84 			   -1 specifies backward single stepping,
     85 			   >1: playback at speed/1000 of the normal speed,
     86 			   <-1: reverse playback at (-speed/1000) of the normal speed. */
     87 			__s32 speed;
     88 			__u32 format;
     89 		} play;
     90 
     91 		struct {
     92 			__u32 data[16];
     93 		} raw;
     94 	};
     95 };
     96 
     97 /* FIELD_UNKNOWN can be used if the hardware does not know whether
     98    the Vsync is for an odd, even or progressive (i.e. non-interlaced)
     99    field. */
    100 #define VIDEO_VSYNC_FIELD_UNKNOWN	(0)
    101 #define VIDEO_VSYNC_FIELD_ODD		(1)
    102 #define VIDEO_VSYNC_FIELD_EVEN		(2)
    103 #define VIDEO_VSYNC_FIELD_PROGRESSIVE	(3)
    104 
    105 struct video_event {
    106 	__s32 type;
    107 #define VIDEO_EVENT_SIZE_CHANGED	1
    108 #define VIDEO_EVENT_FRAME_RATE_CHANGED	2
    109 #define VIDEO_EVENT_DECODER_STOPPED	3
    110 #define VIDEO_EVENT_VSYNC		4
    111 	/* unused, make sure to use atomic time for y2038 if it ever gets used */
    112 	long timestamp;
    113 	union {
    114 		video_size_t size;
    115 		unsigned int frame_rate;	/* in frames per 1000sec */
    116 		unsigned char vsync_field;	/* unknown/odd/even/progressive */
    117 	} u;
    118 };
    119 
    120 
    121 struct video_status {
    122 	int                   video_blank;   /* blank video on freeze? */
    123 	video_play_state_t    play_state;    /* current state of playback */
    124 	video_stream_source_t stream_source; /* current source (demux/memory) */
    125 	video_format_t        video_format;  /* current aspect ratio of stream*/
    126 	video_displayformat_t display_format;/* selected cropping mode */
    127 };
    128 
    129 
    130 struct video_still_picture {
    131 	char *iFrame;        /* pointer to a single iframe in memory */
    132 	__s32 size;
    133 };
    134 
    135 
    136 typedef __u16 video_attributes_t;
    137 /*   bits: descr. */
    138 /*   15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
    139 /*   13-12 TV system (0=525/60, 1=625/50) */
    140 /*   11-10 Aspect ratio (0=4:3, 3=16:9) */
    141 /*    9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
    142 /*    7    line 21-1 data present in GOP (1=yes, 0=no) */
    143 /*    6    line 21-2 data present in GOP (1=yes, 0=no) */
    144 /*    5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
    145 /*    2    source letterboxed (1=yes, 0=no) */
    146 /*    0    film/camera mode (0=
    147  *camera, 1=film (625/50 only)) */
    148 
    149 
    150 /* bit definitions for capabilities: */
    151 /* can the hardware decode MPEG1 and/or MPEG2? */
    152 #define VIDEO_CAP_MPEG1   1
    153 #define VIDEO_CAP_MPEG2   2
    154 /* can you send a system and/or program stream to video device?
    155    (you still have to open the video and the audio device but only
    156     send the stream to the video device) */
    157 #define VIDEO_CAP_SYS     4
    158 #define VIDEO_CAP_PROG    8
    159 /* can the driver also handle SPU, NAVI and CSS encoded data?
    160    (CSS API is not present yet) */
    161 #define VIDEO_CAP_SPU    16
    162 #define VIDEO_CAP_NAVI   32
    163 #define VIDEO_CAP_CSS    64
    164 
    165 
    166 #define VIDEO_STOP                 _IO('o', 21)
    167 #define VIDEO_PLAY                 _IO('o', 22)
    168 #define VIDEO_FREEZE               _IO('o', 23)
    169 #define VIDEO_CONTINUE             _IO('o', 24)
    170 #define VIDEO_SELECT_SOURCE        _IO('o', 25)
    171 #define VIDEO_SET_BLANK            _IO('o', 26)
    172 #define VIDEO_GET_STATUS           _IOR('o', 27, struct video_status)
    173 #define VIDEO_GET_EVENT            _IOR('o', 28, struct video_event)
    174 #define VIDEO_SET_DISPLAY_FORMAT   _IO('o', 29)
    175 #define VIDEO_STILLPICTURE         _IOW('o', 30, struct video_still_picture)
    176 #define VIDEO_FAST_FORWARD         _IO('o', 31)
    177 #define VIDEO_SLOWMOTION           _IO('o', 32)
    178 #define VIDEO_GET_CAPABILITIES     _IOR('o', 33, unsigned int)
    179 #define VIDEO_CLEAR_BUFFER         _IO('o',  34)
    180 #define VIDEO_SET_STREAMTYPE       _IO('o', 36)
    181 #define VIDEO_SET_FORMAT           _IO('o', 37)
    182 #define VIDEO_GET_SIZE             _IOR('o', 55, video_size_t)
    183 
    184 /**
    185  * VIDEO_GET_PTS
    186  *
    187  * Read the 33 bit presentation time stamp as defined
    188  * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
    189  *
    190  * The PTS should belong to the currently played
    191  * frame if possible, but may also be a value close to it
    192  * like the PTS of the last decoded frame or the last PTS
    193  * extracted by the PES parser.
    194  */
    195 #define VIDEO_GET_PTS              _IOR('o', 57, __u64)
    196 
    197 /* Read the number of displayed frames since the decoder was started */
    198 #define VIDEO_GET_FRAME_COUNT	   _IOR('o', 58, __u64)
    199 
    200 #define VIDEO_COMMAND		   _IOWR('o', 59, struct video_command)
    201 #define VIDEO_TRY_COMMAND	   _IOWR('o', 60, struct video_command)
    202 
    203 #endif /* _DVBVIDEO_H_ */