1 | /***********************************************************
|
---|
2 | Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
|
---|
3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
---|
4 |
|
---|
5 | All Rights Reserved
|
---|
6 |
|
---|
7 | Permission to use, copy, modify, and distribute this software and its
|
---|
8 | documentation for any purpose and without fee is hereby granted,
|
---|
9 | provided that the above copyright notice appear in all copies and that
|
---|
10 | both that copyright notice and this permission notice appear in
|
---|
11 | supporting documentation, and that the names of Digital or MIT not be
|
---|
12 | used in advertising or publicity pertaining to distribution of the
|
---|
13 | software without specific, written prior permission.
|
---|
14 |
|
---|
15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
21 | SOFTWARE.
|
---|
22 |
|
---|
23 | ******************************************************************/
|
---|
24 |
|
---|
25 | #ifndef XVDIX_H
|
---|
26 | #define XVDIX_H
|
---|
27 | /*
|
---|
28 | ** File:
|
---|
29 | **
|
---|
30 | ** xvdix.h --- Xv device independent header file
|
---|
31 | **
|
---|
32 | ** Author:
|
---|
33 | **
|
---|
34 | ** David Carver (Digital Workstation Engineering/Project Athena)
|
---|
35 | **
|
---|
36 | ** Revisions:
|
---|
37 | **
|
---|
38 | ** 29.08.91 Carver
|
---|
39 | ** - removed UnrealizeWindow wrapper unrealizing windows no longer
|
---|
40 | ** preempts video
|
---|
41 | **
|
---|
42 | ** 11.06.91 Carver
|
---|
43 | ** - changed SetPortControl to SetPortAttribute
|
---|
44 | ** - changed GetPortControl to GetPortAttribute
|
---|
45 | ** - changed QueryBestSize
|
---|
46 | **
|
---|
47 | ** 15.05.91 Carver
|
---|
48 | ** - version 2.0 upgrade
|
---|
49 | **
|
---|
50 | ** 24.01.91 Carver
|
---|
51 | ** - version 1.4 upgrade
|
---|
52 | **
|
---|
53 | */
|
---|
54 |
|
---|
55 | #include "scrnintstr.h"
|
---|
56 | #include <X11/extensions/Xvproto.h>
|
---|
57 |
|
---|
58 | extern _X_EXPORT unsigned long XvExtensionGeneration;
|
---|
59 | extern _X_EXPORT unsigned long XvScreenGeneration;
|
---|
60 | extern _X_EXPORT unsigned long XvResourceGeneration;
|
---|
61 |
|
---|
62 | extern _X_EXPORT int XvReqCode;
|
---|
63 | extern _X_EXPORT int XvEventBase;
|
---|
64 | extern _X_EXPORT int XvErrorBase;
|
---|
65 |
|
---|
66 | extern _X_EXPORT RESTYPE XvRTPort;
|
---|
67 | extern _X_EXPORT RESTYPE XvRTEncoding;
|
---|
68 | extern _X_EXPORT RESTYPE XvRTGrab;
|
---|
69 | extern _X_EXPORT RESTYPE XvRTVideoNotify;
|
---|
70 | extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
|
---|
71 | extern _X_EXPORT RESTYPE XvRTPortNotify;
|
---|
72 |
|
---|
73 | typedef struct {
|
---|
74 | int numerator;
|
---|
75 | int denominator;
|
---|
76 | } XvRationalRec, *XvRationalPtr;
|
---|
77 |
|
---|
78 | typedef struct {
|
---|
79 | char depth;
|
---|
80 | unsigned long visual;
|
---|
81 | } XvFormatRec, *XvFormatPtr;
|
---|
82 |
|
---|
83 | typedef struct {
|
---|
84 | unsigned long id;
|
---|
85 | ClientPtr client;
|
---|
86 | } XvGrabRec, *XvGrabPtr;
|
---|
87 |
|
---|
88 | typedef struct _XvVideoNotifyRec {
|
---|
89 | struct _XvVideoNotifyRec *next;
|
---|
90 | ClientPtr client;
|
---|
91 | unsigned long id;
|
---|
92 | unsigned long mask;
|
---|
93 | } XvVideoNotifyRec, *XvVideoNotifyPtr;
|
---|
94 |
|
---|
95 | typedef struct _XvPortNotifyRec {
|
---|
96 | struct _XvPortNotifyRec *next;
|
---|
97 | ClientPtr client;
|
---|
98 | unsigned long id;
|
---|
99 | } XvPortNotifyRec, *XvPortNotifyPtr;
|
---|
100 |
|
---|
101 | typedef struct {
|
---|
102 | int id;
|
---|
103 | ScreenPtr pScreen;
|
---|
104 | char *name;
|
---|
105 | unsigned short width, height;
|
---|
106 | XvRationalRec rate;
|
---|
107 | } XvEncodingRec, *XvEncodingPtr;
|
---|
108 |
|
---|
109 | typedef struct _XvAttributeRec {
|
---|
110 | int flags;
|
---|
111 | int min_value;
|
---|
112 | int max_value;
|
---|
113 | char *name;
|
---|
114 | } XvAttributeRec, *XvAttributePtr;
|
---|
115 |
|
---|
116 | typedef struct {
|
---|
117 | int id;
|
---|
118 | int type;
|
---|
119 | int byte_order;
|
---|
120 | char guid[16];
|
---|
121 | int bits_per_pixel;
|
---|
122 | int format;
|
---|
123 | int num_planes;
|
---|
124 |
|
---|
125 | /* for RGB formats only */
|
---|
126 | int depth;
|
---|
127 | unsigned int red_mask;
|
---|
128 | unsigned int green_mask;
|
---|
129 | unsigned int blue_mask;
|
---|
130 |
|
---|
131 | /* for YUV formats only */
|
---|
132 | unsigned int y_sample_bits;
|
---|
133 | unsigned int u_sample_bits;
|
---|
134 | unsigned int v_sample_bits;
|
---|
135 | unsigned int horz_y_period;
|
---|
136 | unsigned int horz_u_period;
|
---|
137 | unsigned int horz_v_period;
|
---|
138 | unsigned int vert_y_period;
|
---|
139 | unsigned int vert_u_period;
|
---|
140 | unsigned int vert_v_period;
|
---|
141 | char component_order[32];
|
---|
142 | int scanline_order;
|
---|
143 | } XvImageRec, *XvImagePtr;
|
---|
144 |
|
---|
145 | typedef struct {
|
---|
146 | unsigned long base_id;
|
---|
147 | unsigned char type;
|
---|
148 | char *name;
|
---|
149 | int nEncodings;
|
---|
150 | XvEncodingPtr pEncodings;
|
---|
151 | int nFormats;
|
---|
152 | XvFormatPtr pFormats;
|
---|
153 | int nAttributes;
|
---|
154 | XvAttributePtr pAttributes;
|
---|
155 | int nImages;
|
---|
156 | XvImagePtr pImages;
|
---|
157 | int nPorts;
|
---|
158 | struct _XvPortRec *pPorts;
|
---|
159 | ScreenPtr pScreen;
|
---|
160 | int (*ddPutVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
---|
161 | INT16, INT16, CARD16, CARD16,
|
---|
162 | INT16, INT16, CARD16, CARD16);
|
---|
163 | int (*ddPutStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
---|
164 | INT16, INT16, CARD16, CARD16,
|
---|
165 | INT16, INT16, CARD16, CARD16);
|
---|
166 | int (*ddGetVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
---|
167 | INT16, INT16, CARD16, CARD16,
|
---|
168 | INT16, INT16, CARD16, CARD16);
|
---|
169 | int (*ddGetStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
---|
170 | INT16, INT16, CARD16, CARD16,
|
---|
171 | INT16, INT16, CARD16, CARD16);
|
---|
172 | int (*ddStopVideo) (struct _XvPortRec *, DrawablePtr);
|
---|
173 | int (*ddSetPortAttribute) (struct _XvPortRec *, Atom, INT32);
|
---|
174 | int (*ddGetPortAttribute) (struct _XvPortRec *, Atom, INT32 *);
|
---|
175 | int (*ddQueryBestSize) (struct _XvPortRec *, CARD8,
|
---|
176 | CARD16, CARD16, CARD16, CARD16,
|
---|
177 | unsigned int *, unsigned int *);
|
---|
178 | int (*ddPutImage) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
---|
179 | INT16, INT16, CARD16, CARD16,
|
---|
180 | INT16, INT16, CARD16, CARD16,
|
---|
181 | XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
|
---|
182 | int (*ddQueryImageAttributes) (struct _XvPortRec *, XvImagePtr,
|
---|
183 | CARD16 *, CARD16 *, int *, int *);
|
---|
184 | DevUnion devPriv;
|
---|
185 | } XvAdaptorRec, *XvAdaptorPtr;
|
---|
186 |
|
---|
187 | typedef struct _XvPortRec {
|
---|
188 | unsigned long id;
|
---|
189 | XvAdaptorPtr pAdaptor;
|
---|
190 | XvPortNotifyPtr pNotify;
|
---|
191 | DrawablePtr pDraw;
|
---|
192 | ClientPtr client;
|
---|
193 | XvGrabRec grab;
|
---|
194 | TimeStamp time;
|
---|
195 | DevUnion devPriv;
|
---|
196 | } XvPortRec, *XvPortPtr;
|
---|
197 |
|
---|
198 | #define VALIDATE_XV_PORT(portID, pPort, mode)\
|
---|
199 | {\
|
---|
200 | int rc = dixLookupResourceByType((void **)&(pPort), portID,\
|
---|
201 | XvRTPort, client, mode);\
|
---|
202 | if (rc != Success)\
|
---|
203 | return rc;\
|
---|
204 | }
|
---|
205 |
|
---|
206 | typedef struct {
|
---|
207 | int version, revision;
|
---|
208 | int nAdaptors;
|
---|
209 | XvAdaptorPtr pAdaptors;
|
---|
210 | DestroyWindowProcPtr DestroyWindow;
|
---|
211 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
212 | CloseScreenProcPtr CloseScreen;
|
---|
213 | } XvScreenRec, *XvScreenPtr;
|
---|
214 |
|
---|
215 | #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
---|
216 | dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
---|
217 |
|
---|
218 | #define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
---|
219 | ((pScreen)->field = wrapper)
|
---|
220 |
|
---|
221 | /* Errors */
|
---|
222 |
|
---|
223 | #define _XvBadPort (XvBadPort+XvErrorBase)
|
---|
224 | #define _XvBadEncoding (XvBadEncoding+XvErrorBase)
|
---|
225 |
|
---|
226 | extern _X_EXPORT int ProcXvDispatch(ClientPtr);
|
---|
227 | extern _X_EXPORT int SProcXvDispatch(ClientPtr);
|
---|
228 |
|
---|
229 | extern _X_EXPORT int XvScreenInit(ScreenPtr);
|
---|
230 | extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
|
---|
231 | extern _X_EXPORT unsigned long XvGetRTPort(void);
|
---|
232 | extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
|
---|
233 | extern void _X_EXPORT XvFillColorKey(DrawablePtr pDraw, CARD32 key,
|
---|
234 | RegionPtr region);
|
---|
235 | extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
|
---|
236 |
|
---|
237 | extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
238 | INT16, INT16, CARD16, CARD16,
|
---|
239 | INT16, INT16, CARD16, CARD16);
|
---|
240 | extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
241 | INT16, INT16, CARD16, CARD16,
|
---|
242 | INT16, INT16, CARD16, CARD16);
|
---|
243 | extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
244 | INT16, INT16, CARD16, CARD16,
|
---|
245 | INT16, INT16, CARD16, CARD16);
|
---|
246 | extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
247 | INT16, INT16, CARD16, CARD16,
|
---|
248 | INT16, INT16, CARD16, CARD16);
|
---|
249 | extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
250 | INT16, INT16, CARD16, CARD16,
|
---|
251 | INT16, INT16, CARD16, CARD16,
|
---|
252 | XvImagePtr, unsigned char *, Bool,
|
---|
253 | CARD16, CARD16);
|
---|
254 | extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
|
---|
255 | extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
|
---|
256 | extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
|
---|
257 | extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
|
---|
258 | extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
---|
259 | extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
|
---|
260 | extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
|
---|
261 | extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
|
---|
262 | #endif /* XVDIX_H */
|
---|