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 unsigned long XvExtensionGeneration;
|
---|
59 | extern unsigned long XvScreenGeneration;
|
---|
60 | extern unsigned long XvResourceGeneration;
|
---|
61 |
|
---|
62 | extern int XvReqCode;
|
---|
63 | extern int XvEventBase;
|
---|
64 | extern int XvErrorBase;
|
---|
65 |
|
---|
66 | extern unsigned long XvRTPort;
|
---|
67 | extern unsigned long XvRTEncoding;
|
---|
68 | extern unsigned long XvRTGrab;
|
---|
69 | extern unsigned long XvRTVideoNotify;
|
---|
70 | extern unsigned long XvRTVideoNotifyList;
|
---|
71 | extern unsigned long 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 (* ddAllocatePort)(unsigned long, struct _XvPortRec*,
|
---|
161 | struct _XvPortRec**);
|
---|
162 | int (* ddFreePort)(struct _XvPortRec*);
|
---|
163 | int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
164 | INT16, INT16, CARD16, CARD16,
|
---|
165 | INT16, INT16, CARD16, CARD16);
|
---|
166 | int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
167 | INT16, INT16, CARD16, CARD16,
|
---|
168 | INT16, INT16, CARD16, CARD16);
|
---|
169 | int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
170 | INT16, INT16, CARD16, CARD16,
|
---|
171 | INT16, INT16, CARD16, CARD16);
|
---|
172 | int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
|
---|
173 | INT16, INT16, CARD16, CARD16,
|
---|
174 | INT16, INT16, CARD16, CARD16);
|
---|
175 | int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr);
|
---|
176 | int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32);
|
---|
177 | int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*);
|
---|
178 | int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8,
|
---|
179 | CARD16, CARD16,CARD16, CARD16,
|
---|
180 | unsigned int*, unsigned int*);
|
---|
181 | int (* ddPutImage)(ClientPtr, DrawablePtr, struct _XvPortRec*, GCPtr,
|
---|
182 | INT16, INT16, CARD16, CARD16,
|
---|
183 | INT16, INT16, CARD16, CARD16,
|
---|
184 | XvImagePtr, unsigned char*, Bool,
|
---|
185 | CARD16, CARD16);
|
---|
186 | int (* ddQueryImageAttributes)(ClientPtr, struct _XvPortRec*, XvImagePtr,
|
---|
187 | CARD16*, CARD16*, int*, int*);
|
---|
188 | DevUnion devPriv;
|
---|
189 | } XvAdaptorRec, *XvAdaptorPtr;
|
---|
190 |
|
---|
191 | typedef struct _XvPortRec {
|
---|
192 | unsigned long id;
|
---|
193 | XvAdaptorPtr pAdaptor;
|
---|
194 | XvPortNotifyPtr pNotify;
|
---|
195 | DrawablePtr pDraw;
|
---|
196 | ClientPtr client;
|
---|
197 | XvGrabRec grab;
|
---|
198 | TimeStamp time;
|
---|
199 | DevUnion devPriv;
|
---|
200 | } XvPortRec, *XvPortPtr;
|
---|
201 |
|
---|
202 | #define LOOKUP_PORT(_id, client)\
|
---|
203 | ((XvPortPtr)LookupIDByType(_id, XvRTPort))
|
---|
204 |
|
---|
205 | #define LOOKUP_ENCODING(_id, client)\
|
---|
206 | ((XvEncodingPtr)LookupIDByType(_id, XvRTEncoding))
|
---|
207 |
|
---|
208 | #define LOOKUP_VIDEONOTIFY_LIST(_id, client)\
|
---|
209 | ((XvVideoNotifyPtr)LookupIDByType(_id, XvRTVideoNotifyList))
|
---|
210 |
|
---|
211 | #define LOOKUP_PORTNOTIFY_LIST(_id, client)\
|
---|
212 | ((XvPortNotifyPtr)LookupIDByType(_id, XvRTPortNotifyList))
|
---|
213 |
|
---|
214 | typedef struct {
|
---|
215 | int version, revision;
|
---|
216 | int nAdaptors;
|
---|
217 | XvAdaptorPtr pAdaptors;
|
---|
218 | DestroyWindowProcPtr DestroyWindow;
|
---|
219 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
220 | CloseScreenProcPtr CloseScreen;
|
---|
221 | Bool (* ddCloseScreen)(int, ScreenPtr);
|
---|
222 | int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
|
---|
223 | DevUnion devPriv;
|
---|
224 | } XvScreenRec, *XvScreenPtr;
|
---|
225 |
|
---|
226 | #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
---|
227 | dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
---|
228 |
|
---|
229 | #define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
---|
230 | ((pScreen)->field = wrapper)
|
---|
231 |
|
---|
232 | /* Errors */
|
---|
233 |
|
---|
234 | #define _XvBadPort (XvBadPort+XvErrorBase)
|
---|
235 | #define _XvBadEncoding (XvBadEncoding+XvErrorBase)
|
---|
236 |
|
---|
237 | extern int ProcXvDispatch(ClientPtr);
|
---|
238 | extern int SProcXvDispatch(ClientPtr);
|
---|
239 |
|
---|
240 | extern void XvExtensionInit(void);
|
---|
241 | extern int XvScreenInit(ScreenPtr);
|
---|
242 | extern DevPrivateKey XvGetScreenKey(void);
|
---|
243 | extern unsigned long XvGetRTPort(void);
|
---|
244 | extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
|
---|
245 | extern int XvdiVideoStopped(XvPortPtr, int);
|
---|
246 |
|
---|
247 | extern int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
248 | INT16, INT16, CARD16, CARD16,
|
---|
249 | INT16, INT16, CARD16, CARD16);
|
---|
250 | extern int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
251 | INT16, INT16, CARD16, CARD16,
|
---|
252 | INT16, INT16, CARD16, CARD16);
|
---|
253 | extern int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
254 | INT16, INT16, CARD16, CARD16,
|
---|
255 | INT16, INT16, CARD16, CARD16);
|
---|
256 | extern int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
257 | INT16, INT16, CARD16, CARD16,
|
---|
258 | INT16, INT16, CARD16, CARD16);
|
---|
259 | extern int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
---|
260 | INT16, INT16, CARD16, CARD16,
|
---|
261 | INT16, INT16, CARD16, CARD16,
|
---|
262 | XvImagePtr, unsigned char*, Bool,
|
---|
263 | CARD16, CARD16);
|
---|
264 | extern int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
|
---|
265 | extern int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
|
---|
266 | extern int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
|
---|
267 | extern int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
|
---|
268 | extern int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
---|
269 | extern int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
---|
270 | extern int XvdiMatchPort(XvPortPtr, DrawablePtr);
|
---|
271 | extern int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
|
---|
272 | extern int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
|
---|
273 |
|
---|
274 |
|
---|
275 | #if !defined(UNIXCPP)
|
---|
276 |
|
---|
277 | #define XVCALL(name) Xv##name
|
---|
278 |
|
---|
279 | #else
|
---|
280 |
|
---|
281 | #define XVCALL(name) Xv/**/name
|
---|
282 |
|
---|
283 | #endif
|
---|
284 |
|
---|
285 |
|
---|
286 | #endif /* XVDIX_H */
|
---|
287 |
|
---|