1/***********************************************************
2Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
3and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
4
5                        All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Digital or MIT not be
12used in advertising or publicity pertaining to distribution of the
13software without specific, written prior permission.
14
15DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21SOFTWARE.
22
23******************************************************************/
24
25#ifndef XVLIB_H
26#define XVLIB_H
27/*
28** File:
29**
30**   Xvlib.h --- Xv library public header file
31**
32** Author:
33**
34**   David Carver (Digital Workstation Engineering/Project Athena)
35**
36** Revisions:
37**
38**   26.06.91 Carver
39**     - changed XvFreeAdaptors to XvFreeAdaptorInfo
40**     - changed XvFreeEncodings to XvFreeEncodingInfo
41**
42**   11.06.91 Carver
43**     - changed SetPortControl to SetPortAttribute
44**     - changed GetPortControl to GetPortAttribute
45**     - changed QueryBestSize
46**
47**   05.15.91 Carver
48**     - version 2.0 upgrade
49**
50**   01.24.91 Carver
51**     - version 1.4 upgrade
52**
53*/
54
55#include <X11/Xfuncproto.h>
56#include <X11/extensions/Xv.h>
57#include <X11/extensions/XShm.h>
58
59typedef struct {
60    int numerator;
61    int denominator;
62} XvRational;
63
64typedef struct {
65    int flags;                  /* XvGettable, XvSettable */
66    int min_value;
67    int max_value;
68    char *name;
69} XvAttribute;
70
71typedef struct {
72    XvEncodingID encoding_id;
73    char *name;
74    unsigned long width;
75    unsigned long height;
76    XvRational rate;
77    unsigned long num_encodings;
78} XvEncodingInfo;
79
80typedef struct {
81    char depth;
82    unsigned long visual_id;
83} XvFormat;
84
85typedef struct {
86    XvPortID base_id;
87    unsigned long num_ports;
88    char type;
89    char *name;
90    unsigned long num_formats;
91    XvFormat *formats;
92    unsigned long num_adaptors;
93} XvAdaptorInfo;
94
95typedef struct {
96    int type;
97    unsigned long serial;       /* # of last request processed by server */
98    Bool send_event;            /* true if this came from a SendEvent request */
99    Display *display;           /* Display the event was read from */
100    Drawable drawable;          /* drawable */
101    unsigned long reason;       /* what generated this event */
102    XvPortID port_id;           /* what port */
103    Time time;                  /* milliseconds */
104} XvVideoNotifyEvent;
105
106typedef struct {
107    int type;
108    unsigned long serial;       /* # of last request processed by server */
109    Bool send_event;            /* true if this came from a SendEvent request */
110    Display *display;           /* Display the event was read from */
111    XvPortID port_id;           /* what port */
112    Time time;                  /* milliseconds */
113    Atom attribute;             /* atom that identifies attribute */
114    long value;                 /* value of attribute */
115} XvPortNotifyEvent;
116
117typedef union {
118    int type;
119    XvVideoNotifyEvent xvvideo;
120    XvPortNotifyEvent xvport;
121    long pad[24];
122} XvEvent;
123
124typedef struct {
125    int id;                     /* Unique descriptor for the format */
126    int type;                   /* XvRGB, XvYUV */
127    int byte_order;             /* LSBFirst, MSBFirst */
128    char guid[16];              /* Globally Unique IDentifier */
129    int bits_per_pixel;
130    int format;                 /* XvPacked, XvPlanar */
131    int num_planes;
132
133    /* for RGB formats only */
134    int depth;
135    unsigned int red_mask;
136    unsigned int green_mask;
137    unsigned int blue_mask;
138
139    /* for YUV formats only */
140    unsigned int y_sample_bits;
141    unsigned int u_sample_bits;
142    unsigned int v_sample_bits;
143    unsigned int horz_y_period;
144    unsigned int horz_u_period;
145    unsigned int horz_v_period;
146    unsigned int vert_y_period;
147    unsigned int vert_u_period;
148    unsigned int vert_v_period;
149    char component_order[32];   /* eg. UYVY */
150    int scanline_order;         /* XvTopToBottom, XvBottomToTop */
151} XvImageFormatValues;
152
153typedef struct {
154    int id;
155    int width, height;
156    int data_size;              /* bytes */
157    int num_planes;
158    int *pitches;               /* bytes */
159    int *offsets;               /* bytes */
160    char *data;
161    XPointer obdata;
162} XvImage;
163
164_XFUNCPROTOBEGIN
165
166extern int XvQueryExtension(
167    Display *                   /* display */,
168    unsigned int *              /* p_version */,
169    unsigned int *              /* p_revision */,
170    unsigned int *              /* p_requestBase */,
171    unsigned int *              /* p_eventBase */,
172    unsigned int *              /* p_errorBase */
173);
174
175extern int XvQueryAdaptors(
176    Display *                   /* display */,
177    Window                      /* window */,
178    unsigned int *              /* p_nAdaptors */,
179    XvAdaptorInfo **            /* p_pAdaptors */
180);
181
182extern int XvQueryEncodings(
183    Display *                   /* display */,
184    XvPortID                    /* port */,
185    unsigned int *              /* p_nEncoding */,
186    XvEncodingInfo **           /* p_pEncoding */
187);
188
189extern int XvPutVideo(
190    Display *                   /* display */,
191    XvPortID                    /* port */,
192    Drawable                    /* d */,
193    GC                          /* gc */,
194    int                         /* vx */,
195    int                         /* vy */,
196    unsigned int                /* vw */,
197    unsigned int                /* vh */,
198    int                         /* dx */,
199    int                         /* dy */,
200    unsigned int                /* dw */,
201    unsigned int                /* dh */
202);
203
204extern int XvPutStill(
205    Display *                   /* display */,
206    XvPortID                    /* port */,
207    Drawable                    /* d */,
208    GC                          /* gc */,
209    int                         /* vx */,
210    int                         /* vy */,
211    unsigned int                /* vw */,
212    unsigned int                /* vh */,
213    int                         /* dx */,
214    int                         /* dy */,
215    unsigned int                /* dw */,
216    unsigned int                /* dh */
217);
218
219extern int XvGetVideo(
220    Display *                   /* display */,
221    XvPortID                    /* port */,
222    Drawable                    /* d */,
223    GC                          /* gc */,
224    int                         /* vx */,
225    int                         /* vy */,
226    unsigned int                /* vw */,
227    unsigned int                /* vh */,
228    int                         /* dx */,
229    int                         /* dy */,
230    unsigned int                /* dw */,
231    unsigned int                /* dh */
232);
233
234extern int XvGetStill(
235    Display *                   /* display */,
236    XvPortID                    /* port */,
237    Drawable                    /* d */,
238    GC                          /* gc */,
239    int                         /* vx */,
240    int                         /* vy */,
241    unsigned int                /* vw */,
242    unsigned int                /* vh */,
243    int                         /* dx */,
244    int                         /* dy */,
245    unsigned int                /* dw */,
246    unsigned int                /* dh */
247);
248
249extern int XvStopVideo(
250    Display *                   /* display */,
251    XvPortID                    /* port */,
252    Drawable                    /* drawable */
253);
254
255extern int XvGrabPort(
256    Display *                   /* display */,
257    XvPortID                    /* port */,
258    Time                        /* time */
259);
260
261extern int XvUngrabPort(
262    Display *                   /* display */,
263    XvPortID                    /* port */,
264    Time                        /* time */
265);
266
267extern int XvSelectVideoNotify(
268    Display *                   /* display */,
269    Drawable                    /* drawable */,
270    Bool                        /* onoff */
271);
272
273extern int XvSelectPortNotify(
274    Display *                   /* display */,
275    XvPortID                    /* port */,
276    Bool                        /* onoff */
277);
278
279extern int XvSetPortAttribute(
280    Display *                   /* display */,
281    XvPortID                    /* port */,
282    Atom                        /* attribute */,
283    int                         /* value */
284);
285
286extern int XvGetPortAttribute(
287    Display *                   /* display */,
288    XvPortID                    /* port */,
289    Atom                        /* attribute */,
290    int *                       /* p_value */
291);
292
293extern int XvQueryBestSize(
294    Display *                   /* display */,
295    XvPortID                    /* port */,
296    Bool                        /* motion */,
297    unsigned int                /* vid_w */,
298    unsigned int                /* vid_h */,
299    unsigned int                /* drw_w */,
300    unsigned int                /* drw_h */,
301    unsigned int *              /* p_actual_width */,
302    unsigned int *              /* p_actual_width */
303);
304
305extern XvAttribute *XvQueryPortAttributes(
306    Display *                   /* display */,
307    XvPortID                    /* port */,
308    int *                       /* number */
309);
310
311
312extern void XvFreeAdaptorInfo(
313    XvAdaptorInfo *             /* adaptors */
314);
315
316extern void XvFreeEncodingInfo(
317    XvEncodingInfo *            /* encodings */
318);
319
320
321extern XvImageFormatValues *XvListImageFormats (
322    Display     *display,
323    XvPortID    port_id,
324    int         *count_return
325);
326
327extern XvImage *XvCreateImage (
328    Display *display,
329    XvPortID port,
330    int id,
331    char *data,
332    int width,
333    int height
334);
335
336extern int XvPutImage (
337    Display *display,
338    XvPortID id,
339    Drawable d,
340    GC gc,
341    XvImage *image,
342    int src_x,
343    int src_y,
344    unsigned int src_w,
345    unsigned int src_h,
346    int dest_x,
347    int dest_y,
348    unsigned int dest_w,
349    unsigned int dest_h
350);
351
352extern int XvShmPutImage (
353    Display *display,
354    XvPortID id,
355    Drawable d,
356    GC gc,
357    XvImage *image,
358    int src_x,
359    int src_y,
360    unsigned int src_w,
361    unsigned int src_h,
362    int dest_x,
363    int dest_y,
364    unsigned int dest_w,
365    unsigned int dest_h,
366    Bool send_event
367);
368
369extern XvImage *XvShmCreateImage (
370    Display *display,
371    XvPortID port,
372    int id,
373    char *data,
374    int width,
375    int height,
376    XShmSegmentInfo *shminfo
377);
378
379
380_XFUNCPROTOEND
381
382#endif /* XVLIB_H */
383