| 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 (*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, CARD16, CARD16); |
| 185 | int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr, |
| 186 | CARD16 *, CARD16 *, int *, int *); |
| 187 | DevUnion devPriv; |
| 188 | } XvAdaptorRec, *XvAdaptorPtr; |
| 189 | |
| 190 | typedef struct _XvPortRec { |
| 191 | unsigned long id; |
| 192 | XvAdaptorPtr pAdaptor; |
| 193 | XvPortNotifyPtr pNotify; |
| 194 | DrawablePtr pDraw; |
| 195 | ClientPtr client; |
| 196 | XvGrabRec grab; |
| 197 | TimeStamp time; |
| 198 | DevUnion devPriv; |
| 199 | } XvPortRec, *XvPortPtr; |
| 200 | |
| 201 | #define VALIDATE_XV_PORT(portID, pPort, mode)\ |
| 202 | {\ |
| 203 | int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\ |
| 204 | XvRTPort, client, mode);\ |
| 205 | if (rc != Success)\ |
| 206 | return rc;\ |
| 207 | } |
| 208 | |
| 209 | typedef struct { |
| 210 | int version, revision; |
| 211 | int nAdaptors; |
| 212 | XvAdaptorPtr pAdaptors; |
| 213 | DestroyWindowProcPtr DestroyWindow; |
| 214 | DestroyPixmapProcPtr DestroyPixmap; |
| 215 | CloseScreenProcPtr CloseScreen; |
| 216 | Bool (*ddCloseScreen) (ScreenPtr); |
| 217 | int (*ddQueryAdaptors) (ScreenPtr, XvAdaptorPtr *, int *); |
| 218 | DevUnion devPriv; |
| 219 | } XvScreenRec, *XvScreenPtr; |
| 220 | |
| 221 | #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \ |
| 222 | dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field) |
| 223 | |
| 224 | #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ |
| 225 | ((pScreen)->field = wrapper) |
| 226 | |
| 227 | /* Errors */ |
| 228 | |
| 229 | #define _XvBadPort (XvBadPort+XvErrorBase) |
| 230 | #define _XvBadEncoding (XvBadEncoding+XvErrorBase) |
| 231 | |
| 232 | extern _X_EXPORT int ProcXvDispatch(ClientPtr); |
| 233 | extern _X_EXPORT int SProcXvDispatch(ClientPtr); |
| 234 | |
| 235 | extern _X_EXPORT int XvScreenInit(ScreenPtr); |
| 236 | extern _X_EXPORT DevPrivateKey XvGetScreenKey(void); |
| 237 | extern _X_EXPORT unsigned long XvGetRTPort(void); |
| 238 | extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32); |
| 239 | extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int); |
| 240 | |
| 241 | extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, |
| 242 | INT16, INT16, CARD16, CARD16, |
| 243 | INT16, INT16, CARD16, CARD16); |
| 244 | extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, |
| 245 | INT16, INT16, CARD16, CARD16, |
| 246 | INT16, INT16, CARD16, CARD16); |
| 247 | extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, |
| 248 | INT16, INT16, CARD16, CARD16, |
| 249 | INT16, INT16, CARD16, CARD16); |
| 250 | extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, |
| 251 | INT16, INT16, CARD16, CARD16, |
| 252 | INT16, INT16, CARD16, CARD16); |
| 253 | extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, |
| 254 | INT16, INT16, CARD16, CARD16, |
| 255 | INT16, INT16, CARD16, CARD16, |
| 256 | XvImagePtr, unsigned char *, Bool, |
| 257 | CARD16, CARD16); |
| 258 | extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL); |
| 259 | extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL); |
| 260 | extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); |
| 261 | extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *); |
| 262 | extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr); |
| 263 | extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr); |
| 264 | extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr); |
| 265 | extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *); |
| 266 | extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time); |
| 267 | #endif /* XVDIX_H */ |