Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


video.h
001: /*
002:  * video.h
003:  *
004:  * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
005:  *                  & Ralph  Metzler <ralph@convergence.de>
006:  *                    for convergence integrated media GmbH
007:  *
008:  * This program is free software; you can redistribute it and/or
009:  * modify it under the terms of the GNU Lesser General Public License
010:  * as published by the Free Software Foundation; either version 2.1
011:  * of the License, or (at your option) any later version.
012:  *
013:  * This program is distributed in the hope that it will be useful,
014:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:  * GNU General Public License for more details.
017:  *
018:  * You should have received a copy of the GNU Lesser General Public License
019:  * along with this program; if not, write to the Free Software
020:  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:  *
022:  */
023: 
024: #ifndef _DVBVIDEO_H_
025: #define _DVBVIDEO_H_
026: 
027: #include <linux/types.h>
028: #include <stdint.h>
029: #include <time.h>
030: 
031: typedef enum {
032:         VIDEO_FORMAT_4_3,     /* Select 4:3 format */
033:         VIDEO_FORMAT_16_9,    /* Select 16:9 format. */
034:         VIDEO_FORMAT_221_1    /* 2.21:1 */
035: } video_format_t;
036: 
037: 
038: typedef enum {
039:          VIDEO_SYSTEM_PAL,
040:          VIDEO_SYSTEM_NTSC,
041:          VIDEO_SYSTEM_PALN,
042:          VIDEO_SYSTEM_PALNc,
043:          VIDEO_SYSTEM_PALM,
044:          VIDEO_SYSTEM_NTSC60,
045:          VIDEO_SYSTEM_PAL60,
046:          VIDEO_SYSTEM_PALM60
047: } video_system_t;
048: 
049: 
050: typedef enum {
051:         VIDEO_PAN_SCAN,       /* use pan and scan format */
052:         VIDEO_LETTER_BOX,     /* use letterbox format */
053:         VIDEO_CENTER_CUT_OUT  /* use center cut out format */
054: } video_displayformat_t;
055: 
056: typedef struct {
057:         int w;
058:         int h;
059:         video_format_t aspect_ratio;
060: } video_size_t;
061: 
062: typedef enum {
063:         VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
064:         VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
065:                                comes from the user through the write
066:                                system call */
067: } video_stream_source_t;
068: 
069: 
070: typedef enum {
071:         VIDEO_STOPPED, /* Video is stopped */
072:         VIDEO_PLAYING, /* Video is currently playing */
073:         VIDEO_FREEZED  /* Video is freezed */
074: } video_play_state_t;
075: 
076: 
077: /* Decoder commands */
078: #define VIDEO_CMD_PLAY        (0)
079: #define VIDEO_CMD_STOP        (1)
080: #define VIDEO_CMD_FREEZE      (2)
081: #define VIDEO_CMD_CONTINUE    (3)
082: 
083: /* Flags for VIDEO_CMD_FREEZE */
084: #define VIDEO_CMD_FREEZE_TO_BLACK       (1 << 0)
085: 
086: /* Flags for VIDEO_CMD_STOP */
087: #define VIDEO_CMD_STOP_TO_BLACK         (1 << 0)
088: #define VIDEO_CMD_STOP_IMMEDIATELY      (1 << 1)
089: 
090: /* Play input formats: */
091: /* The decoder has no special format requirements */
092: #define VIDEO_PLAY_FMT_NONE         (0)
093: /* The decoder requires full GOPs */
094: #define VIDEO_PLAY_FMT_GOP          (1)
095: 
096: /* The structure must be zeroed before use by the application
097:    This ensures it can be extended safely in the future. */
098: struct video_command {
099:         __u32 cmd;
100:         __u32 flags;
101:         union {
102:                 struct {
103:                         __u64 pts;
104:                 } stop;
105: 
106:                 struct {
107:                         /* 0 or 1000 specifies normal speed,
108:                            1 specifies forward single stepping,
109:                            -1 specifies backward single stepping,
110:                            >1: playback at speed/1000 of the normal speed,
111:                            <-1: reverse playback at (-speed/1000) of the normal speed. */
112:                         __s32 speed;
113:                         __u32 format;
114:                 } play;
115: 
116:                 struct {
117:                         __u32 data[16];
118:                 } raw;
119:         };
120: };
121: 
122: /* FIELD_UNKNOWN can be used if the hardware does not know whether
123:    the Vsync is for an odd, even or progressive (i.e. non-interlaced)
124:    field. */
125: #define VIDEO_VSYNC_FIELD_UNKNOWN       (0)
126: #define VIDEO_VSYNC_FIELD_ODD           (1)
127: #define VIDEO_VSYNC_FIELD_EVEN          (2)
128: #define VIDEO_VSYNC_FIELD_PROGRESSIVE   (3)
129: 
130: struct video_event {
131:         __s32 type;
132: #define VIDEO_EVENT_SIZE_CHANGED        1
133: #define VIDEO_EVENT_FRAME_RATE_CHANGED  2
134: #define VIDEO_EVENT_DECODER_STOPPED     3
135: #define VIDEO_EVENT_VSYNC               4
136:         __kernel_time_t timestamp;
137:         union {
138:                 video_size_t size;
139:                 unsigned int frame_rate;        /* in frames per 1000sec */
140:                 unsigned char vsync_field;      /* unknown/odd/even/progressive */
141:         } u;
142: };
143: 
144: 
145: struct video_status {
146:         int                   video_blank;   /* blank video on freeze? */
147:         video_play_state_t    play_state;    /* current state of playback */
148:         video_stream_source_t stream_source; /* current source (demux/memory) */
149:         video_format_t        video_format;  /* current aspect ratio of stream*/
150:         video_displayformat_t display_format;/* selected cropping mode */
151: };
152: 
153: 
154: struct video_still_picture {
155:         char *iFrame;        /* pointer to a single iframe in memory */
156:         __s32 size;
157: };
158: 
159: 
160: typedef
161: struct video_highlight {
162:         int     active;      /*    1=show highlight, 0=hide highlight */
163:         __u8    contrast1;   /*    7- 4  Pattern pixel contrast */
164:                              /*    3- 0  Background pixel contrast */
165:         __u8    contrast2;   /*    7- 4  Emphasis pixel-2 contrast */
166:                              /*    3- 0  Emphasis pixel-1 contrast */
167:         __u8    color1;      /*    7- 4  Pattern pixel color */
168:                              /*    3- 0  Background pixel color */
169:         __u8    color2;      /*    7- 4  Emphasis pixel-2 color */
170:                              /*    3- 0  Emphasis pixel-1 color */
171:         __u32    ypos;       /*   23-22  auto action mode */
172:                              /*   21-12  start y */
173:                              /*    9- 0  end y */
174:         __u32    xpos;       /*   23-22  button color number */
175:                              /*   21-12  start x */
176:                              /*    9- 0  end x */
177: } video_highlight_t;
178: 
179: 
180: typedef struct video_spu {
181:         int active;
182:         int stream_id;
183: } video_spu_t;
184: 
185: 
186: typedef struct video_spu_palette {      /* SPU Palette information */
187:         int length;
188:         __u8 *palette;
189: } video_spu_palette_t;
190: 
191: 
192: typedef struct video_navi_pack {
193:         int length;          /* 0 ... 1024 */
194:         __u8 data[1024];
195: } video_navi_pack_t;
196: 
197: 
198: typedef __u16 video_attributes_t;
199: /*   bits: descr. */
200: /*   15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
201: /*   13-12 TV system (0=525/60, 1=625/50) */
202: /*   11-10 Aspect ratio (0=4:3, 3=16:9) */
203: /*    9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
204: /*    7    line 21-1 data present in GOP (1=yes, 0=no) */
205: /*    6    line 21-2 data present in GOP (1=yes, 0=no) */
206: /*    5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
207: /*    2    source letterboxed (1=yes, 0=no) */
208: /*    0    film/camera mode (0=camera, 1=film (625/50 only)) */
209: 
210: 
211: /* bit definitions for capabilities: */
212: /* can the hardware decode MPEG1 and/or MPEG2? */
213: #define VIDEO_CAP_MPEG1   1
214: #define VIDEO_CAP_MPEG2   2
215: /* can you send a system and/or program stream to video device?
216:    (you still have to open the video and the audio device but only
217:     send the stream to the video device) */
218: #define VIDEO_CAP_SYS     4
219: #define VIDEO_CAP_PROG    8
220: /* can the driver also handle SPU, NAVI and CSS encoded data?
221:    (CSS API is not present yet) */
222: #define VIDEO_CAP_SPU    16
223: #define VIDEO_CAP_NAVI   32
224: #define VIDEO_CAP_CSS    64
225: 
226: 
227: #define VIDEO_STOP                 _IO('o', 21)
228: #define VIDEO_PLAY                 _IO('o', 22)
229: #define VIDEO_FREEZE               _IO('o', 23)
230: #define VIDEO_CONTINUE             _IO('o', 24)
231: #define VIDEO_SELECT_SOURCE        _IO('o', 25)
232: #define VIDEO_SET_BLANK            _IO('o', 26)
233: #define VIDEO_GET_STATUS           _IOR('o', 27, struct video_status)
234: #define VIDEO_GET_EVENT            _IOR('o', 28, struct video_event)
235: #define VIDEO_SET_DISPLAY_FORMAT   _IO('o', 29)
236: #define VIDEO_STILLPICTURE         _IOW('o', 30, struct video_still_picture)
237: #define VIDEO_FAST_FORWARD         _IO('o', 31)
238: #define VIDEO_SLOWMOTION           _IO('o', 32)
239: #define VIDEO_GET_CAPABILITIES     _IOR('o', 33, unsigned int)
240: #define VIDEO_CLEAR_BUFFER         _IO('o',  34)
241: #define VIDEO_SET_ID               _IO('o', 35)
242: #define VIDEO_SET_STREAMTYPE       _IO('o', 36)
243: #define VIDEO_SET_FORMAT           _IO('o', 37)
244: #define VIDEO_SET_SYSTEM           _IO('o', 38)
245: #define VIDEO_SET_HIGHLIGHT        _IOW('o', 39, video_highlight_t)
246: #define VIDEO_SET_SPU              _IOW('o', 50, video_spu_t)
247: #define VIDEO_SET_SPU_PALETTE      _IOW('o', 51, video_spu_palette_t)
248: #define VIDEO_GET_NAVI             _IOR('o', 52, video_navi_pack_t)
249: #define VIDEO_SET_ATTRIBUTES       _IO('o', 53)
250: #define VIDEO_GET_SIZE             _IOR('o', 55, video_size_t)
251: #define VIDEO_GET_FRAME_RATE       _IOR('o', 56, unsigned int)
252: 
253: /**
254:  * VIDEO_GET_PTS
255:  *
256:  * Read the 33 bit presentation time stamp as defined
257:  * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
258:  *
259:  * The PTS should belong to the currently played
260:  * frame if possible, but may also be a value close to it
261:  * like the PTS of the last decoded frame or the last PTS
262:  * extracted by the PES parser.
263:  */
264: #define VIDEO_GET_PTS              _IOR('o', 57, __u64)
265: 
266: /* Read the number of displayed frames since the decoder was started */
267: #define VIDEO_GET_FRAME_COUNT      _IOR('o', 58, __u64)
268: 
269: #define VIDEO_COMMAND              _IOWR('o', 59, struct video_command)
270: #define VIDEO_TRY_COMMAND          _IOWR('o', 60, struct video_command)
271: 
272: #endif /*_DVBVIDEO_H_*/
273: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/