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 XVPROTO_H
26#define XVPROTO_H
27/*
28** File:
29**
30**   Xvproto.h --- Xv protocol header file
31**
32** Author:
33**
34**   David Carver (Digital Workstation Engineering/Project Athena)
35**
36** Revisions:
37**
38**   11.06.91 Carver
39**     - changed SetPortControl to SetPortAttribute
40**     - changed GetPortControl to GetPortAttribute
41**     - changed QueryBestSize
42**
43**   15.05.91 Carver
44**     - version 2.0 upgrade
45**
46**   24.01.91 Carver
47**     - version 1.4 upgrade
48**
49*/
50
51#include <X11/Xmd.h>
52
53/* Symbols: These are undefined at the end of this file to restore the
54   values they have in Xv.h */
55
56#define XvPortID CARD32
57#define XvEncodingID CARD32
58#define ShmSeg CARD32
59#define VisualID CARD32
60#define Drawable CARD32
61#define GContext CARD32
62#define Time CARD32
63#define Atom CARD32
64
65/* Structures */
66
67typedef struct {
68  INT32 numerator;
69  INT32 denominator;
70} xvRational;
71#define sz_xvRational 8
72
73typedef struct {
74  XvPortID base_id;
75  CARD16 name_size;
76  CARD16 num_ports;
77  CARD16 num_formats;
78  CARD8 type;
79  CARD8 pad;
80} xvAdaptorInfo;
81#define sz_xvAdaptorInfo 12
82
83typedef struct {
84  XvEncodingID encoding;
85  CARD16 name_size;
86  CARD16 width, height;
87  CARD16 pad;
88  xvRational rate;
89} xvEncodingInfo;
90#define sz_xvEncodingInfo (12 + sz_xvRational)
91
92typedef struct {
93  VisualID visual;
94  CARD8 depth;
95  CARD8 pad1;
96  CARD16 pad2;
97} xvFormat;
98#define sz_xvFormat 8
99
100typedef struct {
101  CARD32 flags;
102  INT32 min;
103  INT32 max;
104  CARD32 size;
105} xvAttributeInfo;
106#define sz_xvAttributeInfo 16
107
108typedef struct {
109  CARD32 id;
110  CARD8 type;
111  CARD8 byte_order;
112  CARD16 pad1;
113  CARD8 guid[16];
114  CARD8 bpp;
115  CARD8 num_planes;
116  CARD16 pad2;
117  CARD8 depth;
118  CARD8 pad3;
119  CARD16 pad4;
120  CARD32 red_mask;
121  CARD32 green_mask;
122  CARD32 blue_mask;
123  CARD8 format;
124  CARD8 pad5;
125  CARD16 pad6;
126  CARD32 y_sample_bits;
127  CARD32 u_sample_bits;
128  CARD32 v_sample_bits;
129  CARD32 horz_y_period;
130  CARD32 horz_u_period;
131  CARD32 horz_v_period;
132  CARD32 vert_y_period;
133  CARD32 vert_u_period;
134  CARD32 vert_v_period;
135  CARD8 comp_order[32];
136  CARD8 scanline_order;
137  CARD8 pad7;
138  CARD16 pad8;
139  CARD32 pad9;
140  CARD32 pad10;
141} xvImageFormatInfo;
142#define sz_xvImageFormatInfo 128
143
144
145/* Requests */
146
147#define xv_QueryExtension                  0
148#define	xv_QueryAdaptors                   1
149#define	xv_QueryEncodings                  2
150#define xv_GrabPort                        3
151#define xv_UngrabPort                      4
152#define xv_PutVideo                        5
153#define xv_PutStill                        6
154#define xv_GetVideo                        7
155#define xv_GetStill                        8
156#define xv_StopVideo                       9
157#define xv_SelectVideoNotify              10
158#define xv_SelectPortNotify               11
159#define xv_QueryBestSize                  12
160#define xv_SetPortAttribute               13
161#define xv_GetPortAttribute               14
162#define xv_QueryPortAttributes            15
163#define xv_ListImageFormats               16
164#define xv_QueryImageAttributes           17
165#define xv_PutImage                       18
166#define xv_ShmPutImage                    19
167#define xv_LastRequest                    xv_ShmPutImage
168
169#define xvNumRequests                     (xv_LastRequest + 1)
170
171typedef struct {
172  CARD8 reqType;
173  CARD8 xvReqType;
174  CARD16 length;
175} xvQueryExtensionReq;
176#define sz_xvQueryExtensionReq 4
177
178typedef struct {
179  CARD8 reqType;
180  CARD8 xvReqType;
181  CARD16 length;
182  CARD32 window;
183} xvQueryAdaptorsReq;
184#define sz_xvQueryAdaptorsReq 8
185
186typedef struct {
187  CARD8 reqType;
188  CARD8 xvReqType;
189  CARD16 length;
190  CARD32 port;
191} xvQueryEncodingsReq;
192#define sz_xvQueryEncodingsReq 8
193
194typedef struct {
195  CARD8 reqType;
196  CARD8 xvReqType;
197  CARD16 length;
198  XvPortID port;
199  Drawable drawable;
200  GContext gc;
201  INT16 vid_x;
202  INT16 vid_y;
203  CARD16 vid_w;
204  CARD16 vid_h;
205  INT16 drw_x;
206  INT16 drw_y;
207  CARD16 drw_w;
208  CARD16 drw_h;
209} xvPutVideoReq;
210#define sz_xvPutVideoReq 32
211
212typedef struct {
213  CARD8 reqType;
214  CARD8 xvReqType;
215  CARD16 length;
216  XvPortID port;
217  Drawable drawable;
218  GContext gc;
219  INT16 vid_x;
220  INT16 vid_y;
221  CARD16 vid_w;
222  CARD16 vid_h;
223  INT16 drw_x;
224  INT16 drw_y;
225  CARD16 drw_w;
226  CARD16 drw_h;
227} xvPutStillReq;
228#define sz_xvPutStillReq 32
229
230typedef struct {
231  CARD8 reqType;
232  CARD8 xvReqType;
233  CARD16 length;
234  XvPortID port;
235  Drawable drawable;
236  GContext gc;
237  INT16 vid_x;
238  INT16 vid_y;
239  CARD16 vid_w;
240  CARD16 vid_h;
241  INT16 drw_x;
242  INT16 drw_y;
243  CARD16 drw_w;
244  CARD16 drw_h;
245} xvGetVideoReq;
246#define sz_xvGetVideoReq 32
247
248typedef struct {
249  CARD8 reqType;
250  CARD8 xvReqType;
251  CARD16 length;
252  XvPortID port;
253  Drawable drawable;
254  GContext gc;
255  INT16 vid_x;
256  INT16 vid_y;
257  CARD16 vid_w;
258  CARD16 vid_h;
259  INT16 drw_x;
260  INT16 drw_y;
261  CARD16 drw_w;
262  CARD16 drw_h;
263} xvGetStillReq;
264#define sz_xvGetStillReq 32
265
266typedef struct {
267  CARD8 reqType;
268  CARD8 xvReqType;
269  CARD16 length;
270  XvPortID port;
271  Time time;
272} xvGrabPortReq;
273#define sz_xvGrabPortReq 12
274
275typedef struct {
276  CARD8 reqType;
277  CARD8 xvReqType;
278  CARD16 length;
279  XvPortID port;
280  Time time;
281} xvUngrabPortReq;
282#define sz_xvUngrabPortReq 12
283
284typedef struct {
285  CARD8 reqType;
286  CARD8 xvReqType;
287  CARD16 length;
288  Drawable drawable;
289  BOOL onoff;
290  CARD8 pad1;
291  CARD16 pad2;
292} xvSelectVideoNotifyReq;
293#define sz_xvSelectVideoNotifyReq 12
294
295typedef struct {
296  CARD8 reqType;
297  CARD8 xvReqType;
298  CARD16 length;
299  XvPortID port;
300  BOOL onoff;
301  CARD8 pad1;
302  CARD16 pad2;
303} xvSelectPortNotifyReq;
304#define sz_xvSelectPortNotifyReq 12
305
306typedef struct {
307  CARD8 reqType;
308  CARD8 xvReqType;
309  CARD16 length;
310  XvPortID port;
311  Drawable drawable;
312} xvStopVideoReq;
313#define sz_xvStopVideoReq 12
314
315typedef struct {
316  CARD8 reqType;
317  CARD8 xvReqType;
318  CARD16 length;
319  XvPortID port;
320  Atom attribute;
321  INT32 value;
322} xvSetPortAttributeReq;
323#define sz_xvSetPortAttributeReq 16
324
325typedef struct {
326  CARD8 reqType;
327  CARD8 xvReqType;
328  CARD16 length;
329  XvPortID port;
330  Atom attribute;
331} xvGetPortAttributeReq;
332#define sz_xvGetPortAttributeReq 12
333
334typedef struct {
335  CARD8 reqType;
336  CARD8 xvReqType;
337  CARD16 length;
338  XvPortID port;
339  CARD16 vid_w;
340  CARD16 vid_h;
341  CARD16 drw_w;
342  CARD16 drw_h;
343  CARD8 motion;
344  CARD8 pad1;
345  CARD16 pad2;
346} xvQueryBestSizeReq;
347#define sz_xvQueryBestSizeReq 20
348
349typedef struct {
350  CARD8 reqType;
351  CARD8 xvReqType;
352  CARD16 length;
353  XvPortID port;
354} xvQueryPortAttributesReq;
355#define sz_xvQueryPortAttributesReq 8
356
357typedef struct {
358  CARD8 reqType;
359  CARD8 xvReqType;
360  CARD16 length;
361  XvPortID port;
362  Drawable drawable;
363  GContext gc;
364  CARD32 id;
365  INT16 src_x;
366  INT16 src_y;
367  CARD16 src_w;
368  CARD16 src_h;
369  INT16 drw_x;
370  INT16 drw_y;
371  CARD16 drw_w;
372  CARD16 drw_h;
373  CARD16 width;
374  CARD16 height;
375} xvPutImageReq;
376#define sz_xvPutImageReq 40
377
378typedef struct {
379  CARD8 reqType;
380  CARD8 xvReqType;
381  CARD16 length;
382  XvPortID port;
383  Drawable drawable;
384  GContext gc;
385  ShmSeg shmseg;
386  CARD32 id;
387  CARD32 offset;
388  INT16 src_x;
389  INT16 src_y;
390  CARD16 src_w;
391  CARD16 src_h;
392  INT16 drw_x;
393  INT16 drw_y;
394  CARD16 drw_w;
395  CARD16 drw_h;
396  CARD16 width;
397  CARD16 height;
398  CARD8 send_event;
399  CARD8 pad1;
400  CARD16 pad2;
401} xvShmPutImageReq;
402#define sz_xvShmPutImageReq 52
403
404typedef struct {
405  CARD8 reqType;
406  CARD8 xvReqType;
407  CARD16 length;
408  XvPortID port;
409} xvListImageFormatsReq;
410#define sz_xvListImageFormatsReq 8
411
412typedef struct {
413  CARD8 reqType;
414  CARD8 xvReqType;
415  CARD16 length;
416  CARD32 port;
417  CARD32 id;
418  CARD16 width;
419  CARD16 height;
420} xvQueryImageAttributesReq;
421#define sz_xvQueryImageAttributesReq 16
422
423
424/* Replies */
425
426typedef struct _QueryExtensionReply {
427  BYTE type;   /* X_Reply */
428  CARD8 padb1;
429  CARD16 sequenceNumber;
430  CARD32 length;
431  CARD16 version;
432  CARD16 revision;
433  CARD32 padl4;
434  CARD32 padl5;
435  CARD32 padl6;
436  CARD32 padl7;
437  CARD32 padl8;
438} xvQueryExtensionReply;
439#define sz_xvQueryExtensionReply 32
440
441typedef struct _QueryAdaptorsReply {
442  BYTE type;   /* X_Reply */
443  CARD8 padb1;
444  CARD16 sequenceNumber;
445  CARD32 length;
446  CARD16 num_adaptors;
447  CARD16 pads3;
448  CARD32 padl4;
449  CARD32 padl5;
450  CARD32 padl6;
451  CARD32 padl7;
452  CARD32 padl8;
453} xvQueryAdaptorsReply;
454#define sz_xvQueryAdaptorsReply 32
455
456typedef struct _QueryEncodingsReply {
457  BYTE type;   /* X_Reply */
458  CARD8 padb1;
459  CARD16 sequenceNumber;
460  CARD32 length;
461  CARD16 num_encodings;
462  CARD16 padl3;
463  CARD32 padl4;
464  CARD32 padl5;
465  CARD32 padl6;
466  CARD32 padl7;
467  CARD32 padl8;
468} xvQueryEncodingsReply;
469#define sz_xvQueryEncodingsReply 32
470
471typedef struct {
472  BYTE type;  /* X_Reply */
473  BYTE result;
474  CARD16 sequenceNumber;
475  CARD32 length;  /* 0 */
476  CARD32 padl3;
477  CARD32 padl4;
478  CARD32 padl5;
479  CARD32 padl6;
480  CARD32 padl7;
481  CARD32 padl8;
482} xvGrabPortReply;
483#define sz_xvGrabPortReply 32
484
485typedef struct {
486  BYTE type;  /* X_Reply */
487  BYTE padb1;
488  CARD16 sequenceNumber;
489  CARD32 length;  /* 0 */
490  INT32 value;
491  CARD32 padl4;
492  CARD32 padl5;
493  CARD32 padl6;
494  CARD32 padl7;
495  CARD32 padl8;
496} xvGetPortAttributeReply;
497#define sz_xvGetPortAttributeReply 32
498
499typedef struct {
500  BYTE type;  /* X_Reply */
501  BYTE padb1;
502  CARD16 sequenceNumber;
503  CARD32 length;  /* 0 */
504  CARD16 actual_width;
505  CARD16 actual_height;
506  CARD32 padl4;
507  CARD32 padl5;
508  CARD32 padl6;
509  CARD32 padl7;
510  CARD32 padl8;
511} xvQueryBestSizeReply;
512#define sz_xvQueryBestSizeReply 32
513
514typedef struct {
515  BYTE type;  /* X_Reply */
516  BYTE padb1;
517  CARD16 sequenceNumber;
518  CARD32 length;  /* 0 */
519  CARD32 num_attributes;
520  CARD32 text_size;
521  CARD32 padl5;
522  CARD32 padl6;
523  CARD32 padl7;
524  CARD32 padl8;
525} xvQueryPortAttributesReply;
526#define sz_xvQueryPortAttributesReply 32
527
528typedef struct {
529  BYTE type;  /* X_Reply */
530  BYTE padb1;
531  CARD16 sequenceNumber;
532  CARD32 length;
533  CARD32 num_formats;
534  CARD32 padl4;
535  CARD32 padl5;
536  CARD32 padl6;
537  CARD32 padl7;
538  CARD32 padl8;
539} xvListImageFormatsReply;
540#define sz_xvListImageFormatsReply 32
541
542typedef struct {
543  BYTE type;  /* X_Reply */
544  BYTE padb1;
545  CARD16 sequenceNumber;
546  CARD32 length;
547  CARD32 num_planes;
548  CARD32 data_size;
549  CARD16 width;
550  CARD16 height;
551  CARD32 padl6;
552  CARD32 padl7;
553  CARD32 padl8;
554} xvQueryImageAttributesReply;
555#define sz_xvQueryImageAttributesReply 32
556
557/* DEFINE EVENT STRUCTURE */
558
559typedef struct {
560  union {
561    struct {
562      BYTE type;
563      BYTE detail;
564      CARD16 sequenceNumber;
565    } u;
566    struct {
567      BYTE type;
568      BYTE reason;
569      CARD16 sequenceNumber;
570      Time time;
571      Drawable drawable;
572      XvPortID port;
573      CARD32 padl5;
574      CARD32 padl6;
575      CARD32 padl7;
576      CARD32 padl8;
577    } videoNotify;
578    struct {
579      BYTE type;
580      BYTE padb1;
581      CARD16 sequenceNumber;
582      Time time;
583      XvPortID port;
584      Atom attribute;
585      INT32 value;
586      CARD32 padl6;
587      CARD32 padl7;
588      CARD32 padl8;
589    } portNotify;
590  } u;
591} xvEvent;
592
593#undef XvPortID
594#undef XvEncodingID
595#undef ShmSeg
596#undef VisualID
597#undef Drawable
598#undef GContext
599#undef Time
600#undef Atom
601
602#endif /* XVPROTO_H */
603
604