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 | #ifndef XorgLoader
|
---|
59 | extern _X_EXPORT unsigned long XvExtensionGeneration;
|
---|
60 | extern _X_EXPORT unsigned long XvScreenGeneration;
|
---|
61 | extern _X_EXPORT unsigned long XvResourceGeneration;
|
---|
62 |
|
---|
63 | extern _X_EXPORT int XvReqCode;
|
---|
64 | extern _X_EXPORT int XvEventBase;
|
---|
65 | extern _X_EXPORT int XvErrorBase;
|
---|
66 |
|
---|
67 | extern _X_EXPORT unsigned long XvRTPort;
|
---|
68 | extern _X_EXPORT unsigned long XvRTEncoding;
|
---|
69 | extern _X_EXPORT unsigned long XvRTGrab;
|
---|
70 | extern _X_EXPORT unsigned long XvRTVideoNotify;
|
---|
71 | extern _X_EXPORT unsigned long XvRTVideoNotifyList;
|
---|
72 | extern _X_EXPORT unsigned long XvRTPortNotify;
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | typedef struct {
|
---|
76 | int numerator;
|
---|
77 | int denominator;
|
---|
78 | } XvRationalRec, *XvRationalPtr;
|
---|
79 |
|
---|
80 | typedef struct {
|
---|
81 | char depth;
|
---|
82 | unsigned long visual;
|
---|
83 | } XvFormatRec, *XvFormatPtr;
|
---|
84 |
|
---|
85 | typedef struct {
|
---|
86 | unsigned long id;
|
---|
87 | ClientPtr client;
|
---|
88 | } XvGrabRec, *XvGrabPtr;
|
---|
89 |
|
---|
90 | typedef struct _XvVideoNotifyRec {
|
---|
91 | struct _XvVideoNotifyRec *next;
|
---|
92 | ClientPtr client;
|
---|
93 | unsigned long id;
|
---|
94 | unsigned long mask;
|
---|
95 | } XvVideoNotifyRec, *XvVideoNotifyPtr;
|
---|
96 |
|
---|
97 | typedef struct _XvPortNotifyRec {
|
---|
98 | struct _XvPortNotifyRec *next;
|
---|
99 | ClientPtr client;
|
---|
100 | unsigned long id;
|
---|
101 | } XvPortNotifyRec, *XvPortNotifyPtr;
|
---|
102 |
|
---|
103 | typedef struct {
|
---|
104 | int id;
|
---|
105 | ScreenPtr pScreen;
|
---|
106 | char *name;
|
---|
107 | unsigned short width, height;
|
---|
108 | XvRationalRec rate;
|
---|
109 | } XvEncodingRec, *XvEncodingPtr;
|
---|
110 |
|
---|
111 | typedef struct _XvAttributeRec {
|
---|
112 | int flags;
|
---|
113 | int min_value;
|
---|
114 | int max_value;
|
---|
115 | char *name;
|
---|
116 | } XvAttributeRec, *XvAttributePtr;
|
---|
117 |
|
---|
118 | typedef struct {
|
---|
119 | int id;
|
---|
120 | int type;
|
---|
121 | int byte_order;
|
---|
122 | char guid[16];
|
---|
123 | int bits_per_pixel;
|
---|
124 | int format;
|
---|
125 | int num_planes;
|
---|
126 |
|
---|
127 | /* for RGB formats only */
|
---|
128 | int depth;
|
---|
129 | unsigned int red_mask;
|
---|
130 | unsigned int green_mask;
|
---|
131 | unsigned int blue_mask;
|
---|
132 |
|
---|
133 | /* for YUV formats only */
|
---|
134 | unsigned int y_sample_bits;
|
---|
135 | unsigned int u_sample_bits;
|
---|
136 | unsigned int v_sample_bits;
|
---|
137 | unsigned int horz_y_period;
|
---|
138 | unsigned int horz_u_period;
|
---|
139 | unsigned int horz_v_period;
|
---|
140 | unsigned int vert_y_period;
|
---|
141 | unsigned int vert_u_period;
|
---|
142 | unsigned int vert_v_period;
|
---|
143 | char component_order[32];
|
---|
144 | int scanline_order;
|
---|
145 | } XvImageRec, *XvImagePtr;
|
---|
146 |
|
---|
147 | typedef struct {
|
---|
148 | unsigned long base_id;
|
---|
149 | unsigned char type;
|
---|
150 | char *name;
|
---|
151 | int nEncodings;
|
---|
152 | XvEncodingPtr pEncodings;
|
---|
153 | int nFormats;
|
---|
154 | XvFormatPtr pFormats;
|
---|
155 | int nAttributes;
|
---|
156 | XvAttributePtr pAttributes;
|
---|
157 | int nImages;
|
---|
158 | XvImagePtr pImages;
|
---|
159 | int nPorts;
|
---|
160 | struct _XvPortRec *pPorts;
|
---|
161 | ScreenPtr pScreen;
|
---|
162 | int (* ddAllocatePort)(unsigned long, struct _XvPortRec*,
|
---|
163 | struct _XvPortRec**);
|
---|
164 | int (* ddFreePort)(struct _XvPortRec*);
|
---|
165 | int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
166 | INT16, INT16, CARD16, CARD16,
|
---|
167 | INT16, INT16, CARD16, CARD16);
|
---|
168 | int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
169 | INT16, INT16, CARD16, CARD16,
|
---|
170 | INT16, INT16, CARD16, CARD16);
|
---|
171 | int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
172 | INT16, INT16, CARD16, CARD16,
|
---|
173 | INT16, INT16, CARD16, CARD16);
|
---|
174 | int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
175 | INT16, INT16, CARD16, CARD16,
|
---|
176 | INT16, INT16, CARD16, CARD16);
|
---|
177 | int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr);
|
---|
178 | int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32);
|
---|
179 | int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*);
|
---|
180 | int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8,
|
---|
181 | CARD16, CARD16,CARD16, CARD16,
|
---|
182 | unsigned int*, unsigned int*);
|
---|
183 | int (* ddPutImage)(ClientPtr, DrawablePtr, struct _XvPortRec*, GCPtr,
|
---|
184 | INT16, INT16, CARD16, CARD16,
|
---|
185 | INT16, INT16, CARD16, CARD16,
|
---|
186 | XvImagePtr, unsigned char*, Bool,
|
---|
187 | CARD16, CARD16);
|
---|
188 | int (* ddQueryImageAttributes)(ClientPtr, struct _XvPortRec*, XvImagePtr,
|
---|
189 | CARD16*, CARD16*, int*, int*);
|
---|
190 | DevUnion devPriv;
|
---|
191 | } XvAdaptorRec, *XvAdaptorPtr;
|
---|
192 |
|
---|
193 | typedef struct _XvPortRec {
|
---|
194 | unsigned long id;
|
---|
195 | XvAdaptorPtr pAdaptor;
|
---|
196 | XvPortNotifyPtr pNotify;
|
---|
197 | DrawablePtr pDraw;
|
---|
198 | ClientPtr client;
|
---|
199 | XvGrabRec grab;
|
---|
200 | TimeStamp time;
|
---|
201 | DevUnion devPriv;
|
---|
202 | } XvPortRec, *XvPortPtr;
|
---|
203 |
|
---|
204 | #define VALIDATE_XV_PORT(portID, pPort, mode)\
|
---|
205 | {\
|
---|
206 | int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\
|
---|
207 | XvRTPort, client, mode);\
|
---|
208 | if (rc != Success)\
|
---|
209 | return rc;\
|
---|
210 | }
|
---|
211 |
|
---|
212 | typedef struct {
|
---|
213 | int version, revision;
|
---|
214 | int nAdaptors;
|
---|
215 | XvAdaptorPtr pAdaptors;
|
---|
216 | DestroyWindowProcPtr DestroyWindow;
|
---|
217 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
218 | CloseScreenProcPtr CloseScreen;
|
---|
219 | Bool (* ddCloseScreen)(int, ScreenPtr);
|
---|
220 | int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
|
---|
221 | DevUnion devPriv;
|
---|
222 | } XvScreenRec, *XvScreenPtr;
|
---|
223 |
|
---|
224 | #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
---|
225 | dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
---|
226 |
|
---|
227 | #define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
---|
228 | ((pScreen)->field = wrapper)
|
---|
229 |
|
---|
230 | /* Errors */
|
---|
231 |
|
---|
232 | #define _XvBadPort (XvBadPort+XvErrorBase)
|
---|
233 | #define _XvBadEncoding (XvBadEncoding+XvErrorBase)
|
---|
234 |
|
---|
235 | #ifndef XorgLoader
|
---|
236 | extern _X_EXPORT int ProcXvDispatch(ClientPtr);
|
---|
237 | extern _X_EXPORT int SProcXvDispatch(ClientPtr);
|
---|
238 |
|
---|
239 | extern _X_EXPORT void XvExtensionInit(void);
|
---|
240 | extern _X_EXPORT int XvScreenInit(ScreenPtr);
|
---|
241 | extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
|
---|
242 | extern _X_EXPORT unsigned long XvGetRTPort(void);
|
---|
243 | extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
|
---|
244 | extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
|
---|
245 |
|
---|
246 | extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
247 | INT16, INT16, CARD16, CARD16,
|
---|
248 | INT16, INT16, CARD16, CARD16);
|
---|
249 | extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
250 | INT16, INT16, CARD16, CARD16,
|
---|
251 | INT16, INT16, CARD16, CARD16);
|
---|
252 | extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
253 | INT16, INT16, CARD16, CARD16,
|
---|
254 | INT16, INT16, CARD16, CARD16);
|
---|
255 | extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
256 | INT16, INT16, CARD16, CARD16,
|
---|
257 | INT16, INT16, CARD16, CARD16);
|
---|
258 | extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
259 | INT16, INT16, CARD16, CARD16,
|
---|
260 | INT16, INT16, CARD16, CARD16,
|
---|
261 | XvImagePtr, unsigned char*, Bool,
|
---|
262 | CARD16, CARD16);
|
---|
263 | extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
|
---|
264 | extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
|
---|
265 | extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
|
---|
266 | extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
|
---|
267 | extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
---|
268 | extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
---|
269 | extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
|
---|
270 | extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
|
---|
271 | extern _X_EXPORT int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
|
---|
272 | #endif /* XorgLoader */
|
---|
273 |
|
---|
274 | #endif /* XVDIX_H */
|
---|
275 |
|
---|