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