Mercurial > sdl-ios-xcode
diff src/video/Xext/Xv/Xv.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | ecba4bbaf9c2 |
children | 4da1ee79c9af |
line wrap: on
line diff
--- a/src/video/Xext/Xv/Xv.c Sun May 21 17:27:13 2006 +0000 +++ b/src/video/Xext/Xv/Xv.c Sun May 28 13:04:16 2006 +0000 @@ -63,1089 +63,1037 @@ #define XvCheckExtension(dpy, i, val) \ XextCheckExtension(dpy, i, xv_extension_name, val) -static char *xv_error_string(); -static int xv_close_display(); -static Bool xv_wire_to_event(); +static char *xv_error_string (); +static int xv_close_display (); +static Bool xv_wire_to_event (); static XExtensionHooks xv_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - xv_close_display, /* close_display */ - xv_wire_to_event, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - xv_error_string /* error_string */ + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + xv_close_display, /* close_display */ + xv_wire_to_event, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + xv_error_string /* error_string */ }; -static char *xv_error_list[] = -{ - "BadPort", /* XvBadPort */ - "BadEncoding", /* XvBadEncoding */ - "BadControl" /* XvBadControl */ +static char *xv_error_list[] = { + "BadPort", /* XvBadPort */ + "BadEncoding", /* XvBadEncoding */ + "BadControl" /* XvBadControl */ }; -static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) - +static +XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) + static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, + xv_extension_name, + &xv_extension_hooks, + XvNumEvents, NULL) + static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, + XvNumErrors, xv_error_list) + int SDL_NAME (XvQueryExtension) (Display * dpy, + unsigned int *p_version, + unsigned int *p_revision, + unsigned int *p_requestBase, + unsigned int *p_eventBase, + unsigned int *p_errorBase) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvQueryExtensionReq *req; + xvQueryExtensionReply rep; -static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, - xv_extension_name, - &xv_extension_hooks, - XvNumEvents, NULL) - - -static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, - XvNumErrors, xv_error_list) - + XvCheckExtension (dpy, info, XvBadExtension); -int -SDL_NAME(XvQueryExtension)( - Display *dpy, - unsigned int *p_version, - unsigned int *p_revision, - unsigned int *p_requestBase, - unsigned int *p_eventBase, - unsigned int *p_errorBase -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryExtensionReq *req; - xvQueryExtensionReply rep; + LockDisplay (dpy); + + XvGetReq (QueryExtension, req); - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); + if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return XvBadExtension; + } - XvGetReq(QueryExtension, req); - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return XvBadExtension; - } + *p_version = rep.version; + *p_revision = rep.revision; + *p_requestBase = info->codes->major_opcode; + *p_eventBase = info->codes->first_event; + *p_errorBase = info->codes->first_error; - *p_version = rep.version; - *p_revision = rep.revision; - *p_requestBase = info->codes->major_opcode; - *p_eventBase = info->codes->first_event; - *p_errorBase = info->codes->first_error; + UnlockDisplay (dpy); + SyncHandle (); - UnlockDisplay(dpy); - SyncHandle(); - - return Success; + return Success; } int -SDL_NAME(XvQueryAdaptors)( - Display *dpy, - Window window, - unsigned int *p_nAdaptors, - SDL_NAME(XvAdaptorInfo) **p_pAdaptors -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryAdaptorsReq *req; - xvQueryAdaptorsReply rep; - int size,ii,jj; - char *name; - SDL_NAME(XvAdaptorInfo) *pas, *pa; - SDL_NAME(XvFormat) *pfs, *pf; - char *buffer; - union +SDL_NAME (XvQueryAdaptors) (Display * dpy, + Window window, + unsigned int *p_nAdaptors, + SDL_NAME (XvAdaptorInfo) ** p_pAdaptors) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvQueryAdaptorsReq *req; + xvQueryAdaptorsReply rep; + int size, ii, jj; + char *name; + SDL_NAME (XvAdaptorInfo) * pas, *pa; + SDL_NAME (XvFormat) * pfs, *pf; + char *buffer; + union { - char *buffer; - char *string; - xvAdaptorInfo *pa; - xvFormat *pf; + char *buffer; + char *string; + xvAdaptorInfo *pa; + xvFormat *pf; } u; - - XvCheckExtension(dpy, info, XvBadExtension); - LockDisplay(dpy); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); - XvGetReq(QueryAdaptors, req); - req->window = window; + XvGetReq (QueryAdaptors, req); + req->window = window; - /* READ THE REPLY */ + /* READ THE REPLY */ - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadReply); - } + if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadReply); + } - size = rep.length << 2; - if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } - _XRead (dpy, buffer, size); + size = rep.length << 2; + if ((buffer = (char *) Xmalloc ((unsigned) size)) == NULL) { + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } + _XRead (dpy, buffer, size); - u.buffer = buffer; + u.buffer = buffer; - /* GET INPUT ADAPTORS */ + /* GET INPUT ADAPTORS */ - if (rep.num_adaptors == 0) { - pas = NULL; - } else { - size = rep.num_adaptors*sizeof(SDL_NAME(XvAdaptorInfo)); - if ((pas=(SDL_NAME(XvAdaptorInfo) *)Xmalloc(size))==NULL) { - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } - } + if (rep.num_adaptors == 0) { + pas = NULL; + } else { + size = rep.num_adaptors * sizeof (SDL_NAME (XvAdaptorInfo)); + if ((pas = (SDL_NAME (XvAdaptorInfo) *) Xmalloc (size)) == NULL) { + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } + } - /* INIT ADAPTOR FIELDS */ + /* INIT ADAPTOR FIELDS */ - pa = pas; - for (ii=0; ii<rep.num_adaptors; ii++) { - pa->num_adaptors = 0; - pa->name = (char *)NULL; - pa->formats = (SDL_NAME(XvFormat) *)NULL; - pa++; - } + pa = pas; + for (ii = 0; ii < rep.num_adaptors; ii++) { + pa->num_adaptors = 0; + pa->name = (char *) NULL; + pa->formats = (SDL_NAME (XvFormat) *) NULL; + pa++; + } - pa = pas; - for (ii=0; ii<rep.num_adaptors; ii++) { - pa->type = u.pa->type; - pa->base_id = u.pa->base_id; - pa->num_ports = u.pa->num_ports; - pa->num_formats = u.pa->num_formats; - pa->num_adaptors = rep.num_adaptors - ii; + pa = pas; + for (ii = 0; ii < rep.num_adaptors; ii++) { + pa->type = u.pa->type; + pa->base_id = u.pa->base_id; + pa->num_ports = u.pa->num_ports; + pa->num_formats = u.pa->num_formats; + pa->num_adaptors = rep.num_adaptors - ii; - /* GET ADAPTOR NAME */ + /* GET ADAPTOR NAME */ - size = u.pa->name_size; - u.buffer += (sz_xvAdaptorInfo + 3) & ~3; + size = u.pa->name_size; + u.buffer += (sz_xvAdaptorInfo + 3) & ~3; - if ( (name = (char *)Xmalloc(size+1)) == NULL) - { - SDL_NAME(XvFreeAdaptorInfo)(pas); - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } - SDL_strlcpy(name, u.string, size); - pa->name = name; + if ((name = (char *) Xmalloc (size + 1)) == NULL) { + SDL_NAME (XvFreeAdaptorInfo) (pas); + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } + SDL_strlcpy (name, u.string, size); + pa->name = name; - u.buffer += (size + 3) & ~3; + u.buffer += (size + 3) & ~3; - /* GET FORMATS */ + /* GET FORMATS */ - size = pa->num_formats*sizeof(SDL_NAME(XvFormat)); - if ((pfs=(SDL_NAME(XvFormat) *)Xmalloc(size))==NULL) { - SDL_NAME(XvFreeAdaptorInfo)(pas); - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } + size = pa->num_formats * sizeof (SDL_NAME (XvFormat)); + if ((pfs = (SDL_NAME (XvFormat) *) Xmalloc (size)) == NULL) { + SDL_NAME (XvFreeAdaptorInfo) (pas); + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } + + pf = pfs; + for (jj = 0; jj < pa->num_formats; jj++) { + pf->depth = u.pf->depth; + pf->visual_id = u.pf->visual; + pf++; - pf = pfs; - for (jj=0; jj<pa->num_formats; jj++) { - pf->depth = u.pf->depth; - pf->visual_id = u.pf->visual; - pf++; - - u.buffer += (sz_xvFormat + 3) & ~3; - } + u.buffer += (sz_xvFormat + 3) & ~3; + } - pa->formats = pfs; + pa->formats = pfs; + + pa++; + + } - pa++; - - } + *p_nAdaptors = rep.num_adaptors; + *p_pAdaptors = pas; - *p_nAdaptors = rep.num_adaptors; - *p_pAdaptors = pas; + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); + return (Success); } -void -SDL_NAME(XvFreeAdaptorInfo)(SDL_NAME(XvAdaptorInfo) *pAdaptors) +void SDL_NAME (XvFreeAdaptorInfo) (SDL_NAME (XvAdaptorInfo) * pAdaptors) { - SDL_NAME(XvAdaptorInfo) *pa; - int ii; + SDL_NAME (XvAdaptorInfo) * pa; + int ii; - if (!pAdaptors) return; + if (!pAdaptors) + return; - pa = pAdaptors; + pa = pAdaptors; - for (ii=0; ii<pAdaptors->num_adaptors; ii++, pa++) - { - if (pa->name) - { - Xfree(pa->name); - } - if (pa->formats) - { - Xfree(pa->formats); - } - } + for (ii = 0; ii < pAdaptors->num_adaptors; ii++, pa++) { + if (pa->name) { + Xfree (pa->name); + } + if (pa->formats) { + Xfree (pa->formats); + } + } - Xfree(pAdaptors); + Xfree (pAdaptors); } int -SDL_NAME(XvQueryEncodings)( - Display *dpy, - XvPortID port, - unsigned int *p_nEncodings, - SDL_NAME(XvEncodingInfo) **p_pEncodings -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryEncodingsReq *req; - xvQueryEncodingsReply rep; - int size, jj; - char *name; - SDL_NAME(XvEncodingInfo) *pes, *pe; - char *buffer; - union +SDL_NAME (XvQueryEncodings) (Display * dpy, + XvPortID port, + unsigned int *p_nEncodings, + SDL_NAME (XvEncodingInfo) ** p_pEncodings) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvQueryEncodingsReq *req; + xvQueryEncodingsReply rep; + int size, jj; + char *name; + SDL_NAME (XvEncodingInfo) * pes, *pe; + char *buffer; + union { - char *buffer; - char *string; - xvEncodingInfo *pe; + char *buffer; + char *string; + xvEncodingInfo *pe; } u; - - XvCheckExtension(dpy, info, XvBadExtension); + + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); - LockDisplay(dpy); + XvGetReq (QueryEncodings, req); + req->port = port; + + /* READ THE REPLY */ - XvGetReq(QueryEncodings, req); - req->port = port; - - /* READ THE REPLY */ + if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadReply); + } - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadReply); - } + size = rep.length << 2; + if ((buffer = (char *) Xmalloc ((unsigned) size)) == NULL) { + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } + _XRead (dpy, buffer, size); - size = rep.length << 2; - if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } - _XRead (dpy, buffer, size); + u.buffer = buffer; - u.buffer = buffer; - - /* GET ENCODINGS */ + /* GET ENCODINGS */ - size = rep.num_encodings*sizeof(SDL_NAME(XvEncodingInfo)); - if ( (pes = (SDL_NAME(XvEncodingInfo) *)Xmalloc(size)) == NULL) { - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } + size = rep.num_encodings * sizeof (SDL_NAME (XvEncodingInfo)); + if ((pes = (SDL_NAME (XvEncodingInfo) *) Xmalloc (size)) == NULL) { + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } - /* INITIALIZE THE ENCODING POINTER */ + /* INITIALIZE THE ENCODING POINTER */ - pe = pes; - for (jj=0; jj<rep.num_encodings; jj++) { - pe->name = (char *)NULL; - pe->num_encodings = 0; - pe++; - } + pe = pes; + for (jj = 0; jj < rep.num_encodings; jj++) { + pe->name = (char *) NULL; + pe->num_encodings = 0; + pe++; + } - pe = pes; - for (jj=0; jj<rep.num_encodings; jj++) { - pe->encoding_id = u.pe->encoding; - pe->width = u.pe->width; - pe->height = u.pe->height; - pe->rate.numerator = u.pe->rate.numerator; - pe->rate.denominator = u.pe->rate.denominator; - pe->num_encodings = rep.num_encodings - jj; + pe = pes; + for (jj = 0; jj < rep.num_encodings; jj++) { + pe->encoding_id = u.pe->encoding; + pe->width = u.pe->width; + pe->height = u.pe->height; + pe->rate.numerator = u.pe->rate.numerator; + pe->rate.denominator = u.pe->rate.denominator; + pe->num_encodings = rep.num_encodings - jj; - size = u.pe->name_size; - u.buffer += (sz_xvEncodingInfo + 3) & ~3; + size = u.pe->name_size; + u.buffer += (sz_xvEncodingInfo + 3) & ~3; - if ( (name = (char *)Xmalloc(size+1)) == NULL) { - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadAlloc); - } - SDL_strlcpy(name, u.string, size); - pe->name = name; - pe++; + if ((name = (char *) Xmalloc (size + 1)) == NULL) { + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadAlloc); + } + SDL_strlcpy (name, u.string, size); + pe->name = name; + pe++; - u.buffer += (size + 3) & ~3; - } + u.buffer += (size + 3) & ~3; + } - *p_nEncodings = rep.num_encodings; - *p_pEncodings = pes; + *p_nEncodings = rep.num_encodings; + *p_pEncodings = pes; - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); + Xfree (buffer); + UnlockDisplay (dpy); + SyncHandle (); - return (Success); + return (Success); } -void -SDL_NAME(XvFreeEncodingInfo)(SDL_NAME(XvEncodingInfo) *pEncodings) +void SDL_NAME (XvFreeEncodingInfo) (SDL_NAME (XvEncodingInfo) * pEncodings) { - SDL_NAME(XvEncodingInfo) *pe; - int ii; + SDL_NAME (XvEncodingInfo) * pe; + int ii; - if (!pEncodings) return; + if (!pEncodings) + return; - pe = pEncodings; + pe = pEncodings; - for (ii=0; ii<pEncodings->num_encodings; ii++, pe++) { - if (pe->name) Xfree(pe->name); - } + for (ii = 0; ii < pEncodings->num_encodings; ii++, pe++) { + if (pe->name) + Xfree (pe->name); + } - Xfree(pEncodings); + Xfree (pEncodings); } int -SDL_NAME(XvPutVideo)( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - int vx, int vy, - unsigned int vw, unsigned int vh, - int dx, int dy, - unsigned int dw, unsigned int dh -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvPutVideoReq *req; +SDL_NAME (XvPutVideo) (Display * dpy, + XvPortID port, + Drawable d, + GC gc, + int vx, int vy, + unsigned int vw, unsigned int vh, + int dx, int dy, unsigned int dw, unsigned int dh) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvPutVideoReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); - LockDisplay(dpy); - - FlushGC(dpy, gc); + LockDisplay (dpy); + + FlushGC (dpy, gc); - XvGetReq(PutVideo, req); + XvGetReq (PutVideo, req); - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->vid_x = vx; - req->vid_y = vy; - req->vid_w = vw; - req->vid_h = vh; - req->drw_x = dx; - req->drw_y = dy; - req->drw_w = dw; - req->drw_h = dh; + req->port = port; + req->drawable = d; + req->gc = gc->gid; + req->vid_x = vx; + req->vid_y = vy; + req->vid_w = vw; + req->vid_h = vh; + req->drw_x = dx; + req->drw_y = dy; + req->drw_w = dw; + req->drw_h = dh; - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return Success; + return Success; } int -SDL_NAME(XvPutStill)( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - int vx, int vy, - unsigned int vw, unsigned int vh, - int dx, int dy, - unsigned int dw, unsigned int dh -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvPutStillReq *req; +SDL_NAME (XvPutStill) (Display * dpy, + XvPortID port, + Drawable d, + GC gc, + int vx, int vy, + unsigned int vw, unsigned int vh, + int dx, int dy, unsigned int dw, unsigned int dh) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvPutStillReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); - LockDisplay(dpy); + LockDisplay (dpy); + + FlushGC (dpy, gc); - FlushGC(dpy, gc); + XvGetReq (PutStill, req); + req->port = port; + req->drawable = d; + req->gc = gc->gid; + req->vid_x = vx; + req->vid_y = vy; + req->vid_w = vw; + req->vid_h = vh; + req->drw_x = dx; + req->drw_y = dy; + req->drw_w = dw; + req->drw_h = dh; - XvGetReq(PutStill, req); - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->vid_x = vx; - req->vid_y = vy; - req->vid_w = vw; - req->vid_h = vh; - req->drw_x = dx; - req->drw_y = dy; - req->drw_w = dw; - req->drw_h = dh; + UnlockDisplay (dpy); + SyncHandle (); - UnlockDisplay(dpy); - SyncHandle(); - - return Success; + return Success; } int -SDL_NAME(XvGetVideo)( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - int vx, int vy, - unsigned int vw, unsigned int vh, - int dx, int dy, - unsigned int dw, unsigned int dh -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvGetVideoReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - FlushGC(dpy, gc); +SDL_NAME (XvGetVideo) (Display * dpy, + XvPortID port, + Drawable d, + GC gc, + int vx, int vy, + unsigned int vw, unsigned int vh, + int dx, int dy, unsigned int dw, unsigned int dh) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvGetVideoReq *req; - XvGetReq(GetVideo, req); - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->vid_x = vx; - req->vid_y = vy; - req->vid_w = vw; - req->vid_h = vh; - req->drw_x = dx; - req->drw_y = dy; - req->drw_w = dw; - req->drw_h = dh; + XvCheckExtension (dpy, info, XvBadExtension); - UnlockDisplay(dpy); - SyncHandle(); + LockDisplay (dpy); - return Success; -} + FlushGC (dpy, gc); -int -SDL_NAME(XvGetStill)( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - int vx, int vy, - unsigned int vw, unsigned int vh, - int dx, int dy, - unsigned int dw, unsigned int dh -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvGetStillReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); + XvGetReq (GetVideo, req); + req->port = port; + req->drawable = d; + req->gc = gc->gid; + req->vid_x = vx; + req->vid_y = vy; + req->vid_w = vw; + req->vid_h = vh; + req->drw_x = dx; + req->drw_y = dy; + req->drw_w = dw; + req->drw_h = dh; - FlushGC(dpy, gc); + UnlockDisplay (dpy); + SyncHandle (); - XvGetReq(GetStill, req); - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->vid_x = vx; - req->vid_y = vy; - req->vid_w = vw; - req->vid_h = vh; - req->drw_x = dx; - req->drw_y = dy; - req->drw_w = dw; - req->drw_h = dh; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; + return Success; } int -SDL_NAME(XvStopVideo)( - Display *dpy, - XvPortID port, - Drawable draw -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvStopVideoReq *req; +SDL_NAME (XvGetStill) (Display * dpy, + XvPortID port, + Drawable d, + GC gc, + int vx, int vy, + unsigned int vw, unsigned int vh, + int dx, int dy, unsigned int dw, unsigned int dh) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvGetStillReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); + + FlushGC (dpy, gc); - LockDisplay(dpy); + XvGetReq (GetStill, req); + req->port = port; + req->drawable = d; + req->gc = gc->gid; + req->vid_x = vx; + req->vid_y = vy; + req->vid_w = vw; + req->vid_h = vh; + req->drw_x = dx; + req->drw_y = dy; + req->drw_w = dw; + req->drw_h = dh; - XvGetReq(StopVideo, req); - req->port = port; - req->drawable = draw; + UnlockDisplay (dpy); + SyncHandle (); - UnlockDisplay(dpy); - SyncHandle(); - - return Success; + return Success; } -int -SDL_NAME(XvGrabPort)( - Display *dpy, - XvPortID port, - Time time -){ - XExtDisplayInfo *info = xv_find_display(dpy); - int result; - xvGrabPortReply rep; - xvGrabPortReq *req; +int SDL_NAME (XvStopVideo) (Display * dpy, XvPortID port, Drawable draw) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvStopVideoReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); - LockDisplay(dpy); - - XvGetReq(GrabPort, req); - req->port = port; - req->time = time; + XvGetReq (StopVideo, req); + req->port = port; + req->drawable = draw; - if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) - rep.result = GrabSuccess; - - result = rep.result; + UnlockDisplay (dpy); + SyncHandle (); - UnlockDisplay(dpy); - SyncHandle(); - - return result; + return Success; } -int -SDL_NAME(XvUngrabPort)( - Display *dpy, - XvPortID port, - Time time -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvUngrabPortReq *req; +int SDL_NAME (XvGrabPort) (Display * dpy, XvPortID port, Time time) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + int result; + xvGrabPortReply rep; + xvGrabPortReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); - LockDisplay(dpy); + XvGetReq (GrabPort, req); + req->port = port; + req->time = time; + + if (_XReply (dpy, (xReply *) & rep, 0, xTrue) == 0) + rep.result = GrabSuccess; - XvGetReq(UngrabPort, req); - req->port = port; - req->time = time; + result = rep.result; - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return Success; + return result; } -int -SDL_NAME(XvSelectVideoNotify)( - Display *dpy, - Drawable drawable, - Bool onoff -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvSelectVideoNotifyReq *req; +int SDL_NAME (XvUngrabPort) (Display * dpy, XvPortID port, Time time) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvUngrabPortReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); - LockDisplay(dpy); + XvGetReq (UngrabPort, req); + req->port = port; + req->time = time; - XvGetReq(SelectVideoNotify, req); - req->drawable = drawable; - req->onoff = onoff; + UnlockDisplay (dpy); + SyncHandle (); - UnlockDisplay(dpy); - SyncHandle(); - - return Success; + return Success; } int -SDL_NAME(XvSelectPortNotify)( - Display *dpy, - XvPortID port, - Bool onoff -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvSelectPortNotifyReq *req; +SDL_NAME (XvSelectVideoNotify) (Display * dpy, Drawable drawable, Bool onoff) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvSelectVideoNotifyReq *req; + + XvCheckExtension (dpy, info, XvBadExtension); - XvCheckExtension(dpy, info, XvBadExtension); + LockDisplay (dpy); + + XvGetReq (SelectVideoNotify, req); + req->drawable = drawable; + req->onoff = onoff; + + UnlockDisplay (dpy); + SyncHandle (); - LockDisplay(dpy); + return Success; +} + +int SDL_NAME (XvSelectPortNotify) (Display * dpy, XvPortID port, Bool onoff) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvSelectPortNotifyReq *req; + + XvCheckExtension (dpy, info, XvBadExtension); - XvGetReq(SelectPortNotify, req); - req->port = port; - req->onoff = onoff; + LockDisplay (dpy); - UnlockDisplay(dpy); - SyncHandle(); + XvGetReq (SelectPortNotify, req); + req->port = port; + req->onoff = onoff; - return Success; + UnlockDisplay (dpy); + SyncHandle (); + + return Success; } int -SDL_NAME(XvSetPortAttribute) ( - Display *dpy, - XvPortID port, - Atom attribute, - int value -) +SDL_NAME (XvSetPortAttribute) (Display * dpy, + XvPortID port, Atom attribute, int value) { - XExtDisplayInfo *info = xv_find_display(dpy); - xvSetPortAttributeReq *req; + XExtDisplayInfo *info = xv_find_display (dpy); + xvSetPortAttributeReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); - LockDisplay(dpy); + XvGetReq (SetPortAttribute, req); + req->port = port; + req->attribute = attribute; + req->value = value; - XvGetReq(SetPortAttribute, req); - req->port = port; - req->attribute = attribute; - req->value = value; + UnlockDisplay (dpy); + SyncHandle (); - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); + return (Success); } int -SDL_NAME(XvGetPortAttribute) ( - Display *dpy, - XvPortID port, - Atom attribute, - int *p_value -) +SDL_NAME (XvGetPortAttribute) (Display * dpy, + XvPortID port, Atom attribute, int *p_value) { - XExtDisplayInfo *info = xv_find_display(dpy); - xvGetPortAttributeReq *req; - xvGetPortAttributeReply rep; + XExtDisplayInfo *info = xv_find_display (dpy); + xvGetPortAttributeReq *req; + xvGetPortAttributeReply rep; + + XvCheckExtension (dpy, info, XvBadExtension); - XvCheckExtension(dpy, info, XvBadExtension); + LockDisplay (dpy); - LockDisplay(dpy); + XvGetReq (GetPortAttribute, req); + req->port = port; + req->attribute = attribute; - XvGetReq(GetPortAttribute, req); - req->port = port; - req->attribute = attribute; - - /* READ THE REPLY */ + /* READ THE REPLY */ - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadReply); - } + if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadReply); + } - *p_value = rep.value; - - UnlockDisplay(dpy); - SyncHandle(); + *p_value = rep.value; - return (Success); + UnlockDisplay (dpy); + SyncHandle (); + + return (Success); } int -SDL_NAME(XvQueryBestSize)( - Display *dpy, - XvPortID port, - Bool motion, - unsigned int vid_w, - unsigned int vid_h, - unsigned int drw_w, - unsigned int drw_h, - unsigned int *p_actual_width, - unsigned int *p_actual_height -) +SDL_NAME (XvQueryBestSize) (Display * dpy, + XvPortID port, + Bool motion, + unsigned int vid_w, + unsigned int vid_h, + unsigned int drw_w, + unsigned int drw_h, + unsigned int *p_actual_width, + unsigned int *p_actual_height) { - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryBestSizeReq *req; - xvQueryBestSizeReply rep; + XExtDisplayInfo *info = xv_find_display (dpy); + xvQueryBestSizeReq *req; + xvQueryBestSizeReply rep; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); - LockDisplay(dpy); + LockDisplay (dpy); - XvGetReq(QueryBestSize, req); - req->port = port; - req->motion = motion; - req->vid_w = vid_w; - req->vid_h = vid_h; - req->drw_w = drw_w; - req->drw_h = drw_h; + XvGetReq (QueryBestSize, req); + req->port = port; + req->motion = motion; + req->vid_w = vid_w; + req->vid_h = vid_h; + req->drw_w = drw_w; + req->drw_h = drw_h; - /* READ THE REPLY */ + /* READ THE REPLY */ - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(XvBadReply); - } + if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { + UnlockDisplay (dpy); + SyncHandle (); + return (XvBadReply); + } - *p_actual_width = rep.actual_width; - *p_actual_height = rep.actual_height; + *p_actual_width = rep.actual_width; + *p_actual_height = rep.actual_height; - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return (Success); + return (Success); } -SDL_NAME(XvAttribute)* -SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num) +SDL_NAME (XvAttribute) * +SDL_NAME (XvQueryPortAttributes) (Display * dpy, XvPortID port, int *num) { - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryPortAttributesReq *req; - xvQueryPortAttributesReply rep; - SDL_NAME(XvAttribute) *ret = NULL; + XExtDisplayInfo *info = xv_find_display (dpy); + xvQueryPortAttributesReq *req; + xvQueryPortAttributesReply rep; + SDL_NAME (XvAttribute) * ret = NULL; - *num = 0; + *num = 0; - XvCheckExtension(dpy, info, NULL); + XvCheckExtension (dpy, info, NULL); - LockDisplay(dpy); + LockDisplay (dpy); - XvGetReq(QueryPortAttributes, req); - req->port = port; + XvGetReq (QueryPortAttributes, req); + req->port = port; - /* READ THE REPLY */ + /* READ THE REPLY */ - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return ret; - } + if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { + UnlockDisplay (dpy); + SyncHandle (); + return ret; + } - if(rep.num_attributes) { - int size = (rep.num_attributes * sizeof(SDL_NAME(XvAttribute))) + rep.text_size; + if (rep.num_attributes) { + int size = + (rep.num_attributes * sizeof (SDL_NAME (XvAttribute))) + + rep.text_size; + + if ((ret = Xmalloc (size))) { + char *marker = (char *) (&ret[rep.num_attributes]); + xvAttributeInfo Info; + int i; - if((ret = Xmalloc(size))) { - char* marker = (char*)(&ret[rep.num_attributes]); - xvAttributeInfo Info; - int i; - - for(i = 0; i < rep.num_attributes; i++) { - _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo); - ret[i].flags = (int)Info.flags; - ret[i].min_value = Info.min; - ret[i].max_value = Info.max; - ret[i].name = marker; - _XRead(dpy, marker, Info.size); - marker += Info.size; - (*num)++; - } - } else - _XEatData(dpy, rep.length << 2); - } + for (i = 0; i < rep.num_attributes; i++) { + _XRead (dpy, (char *) (&Info), sz_xvAttributeInfo); + ret[i].flags = (int) Info.flags; + ret[i].min_value = Info.min; + ret[i].max_value = Info.max; + ret[i].name = marker; + _XRead (dpy, marker, Info.size); + marker += Info.size; + (*num)++; + } + } else + _XEatData (dpy, rep.length << 2); + } - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return ret; + return ret; } -SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) ( - Display *dpy, - XvPortID port, - int *num -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvListImageFormatsReq *req; - xvListImageFormatsReply rep; - SDL_NAME(XvImageFormatValues) *ret = NULL; +SDL_NAME (XvImageFormatValues) * SDL_NAME (XvListImageFormats) (Display * dpy, + XvPortID port, + int *num) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvListImageFormatsReq *req; + xvListImageFormatsReply rep; + SDL_NAME (XvImageFormatValues) * ret = NULL; - *num = 0; + *num = 0; - XvCheckExtension(dpy, info, NULL); + XvCheckExtension (dpy, info, NULL); + + LockDisplay (dpy); - LockDisplay(dpy); + XvGetReq (ListImageFormats, req); + req->port = port; - XvGetReq(ListImageFormats, req); - req->port = port; - - /* READ THE REPLY */ + /* READ THE REPLY */ - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } + if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } - if(rep.num_formats) { - int size = (rep.num_formats * sizeof(SDL_NAME(XvImageFormatValues))); + if (rep.num_formats) { + int size = + (rep.num_formats * sizeof (SDL_NAME (XvImageFormatValues))); + + if ((ret = Xmalloc (size))) { + xvImageFormatInfo Info; + int i; - if((ret = Xmalloc(size))) { - xvImageFormatInfo Info; - int i; - - for(i = 0; i < rep.num_formats; i++) { - _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); - ret[i].id = Info.id; - ret[i].type = Info.type; - ret[i].byte_order = Info.byte_order; - memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); - ret[i].bits_per_pixel = Info.bpp; - ret[i].format = Info.format; - ret[i].num_planes = Info.num_planes; - ret[i].depth = Info.depth; - ret[i].red_mask = Info.red_mask; - ret[i].green_mask = Info.green_mask; - ret[i].blue_mask = Info.blue_mask; - ret[i].y_sample_bits = Info.y_sample_bits; - ret[i].u_sample_bits = Info.u_sample_bits; - ret[i].v_sample_bits = Info.v_sample_bits; - ret[i].horz_y_period = Info.horz_y_period; - ret[i].horz_u_period = Info.horz_u_period; - ret[i].horz_v_period = Info.horz_v_period; - ret[i].vert_y_period = Info.vert_y_period; - ret[i].vert_u_period = Info.vert_u_period; - ret[i].vert_v_period = Info.vert_v_period; - memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); - ret[i].scanline_order = Info.scanline_order; - (*num)++; - } - } else - _XEatData(dpy, rep.length << 2); - } + for (i = 0; i < rep.num_formats; i++) { + _XRead (dpy, (char *) (&Info), sz_xvImageFormatInfo); + ret[i].id = Info.id; + ret[i].type = Info.type; + ret[i].byte_order = Info.byte_order; + memcpy (&(ret[i].guid[0]), &(Info.guid[0]), 16); + ret[i].bits_per_pixel = Info.bpp; + ret[i].format = Info.format; + ret[i].num_planes = Info.num_planes; + ret[i].depth = Info.depth; + ret[i].red_mask = Info.red_mask; + ret[i].green_mask = Info.green_mask; + ret[i].blue_mask = Info.blue_mask; + ret[i].y_sample_bits = Info.y_sample_bits; + ret[i].u_sample_bits = Info.u_sample_bits; + ret[i].v_sample_bits = Info.v_sample_bits; + ret[i].horz_y_period = Info.horz_y_period; + ret[i].horz_u_period = Info.horz_u_period; + ret[i].horz_v_period = Info.horz_v_period; + ret[i].vert_y_period = Info.vert_y_period; + ret[i].vert_u_period = Info.vert_u_period; + ret[i].vert_v_period = Info.vert_v_period; + memcpy (&(ret[i].component_order[0]), + &(Info.comp_order[0]), 32); + ret[i].scanline_order = Info.scanline_order; + (*num)++; + } + } else + _XEatData (dpy, rep.length << 2); + } - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return ret; + return ret; } -SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) ( - Display *dpy, - XvPortID port, - int id, - char *data, - int width, - int height -) { - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryImageAttributesReq *req; - xvQueryImageAttributesReply rep; - SDL_NAME(XvImage) *ret = NULL; +SDL_NAME (XvImage) * SDL_NAME (XvCreateImage) (Display * dpy, + XvPortID port, + int id, + char *data, + int width, int height) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvQueryImageAttributesReq *req; + xvQueryImageAttributesReply rep; + SDL_NAME (XvImage) * ret = NULL; - XvCheckExtension(dpy, info, NULL); + XvCheckExtension (dpy, info, NULL); - LockDisplay(dpy); + LockDisplay (dpy); - XvGetReq(QueryImageAttributes, req); - req->id = id; - req->port = port; - req->width = width; - req->height = height; + XvGetReq (QueryImageAttributes, req); + req->id = id; + req->port = port; + req->width = width; + req->height = height; - /* READ THE REPLY */ + /* READ THE REPLY */ - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } + if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } - if((ret = (SDL_NAME(XvImage)*)Xmalloc(sizeof(SDL_NAME(XvImage)) + (rep.num_planes << 3)))) { - ret->id = id; - ret->width = rep.width; - ret->height = rep.height; - ret->data_size = rep.data_size; - ret->num_planes = rep.num_planes; - ret->pitches = (int*)(&ret[1]); - ret->offsets = ret->pitches + rep.num_planes; - ret->data = data; - ret->obdata = NULL; - _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); - _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); - } else - _XEatData(dpy, rep.length << 2); + if ((ret = + (SDL_NAME (XvImage) *) Xmalloc (sizeof (SDL_NAME (XvImage)) + + (rep.num_planes << 3)))) { + ret->id = id; + ret->width = rep.width; + ret->height = rep.height; + ret->data_size = rep.data_size; + ret->num_planes = rep.num_planes; + ret->pitches = (int *) (&ret[1]); + ret->offsets = ret->pitches + rep.num_planes; + ret->data = data; + ret->obdata = NULL; + _XRead (dpy, (char *) (ret->pitches), rep.num_planes << 2); + _XRead (dpy, (char *) (ret->offsets), rep.num_planes << 2); + } else + _XEatData (dpy, rep.length << 2); - UnlockDisplay(dpy); - SyncHandle(); - return ret; + UnlockDisplay (dpy); + SyncHandle (); + return ret; } -SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) ( - Display *dpy, - XvPortID port, - int id, - char *data, - int width, - int height, - XShmSegmentInfo *shminfo -){ - SDL_NAME(XvImage) *ret; +SDL_NAME (XvImage) * SDL_NAME (XvShmCreateImage) (Display * dpy, + XvPortID port, + int id, + char *data, + int width, + int height, + XShmSegmentInfo * shminfo) +{ + SDL_NAME (XvImage) * ret; - ret = SDL_NAME(XvCreateImage)(dpy, port, id, data, width, height); + ret = SDL_NAME (XvCreateImage) (dpy, port, id, data, width, height); - if(ret) ret->obdata = (XPointer)shminfo; + if (ret) + ret->obdata = (XPointer) shminfo; - return ret; + return ret; } -int SDL_NAME(XvPutImage) ( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - SDL_NAME(XvImage) *image, - int src_x, - int src_y, - unsigned int src_w, - unsigned int src_h, - int dest_x, - int dest_y, - unsigned int dest_w, - unsigned int dest_h -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvPutImageReq *req; - int len; +int SDL_NAME (XvPutImage) (Display * dpy, + XvPortID port, + Drawable d, + GC gc, + SDL_NAME (XvImage) * image, + int src_x, + int src_y, + unsigned int src_w, + unsigned int src_h, + int dest_x, + int dest_y, + unsigned int dest_w, unsigned int dest_h) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + xvPutImageReq *req; + int len; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); - LockDisplay(dpy); + LockDisplay (dpy); - FlushGC(dpy, gc); + FlushGC (dpy, gc); - XvGetReq(PutImage, req); + XvGetReq (PutImage, req); - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->id = image->id; - req->src_x = src_x; - req->src_y = src_y; - req->src_w = src_w; - req->src_h = src_h; - req->drw_x = dest_x; - req->drw_y = dest_y; - req->drw_w = dest_w; - req->drw_h = dest_h; - req->width = image->width; - req->height = image->height; + req->port = port; + req->drawable = d; + req->gc = gc->gid; + req->id = image->id; + req->src_x = src_x; + req->src_y = src_y; + req->src_w = src_w; + req->src_h = src_h; + req->drw_x = dest_x; + req->drw_y = dest_y; + req->drw_w = dest_w; + req->drw_h = dest_h; + req->width = image->width; + req->height = image->height; - len = (image->data_size + 3) >> 2; - SetReqLen(req, len, len); + len = (image->data_size + 3) >> 2; + SetReqLen (req, len, len); - /* Yes it's kindof lame that we are sending the whole thing, - but for video all of it may be needed even if displaying - only a subsection, and I don't want to go through the - trouble of creating subregions to send */ - Data(dpy, (char *)image->data, image->data_size); + /* Yes it's kindof lame that we are sending the whole thing, + but for video all of it may be needed even if displaying + only a subsection, and I don't want to go through the + trouble of creating subregions to send */ + Data (dpy, (char *) image->data, image->data_size); - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return Success; + return Success; } -int SDL_NAME(XvShmPutImage) ( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - SDL_NAME(XvImage) *image, - int src_x, - int src_y, - unsigned int src_w, - unsigned int src_h, - int dest_x, - int dest_y, - unsigned int dest_w, - unsigned int dest_h, - Bool send_event -){ - XExtDisplayInfo *info = xv_find_display(dpy); - XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata; - xvShmPutImageReq *req; +int SDL_NAME (XvShmPutImage) (Display * dpy, + XvPortID port, + Drawable d, + GC gc, + SDL_NAME (XvImage) * image, + int src_x, + int src_y, + unsigned int src_w, + unsigned int src_h, + int dest_x, + int dest_y, + unsigned int dest_w, + unsigned int dest_h, Bool send_event) +{ + XExtDisplayInfo *info = xv_find_display (dpy); + XShmSegmentInfo *shminfo = (XShmSegmentInfo *) image->obdata; + xvShmPutImageReq *req; - XvCheckExtension(dpy, info, XvBadExtension); + XvCheckExtension (dpy, info, XvBadExtension); + + LockDisplay (dpy); + + FlushGC (dpy, gc); - LockDisplay(dpy); - - FlushGC(dpy, gc); - - XvGetReq(ShmPutImage, req); + XvGetReq (ShmPutImage, req); - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->shmseg = shminfo->shmseg; - req->id = image->id; - req->src_x = src_x; - req->src_y = src_y; - req->src_w = src_w; - req->src_h = src_h; - req->drw_x = dest_x; - req->drw_y = dest_y; - req->drw_w = dest_w; - req->drw_h = dest_h; - req->offset = image->data - shminfo->shmaddr; - req->width = image->width; - req->height = image->height; - req->send_event = send_event; + req->port = port; + req->drawable = d; + req->gc = gc->gid; + req->shmseg = shminfo->shmseg; + req->id = image->id; + req->src_x = src_x; + req->src_y = src_y; + req->src_w = src_w; + req->src_h = src_h; + req->drw_x = dest_x; + req->drw_y = dest_y; + req->drw_w = dest_w; + req->drw_h = dest_h; + req->offset = image->data - shminfo->shmaddr; + req->width = image->width; + req->height = image->height; + req->send_event = send_event; - UnlockDisplay(dpy); - SyncHandle(); + UnlockDisplay (dpy); + SyncHandle (); - return Success; + return Success; } static Bool -xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) +xv_wire_to_event (Display * dpy, XEvent * host, xEvent * wire) { - XExtDisplayInfo *info = xv_find_display(dpy); - SDL_NAME(XvEvent) *re = (SDL_NAME(XvEvent) *)host; - xvEvent *event = (xvEvent *)wire; + XExtDisplayInfo *info = xv_find_display (dpy); + SDL_NAME (XvEvent) * re = (SDL_NAME (XvEvent) *) host; + xvEvent *event = (xvEvent *) wire; - XvCheckExtension(dpy, info, False); + XvCheckExtension (dpy, info, False); - switch((event->u.u.type & 0x7F) - info->codes->first_event) - { + switch ((event->u.u.type & 0x7F) - info->codes->first_event) { case XvVideoNotify: - re->xvvideo.type = event->u.u.type & 0x7f; - re->xvvideo.serial = - _XSetLastRequestRead(dpy, (xGenericReply *)event); - re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); - re->xvvideo.display = dpy; - re->xvvideo.time = event->u.videoNotify.time; - re->xvvideo.reason = event->u.videoNotify.reason; - re->xvvideo.drawable = event->u.videoNotify.drawable; - re->xvvideo.port_id = event->u.videoNotify.port; - break; + re->xvvideo.type = event->u.u.type & 0x7f; + re->xvvideo.serial = + _XSetLastRequestRead (dpy, (xGenericReply *) event); + re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); + re->xvvideo.display = dpy; + re->xvvideo.time = event->u.videoNotify.time; + re->xvvideo.reason = event->u.videoNotify.reason; + re->xvvideo.drawable = event->u.videoNotify.drawable; + re->xvvideo.port_id = event->u.videoNotify.port; + break; case XvPortNotify: - re->xvport.type = event->u.u.type & 0x7f; - re->xvport.serial = - _XSetLastRequestRead(dpy, (xGenericReply *)event); - re->xvport.send_event = ((event->u.u.type & 0x80) != 0); - re->xvport.display = dpy; - re->xvport.time = event->u.portNotify.time; - re->xvport.port_id = event->u.portNotify.port; - re->xvport.attribute = event->u.portNotify.attribute; - re->xvport.value = event->u.portNotify.value; - break; + re->xvport.type = event->u.u.type & 0x7f; + re->xvport.serial = + _XSetLastRequestRead (dpy, (xGenericReply *) event); + re->xvport.send_event = ((event->u.u.type & 0x80) != 0); + re->xvport.display = dpy; + re->xvport.time = event->u.portNotify.time; + re->xvport.port_id = event->u.portNotify.port; + re->xvport.attribute = event->u.portNotify.attribute; + re->xvport.value = event->u.portNotify.value; + break; default: - return False; - } + return False; + } - return (True); + return (True); } - +/* vi: set ts=4 sw=4 expandtab: */