summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-06-22 19:58:20 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-06-22 20:36:33 -0700
commit54851e0e72e2017c14c504459078c97d6112696b (patch)
tree5eb0dfa10d310dfde81b7eaaab84ac38fb9afc1c
parentd58f74ebfd0c56ffeb8e288c65592228af197a2e (diff)
Adopt X.Org standard code style, with consistent indentation
Having differing indent levels of 2, 3, & 4 spaces hurts my eyes. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--include/X11/extensions/Xvlib.h442
-rw-r--r--src/Xv.c1868
-rw-r--r--src/Xvlibint.h36
3 files changed, 1154 insertions, 1192 deletions
diff --git a/include/X11/extensions/Xvlib.h b/include/X11/extensions/Xvlib.h
index 313037a..32b98bf 100644
--- a/include/X11/extensions/Xvlib.h
+++ b/include/X11/extensions/Xvlib.h
@@ -57,323 +57,323 @@ SOFTWARE.
#include <X11/extensions/XShm.h>
typedef struct {
- int numerator;
- int denominator;
+ int numerator;
+ int denominator;
} XvRational;
typedef struct {
- int flags; /* XvGettable, XvSettable */
- int min_value;
- int max_value;
- char *name;
+ int flags; /* XvGettable, XvSettable */
+ int min_value;
+ int max_value;
+ char *name;
} XvAttribute;
typedef struct {
- XvEncodingID encoding_id;
- char *name;
- unsigned long width;
- unsigned long height;
- XvRational rate;
- unsigned long num_encodings;
+ XvEncodingID encoding_id;
+ char *name;
+ unsigned long width;
+ unsigned long height;
+ XvRational rate;
+ unsigned long num_encodings;
} XvEncodingInfo;
typedef struct {
- char depth;
- unsigned long visual_id;
+ char depth;
+ unsigned long visual_id;
} XvFormat;
typedef struct {
- XvPortID base_id;
- unsigned long num_ports;
- char type;
- char *name;
- unsigned long num_formats;
- XvFormat *formats;
- unsigned long num_adaptors;
+ XvPortID base_id;
+ unsigned long num_ports;
+ char type;
+ char *name;
+ unsigned long num_formats;
+ XvFormat *formats;
+ unsigned long num_adaptors;
} XvAdaptorInfo;
typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- Bool send_event; /* true if this came from a SendEvent request */
- Display *display; /* Display the event was read from */
- Drawable drawable; /* drawable */
- unsigned long reason; /* what generated this event */
- XvPortID port_id; /* what port */
- Time time; /* milliseconds */
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Drawable drawable; /* drawable */
+ unsigned long reason; /* what generated this event */
+ XvPortID port_id; /* what port */
+ Time time; /* milliseconds */
} XvVideoNotifyEvent;
typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- Bool send_event; /* true if this came from a SendEvent request */
- Display *display; /* Display the event was read from */
- XvPortID port_id; /* what port */
- Time time; /* milliseconds */
- Atom attribute; /* atom that identifies attribute */
- long value; /* value of attribute */
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ XvPortID port_id; /* what port */
+ Time time; /* milliseconds */
+ Atom attribute; /* atom that identifies attribute */
+ long value; /* value of attribute */
} XvPortNotifyEvent;
typedef union {
- int type;
- XvVideoNotifyEvent xvvideo;
- XvPortNotifyEvent xvport;
- long pad[24];
+ int type;
+ XvVideoNotifyEvent xvvideo;
+ XvPortNotifyEvent xvport;
+ long pad[24];
} XvEvent;
typedef struct {
- int id; /* Unique descriptor for the format */
- int type; /* XvRGB, XvYUV */
- int byte_order; /* LSBFirst, MSBFirst */
- char guid[16]; /* Globally Unique IDentifier */
- int bits_per_pixel;
- int format; /* XvPacked, XvPlanar */
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32]; /* eg. UYVY */
- int scanline_order; /* XvTopToBottom, XvBottomToTop */
+ int id; /* Unique descriptor for the format */
+ int type; /* XvRGB, XvYUV */
+ int byte_order; /* LSBFirst, MSBFirst */
+ char guid[16]; /* Globally Unique IDentifier */
+ int bits_per_pixel;
+ int format; /* XvPacked, XvPlanar */
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32]; /* eg. UYVY */
+ int scanline_order; /* XvTopToBottom, XvBottomToTop */
} XvImageFormatValues;
typedef struct {
- int id;
- int width, height;
- int data_size; /* bytes */
- int num_planes;
- int *pitches; /* bytes */
- int *offsets; /* bytes */
- char *data;
- XPointer obdata;
+ int id;
+ int width, height;
+ int data_size; /* bytes */
+ int num_planes;
+ int *pitches; /* bytes */
+ int *offsets; /* bytes */
+ char *data;
+ XPointer obdata;
} XvImage;
_XFUNCPROTOBEGIN
extern int XvQueryExtension(
- Display* /* display */,
- unsigned int* /* p_version */,
- unsigned int* /* p_revision */,
- unsigned int* /* p_requestBase */,
- unsigned int* /* p_eventBase */,
- unsigned int* /* p_errorBase */
+ Display * /* display */,
+ unsigned int * /* p_version */,
+ unsigned int * /* p_revision */,
+ unsigned int * /* p_requestBase */,
+ unsigned int * /* p_eventBase */,
+ unsigned int * /* p_errorBase */
);
extern int XvQueryAdaptors(
- Display* /* display */,
- Window /* window */,
- unsigned int* /* p_nAdaptors */,
- XvAdaptorInfo** /* p_pAdaptors */
+ Display * /* display */,
+ Window /* window */,
+ unsigned int * /* p_nAdaptors */,
+ XvAdaptorInfo ** /* p_pAdaptors */
);
extern int XvQueryEncodings(
- Display* /* display */,
- XvPortID /* port */,
- unsigned int* /* p_nEncoding */,
- XvEncodingInfo** /* p_pEncoding */
+ Display * /* display */,
+ XvPortID /* port */,
+ unsigned int * /* p_nEncoding */,
+ XvEncodingInfo ** /* p_pEncoding */
);
extern int XvPutVideo(
- Display* /* display */,
- 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 */
+ Display * /* display */,
+ 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 */
);
extern int XvPutStill(
- Display* /* display */,
- 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 */
+ Display * /* display */,
+ 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 */
);
extern int XvGetVideo(
- Display* /* display */,
- 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 */
+ Display * /* display */,
+ 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 */
);
extern int XvGetStill(
- Display* /* display */,
- 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 */
+ Display * /* display */,
+ 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 */
);
extern int XvStopVideo(
- Display* /* display */,
- XvPortID /* port */,
- Drawable /* drawable */
+ Display * /* display */,
+ XvPortID /* port */,
+ Drawable /* drawable */
);
extern int XvGrabPort(
- Display* /* display */,
- XvPortID /* port */,
- Time /* time */
+ Display * /* display */,
+ XvPortID /* port */,
+ Time /* time */
);
extern int XvUngrabPort(
- Display* /* display */,
- XvPortID /* port */,
- Time /* time */
+ Display * /* display */,
+ XvPortID /* port */,
+ Time /* time */
);
extern int XvSelectVideoNotify(
- Display* /* display */,
- Drawable /* drawable */,
- Bool /* onoff */
+ Display * /* display */,
+ Drawable /* drawable */,
+ Bool /* onoff */
);
extern int XvSelectPortNotify(
- Display* /* display */,
- XvPortID /* port */,
- Bool /* onoff */
+ Display * /* display */,
+ XvPortID /* port */,
+ Bool /* onoff */
);
extern int XvSetPortAttribute(
- Display* /* display */,
- XvPortID /* port */,
- Atom /* attribute */,
- int /* value */
+ Display * /* display */,
+ XvPortID /* port */,
+ Atom /* attribute */,
+ int /* value */
);
extern int XvGetPortAttribute(
- Display* /* display */,
- XvPortID /* port */,
- Atom /* attribute */,
- int* /* p_value */
+ Display * /* display */,
+ XvPortID /* port */,
+ Atom /* attribute */,
+ int * /* p_value */
);
extern int XvQueryBestSize(
- Display* /* display */,
- 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_width */
+ Display * /* display */,
+ 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_width */
);
-extern XvAttribute* XvQueryPortAttributes(
- Display* /* display */,
- XvPortID /* port */,
- int* /* number */
+extern XvAttribute *XvQueryPortAttributes(
+ Display * /* display */,
+ XvPortID /* port */,
+ int * /* number */
);
extern void XvFreeAdaptorInfo(
- XvAdaptorInfo* /* adaptors */
+ XvAdaptorInfo * /* adaptors */
);
extern void XvFreeEncodingInfo(
- XvEncodingInfo* /* encodings */
+ XvEncodingInfo * /* encodings */
);
-extern XvImageFormatValues * XvListImageFormats (
- Display *display,
- XvPortID port_id,
- int *count_return
+extern XvImageFormatValues *XvListImageFormats (
+ Display *display,
+ XvPortID port_id,
+ int *count_return
);
-extern XvImage * XvCreateImage (
- Display *display,
- XvPortID port,
- int id,
- char *data,
- int width,
- int height
+extern XvImage *XvCreateImage (
+ Display *display,
+ XvPortID port,
+ int id,
+ char *data,
+ int width,
+ int height
);
extern int XvPutImage (
- Display *display,
- XvPortID id,
- Drawable d,
- GC gc,
- 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
+ Display *display,
+ XvPortID id,
+ Drawable d,
+ GC gc,
+ 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
);
extern int XvShmPutImage (
- Display *display,
- XvPortID id,
- Drawable d,
- GC gc,
- 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
+ Display *display,
+ XvPortID id,
+ Drawable d,
+ GC gc,
+ 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
);
-extern XvImage * XvShmCreateImage (
- Display *display,
- XvPortID port,
- int id,
- char* data,
- int width,
- int height,
- XShmSegmentInfo *shminfo
+extern XvImage *XvShmCreateImage (
+ Display *display,
+ XvPortID port,
+ int id,
+ char *data,
+ int width,
+ int height,
+ XShmSegmentInfo *shminfo
);
diff --git a/src/Xv.c b/src/Xv.c
index 8c45401..ee80959 100644
--- a/src/Xv.c
+++ b/src/Xv.c
@@ -61,13 +61,14 @@ SOFTWARE.
#include <limits.h>
#ifndef HAVE__XEATDATAWORDS
-static inline void _XEatDataWords(Display *dpy, unsigned long n)
+static inline void
+_XEatDataWords(Display *dpy, unsigned long n)
{
# ifndef LONG64
if (n >= (ULONG_MAX >> 2))
_XIOError(dpy);
# endif
- _XEatData (dpy, n << 2);
+ _XEatData(dpy, n << 2);
}
#endif
@@ -79,1124 +80,1085 @@ static const char *xv_extension_name = XvName;
XextCheckExtension(dpy, i, xv_extension_name, val)
static char *xv_error_string(Display *dpy, int code, XExtCodes *codes,
- char * buf, int n);
+ char *buf, int n);
static int xv_close_display(Display *dpy, XExtCodes *codes);
static Bool xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire);
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 const char *xv_error_list[] =
-{
- "BadPort", /* XvBadPort */
- "BadEncoding", /* XvBadEncoding */
- "BadControl" /* XvBadControl */
+static const char *xv_error_list[] = {
+ "BadPort", /* XvBadPort */
+ "BadEncoding", /* XvBadEncoding */
+ "BadControl" /* XvBadControl */
};
-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_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)
+static XEXT_GENERATE_ERROR_STRING(xv_error_string, xv_extension_name,
+ XvNumErrors, xv_error_list)
int
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;
-
- XvCheckExtension(dpy, info, XvBadExtension);
-
- LockDisplay(dpy);
-
- 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;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+ 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;
+
+ XvCheckExtension(dpy, info, XvBadExtension);
+
+ LockDisplay(dpy);
+
+ 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;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
int
XvQueryAdaptors(
- Display *dpy,
- Window window,
- unsigned int *p_nAdaptors,
- XvAdaptorInfo **p_pAdaptors
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvQueryAdaptorsReq *req;
- xvQueryAdaptorsReply rep;
- int size,ii,jj;
- char *name;
- XvAdaptorInfo *pas, *pa;
- XvFormat *pfs, *pf;
- char *buffer;
- union
- {
- char *buffer;
- char *string;
- xvAdaptorInfo *pa;
- xvFormat *pf;
+ Display *dpy,
+ Window window,
+ unsigned int *p_nAdaptors,
+ XvAdaptorInfo **p_pAdaptors)
+{
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvQueryAdaptorsReq *req;
+ xvQueryAdaptorsReply rep;
+ int size, ii, jj;
+ char *name;
+ XvAdaptorInfo *pas, *pa;
+ XvFormat *pfs, *pf;
+ char *buffer;
+ union {
+ char *buffer;
+ char *string;
+ xvAdaptorInfo *pa;
+ xvFormat *pf;
} u;
- XvCheckExtension(dpy, info, XvBadExtension);
-
- LockDisplay(dpy);
-
- XvGetReq(QueryAdaptors, req);
- req->window = window;
-
- /* READ THE REPLY */
-
- 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);
-
- u.buffer = buffer;
-
- /* GET INPUT ADAPTORS */
-
- if (rep.num_adaptors == 0) {
- pas = NULL;
- } else {
- size = rep.num_adaptors*sizeof(XvAdaptorInfo);
- if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) {
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- }
-
- /* INIT ADAPTOR FIELDS */
-
- pa = pas;
- for (ii=0; ii<rep.num_adaptors; ii++) {
- pa->num_adaptors = 0;
- pa->name = (char *)NULL;
- pa->formats = (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;
-
- /* GET ADAPTOR NAME */
-
- size = u.pa->name_size;
- u.buffer += (sz_xvAdaptorInfo + 3) & ~3;
-
- if ( (name = (char *)Xmalloc(size+1)) == NULL)
- {
- XvFreeAdaptorInfo(pas);
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- (void)strncpy(name, u.string, size);
- name[size] = '\0';
- pa->name = name;
-
- u.buffer += (size + 3) & ~3;
-
- /* GET FORMATS */
-
- size = pa->num_formats*sizeof(XvFormat);
- if ((pfs=(XvFormat *)Xmalloc(size))==NULL) {
- 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++;
-
- u.buffer += (sz_xvFormat + 3) & ~3;
- }
-
- pa->formats = pfs;
-
- pa++;
-
- }
-
- *p_nAdaptors = rep.num_adaptors;
- *p_pAdaptors = pas;
-
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
-
- return (Success);
+ XvCheckExtension(dpy, info, XvBadExtension);
+
+ LockDisplay(dpy);
+
+ XvGetReq(QueryAdaptors, req);
+ req->window = window;
+
+ /* READ THE REPLY */
+
+ 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);
+
+ u.buffer = buffer;
+
+ /* GET INPUT ADAPTORS */
+
+ if (rep.num_adaptors == 0) {
+ pas = NULL;
+ }
+ else {
+ size = rep.num_adaptors * sizeof(XvAdaptorInfo);
+ if ((pas = (XvAdaptorInfo *) Xmalloc(size)) == NULL) {
+ Xfree(buffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XvBadAlloc);
+ }
+ }
+
+ /* INIT ADAPTOR FIELDS */
+
+ pa = pas;
+ for (ii = 0; ii < rep.num_adaptors; ii++) {
+ pa->num_adaptors = 0;
+ pa->name = (char *) NULL;
+ pa->formats = (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;
+
+ /* GET ADAPTOR NAME */
+
+ size = u.pa->name_size;
+ u.buffer += (sz_xvAdaptorInfo + 3) & ~3;
+
+ if ((name = (char *) Xmalloc(size + 1)) == NULL) {
+ XvFreeAdaptorInfo(pas);
+ Xfree(buffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XvBadAlloc);
+ }
+ (void) strncpy(name, u.string, size);
+ name[size] = '\0';
+ pa->name = name;
+
+ u.buffer += (size + 3) & ~3;
+
+ /* GET FORMATS */
+
+ size = pa->num_formats * sizeof(XvFormat);
+ if ((pfs = (XvFormat *) Xmalloc(size)) == NULL) {
+ 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++;
+
+ u.buffer += (sz_xvFormat + 3) & ~3;
+ }
+
+ pa->formats = pfs;
+
+ pa++;
+
+ }
+
+ *p_nAdaptors = rep.num_adaptors;
+ *p_pAdaptors = pas;
+
+ Xfree(buffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return (Success);
}
void
XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors)
{
+ XvAdaptorInfo *pa;
+ int ii;
- 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
XvQueryEncodings(
- Display *dpy,
- XvPortID port,
- unsigned int *p_nEncodings,
- XvEncodingInfo **p_pEncodings
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvQueryEncodingsReq *req;
- xvQueryEncodingsReply rep;
- int size, jj;
- char *name;
- XvEncodingInfo *pes, *pe;
- char *buffer;
- union
- {
- char *buffer;
- char *string;
- xvEncodingInfo *pe;
+ Display *dpy,
+ XvPortID port,
+ unsigned int *p_nEncodings,
+ XvEncodingInfo ** p_pEncodings)
+{
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvQueryEncodingsReq *req;
+ xvQueryEncodingsReply rep;
+ int size, jj;
+ char *name;
+ XvEncodingInfo *pes, *pe;
+ char *buffer;
+ union {
+ char *buffer;
+ char *string;
+ xvEncodingInfo *pe;
} u;
- XvCheckExtension(dpy, info, XvBadExtension);
-
- LockDisplay(dpy);
-
- XvGetReq(QueryEncodings, req);
- req->port = port;
-
- /* READ THE REPLY */
-
- 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);
-
- u.buffer = buffer;
-
- /* GET ENCODINGS */
-
- size = rep.num_encodings*sizeof(XvEncodingInfo);
- if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) {
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
-
- /* 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->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;
-
- if ( (name = (char *)Xmalloc(size+1)) == NULL) {
- XvFreeEncodingInfo(pes);
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- strncpy(name, u.string, size);
- name[size] = '\0';
- pe->name = name;
- pe++;
-
- u.buffer += (size + 3) & ~3;
- }
-
- *p_nEncodings = rep.num_encodings;
- *p_pEncodings = pes;
-
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
-
- return (Success);
+ XvCheckExtension(dpy, info, XvBadExtension);
+
+ LockDisplay(dpy);
+
+ XvGetReq(QueryEncodings, req);
+ req->port = port;
+
+ /* READ THE REPLY */
+
+ 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);
+
+ u.buffer = buffer;
+
+ /* GET ENCODINGS */
+
+ size = rep.num_encodings * sizeof(XvEncodingInfo);
+ if ((pes = (XvEncodingInfo *) Xmalloc(size)) == NULL) {
+ Xfree(buffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XvBadAlloc);
+ }
+
+ /* 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->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;
+
+ if ((name = (char *) Xmalloc(size + 1)) == NULL) {
+ XvFreeEncodingInfo(pes);
+ Xfree(buffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XvBadAlloc);
+ }
+ strncpy(name, u.string, size);
+ name[size] = '\0';
+ pe->name = name;
+ pe++;
+
+ u.buffer += (size + 3) & ~3;
+ }
+
+ *p_nEncodings = rep.num_encodings;
+ *p_pEncodings = pes;
+
+ Xfree(buffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return (Success);
}
void
XvFreeEncodingInfo(XvEncodingInfo *pEncodings)
{
+ XvEncodingInfo *pe;
+ int ii;
- 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
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);
-
- LockDisplay(dpy);
-
- FlushGC(dpy, gc);
-
- 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;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+ 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);
+
+ LockDisplay(dpy);
+
+ FlushGC(dpy, gc);
+
+ 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;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
int
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);
-
- LockDisplay(dpy);
-
- 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;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+ 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);
+
+ LockDisplay(dpy);
+
+ 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;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
int
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);
-
- 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;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+ 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);
+
+ 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;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
int
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);
-
- FlushGC(dpy, gc);
-
- 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;
+ 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);
+
+ FlushGC(dpy, gc);
+
+ 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;
}
int
-XvStopVideo(
- Display *dpy,
- XvPortID port,
- Drawable draw
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvStopVideoReq *req;
+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(StopVideo, req);
- req->port = port;
- req->drawable = draw;
+ XvGetReq(StopVideo, req);
+ req->port = port;
+ req->drawable = draw;
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return Success;
+ return Success;
}
int
-XvGrabPort(
- Display *dpy,
- XvPortID port,
- Time time
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- int result;
- xvGrabPortReply rep;
- xvGrabPortReq *req;
+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;
+ XvGetReq(GrabPort, req);
+ req->port = port;
+ req->time = time;
- if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0)
- rep.result = GrabSuccess;
+ if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == 0)
+ rep.result = GrabSuccess;
- result = rep.result;
+ result = rep.result;
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return result;
+ return result;
}
int
-XvUngrabPort(
- Display *dpy,
- XvPortID port,
- Time time
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvUngrabPortReq *req;
+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(UngrabPort, req);
+ req->port = port;
+ req->time = time;
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return Success;
+ return Success;
}
int
-XvSelectVideoNotify(
- Display *dpy,
- Drawable drawable,
- Bool onoff
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvSelectVideoNotifyReq *req;
+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);
+ LockDisplay(dpy);
- XvGetReq(SelectVideoNotify, req);
- req->drawable = drawable;
- req->onoff = onoff;
+ XvGetReq(SelectVideoNotify, req);
+ req->drawable = drawable;
+ req->onoff = onoff;
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return Success;
+ return Success;
}
int
-XvSelectPortNotify(
- Display *dpy,
- XvPortID port,
- Bool onoff
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvSelectPortNotifyReq *req;
+XvSelectPortNotify(Display *dpy, XvPortID port, Bool onoff)
+{
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvSelectPortNotifyReq *req;
- XvCheckExtension(dpy, info, XvBadExtension);
+ XvCheckExtension(dpy, info, XvBadExtension);
- LockDisplay(dpy);
+ LockDisplay(dpy);
- XvGetReq(SelectPortNotify, req);
- req->port = port;
- req->onoff = onoff;
+ XvGetReq(SelectPortNotify, req);
+ req->port = port;
+ req->onoff = onoff;
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return Success;
+ return Success;
}
int
-XvSetPortAttribute (
- Display *dpy,
- XvPortID port,
- Atom attribute,
- int value
-)
+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
-XvGetPortAttribute (
- Display *dpy,
- XvPortID port,
- Atom attribute,
- int *p_value
-)
+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;
+ *p_value = rep.value;
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return (Success);
+ return (Success);
}
int
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
-)
+ 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);
}
-XvAttribute*
+XvAttribute *
XvQueryPortAttributes(Display *dpy, XvPortID port, int *num)
{
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvQueryPortAttributesReq *req;
- xvQueryPortAttributesReply rep;
- XvAttribute *ret = NULL;
-
- *num = 0;
-
- XvCheckExtension(dpy, info, NULL);
-
- LockDisplay(dpy);
-
- XvGetReq(QueryPortAttributes, req);
- req->port = port;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ret;
- }
-
- /*
- * X server sends data packed as:
- * attribute1, name1, attribute2, name2, ...
- * We allocate a single buffer large enough to hold them all and
- * then de-interleave the data so we return it to clients as:
- * attribute1, attribute2, ..., name1, name2, ...
- * so that clients may refer to attributes as a simple array of
- * structs: attributes[0], attributes[1], ...
- * and free it as a single/simple buffer.
- */
-
- if(rep.num_attributes) {
- unsigned long size;
- /* limit each part to no more than one half the max size */
- if ((rep.num_attributes < ((INT_MAX / 2) / sizeof(XvAttribute))) &&
- (rep.text_size < (INT_MAX / 2)-1)) {
- size = (rep.num_attributes * sizeof(XvAttribute)) + rep.text_size + 1;
- ret = Xmalloc(size);
- }
-
- if (ret != NULL) {
- char* marker = (char*)(&ret[rep.num_attributes]);
- xvAttributeInfo Info;
- int i;
-
- /* keep track of remaining room for text strings */
- size = rep.text_size;
-
- 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;
- if (Info.size <= size) {
- _XRead(dpy, marker, Info.size);
- marker += Info.size;
- size -= Info.size;
- }
- (*num)++;
- }
-
- /* ensure final string is nil-terminated to avoid exposure of
- uninitialized memory */
- *marker = '\0';
- } else
- _XEatDataWords(dpy, rep.length);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ret;
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvQueryPortAttributesReq *req;
+ xvQueryPortAttributesReply rep;
+ XvAttribute *ret = NULL;
+
+ *num = 0;
+
+ XvCheckExtension(dpy, info, NULL);
+
+ LockDisplay(dpy);
+
+ XvGetReq(QueryPortAttributes, req);
+ req->port = port;
+
+ /* READ THE REPLY */
+
+ if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ret;
+ }
+
+ /*
+ * X server sends data packed as:
+ * attribute1, name1, attribute2, name2, ...
+ * We allocate a single buffer large enough to hold them all and
+ * then de-interleave the data so we return it to clients as:
+ * attribute1, attribute2, ..., name1, name2, ...
+ * so that clients may refer to attributes as a simple array of
+ * structs: attributes[0], attributes[1], ...
+ * and free it as a single/simple buffer.
+ */
+
+ if (rep.num_attributes) {
+ unsigned long size;
+
+ /* limit each part to no more than one half the max size */
+ if ((rep.num_attributes < ((INT_MAX / 2) / sizeof(XvAttribute))) &&
+ (rep.text_size < (INT_MAX / 2) - 1)) {
+ size = (rep.num_attributes * sizeof(XvAttribute)) +
+ rep.text_size + 1;
+ ret = Xmalloc(size);
+ }
+
+ if (ret != NULL) {
+ char *marker = (char *) (&ret[rep.num_attributes]);
+ xvAttributeInfo Info;
+ int i;
+
+ /* keep track of remaining room for text strings */
+ size = rep.text_size;
+
+ 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;
+ if (Info.size <= size) {
+ _XRead(dpy, marker, Info.size);
+ marker += Info.size;
+ size -= Info.size;
+ }
+ (*num)++;
+ }
+
+ /* ensure final string is nil-terminated to avoid exposure of
+ uninitialized memory */
+ *marker = '\0';
+ }
+ else
+ _XEatDataWords(dpy, rep.length);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return ret;
}
-XvImageFormatValues * XvListImageFormats (
- Display *dpy,
- XvPortID port,
- int *num
-){
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvListImageFormatsReq *req;
- xvListImageFormatsReply rep;
- XvImageFormatValues *ret = NULL;
-
- *num = 0;
-
- XvCheckExtension(dpy, info, NULL);
-
- LockDisplay(dpy);
-
- XvGetReq(ListImageFormats, req);
- req->port = port;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- if(rep.num_formats) {
- if (rep.num_formats < (INT_MAX / sizeof(XvImageFormatValues)))
- ret = Xmalloc(rep.num_formats * sizeof(XvImageFormatValues));
-
- if (ret != NULL) {
- 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
- _XEatDataWords(dpy, rep.length);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ret;
+XvImageFormatValues *
+XvListImageFormats(Display *dpy, XvPortID port, int *num)
+{
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvListImageFormatsReq *req;
+ xvListImageFormatsReply rep;
+ XvImageFormatValues *ret = NULL;
+
+ *num = 0;
+
+ XvCheckExtension(dpy, info, NULL);
+
+ LockDisplay(dpy);
+
+ XvGetReq(ListImageFormats, req);
+ req->port = port;
+
+ /* READ THE REPLY */
+
+ if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ if (rep.num_formats) {
+ if (rep.num_formats < (INT_MAX / sizeof(XvImageFormatValues)))
+ ret = Xmalloc(rep.num_formats * sizeof(XvImageFormatValues));
+
+ if (ret != NULL) {
+ 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
+ _XEatDataWords(dpy, rep.length);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return ret;
}
-XvImage * XvCreateImage (
- Display *dpy,
- XvPortID port,
- int id,
- char *data,
- int width,
- int height
-) {
- XExtDisplayInfo *info = xv_find_display(dpy);
- xvQueryImageAttributesReq *req;
- xvQueryImageAttributesReply rep;
- XvImage *ret = NULL;
-
- XvCheckExtension(dpy, info, NULL);
-
- LockDisplay(dpy);
-
- XvGetReq(QueryImageAttributes, req);
- req->id = id;
- req->port = port;
- req->width = width;
- req->height = height;
-
- /* READ THE REPLY */
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- if (rep.num_planes < ((INT_MAX >> 3) - sizeof(XvImage)))
- ret = Xmalloc(sizeof(XvImage) + (rep.num_planes << 3));
-
- if (ret != NULL) {
- 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
- _XEatDataWords(dpy, rep.length);
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ret;
+XvImage *
+XvCreateImage(
+ Display *dpy,
+ XvPortID port,
+ int id,
+ char *data,
+ int width,
+ int height)
+{
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvQueryImageAttributesReq *req;
+ xvQueryImageAttributesReply rep;
+ XvImage *ret = NULL;
+
+ XvCheckExtension(dpy, info, NULL);
+
+ LockDisplay(dpy);
+
+ XvGetReq(QueryImageAttributes, req);
+ req->id = id;
+ req->port = port;
+ req->width = width;
+ req->height = height;
+
+ /* READ THE REPLY */
+
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ if (rep.num_planes < ((INT_MAX >> 3) - sizeof(XvImage)))
+ ret = Xmalloc(sizeof(XvImage) + (rep.num_planes << 3));
+
+ if (ret != NULL) {
+ 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
+ _XEatDataWords(dpy, rep.length);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return ret;
}
-XvImage * XvShmCreateImage (
- Display *dpy,
- XvPortID port,
- int id,
- char *data,
- int width,
- int height,
- XShmSegmentInfo *shminfo
-){
- XvImage *ret;
+XvImage *
+XvShmCreateImage(
+ Display *dpy,
+ XvPortID port,
+ int id,
+ char *data,
+ int width,
+ int height,
+ XShmSegmentInfo *shminfo)
+{
+ XvImage *ret;
- ret = XvCreateImage(dpy, port, id, data, width, height);
+ ret = XvCreateImage(dpy, port, id, data, width, height);
- if(ret) ret->obdata = (XPointer)shminfo;
+ if (ret)
+ ret->obdata = (XPointer) shminfo;
- return ret;
+ return ret;
}
-int XvPutImage (
- Display *dpy,
- XvPortID port,
- Drawable d,
- GC gc,
- 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);
-
- LockDisplay(dpy);
-
- FlushGC(dpy, gc);
-
- 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;
-
- 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);
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+int
+XvPutImage(
+ Display *dpy,
+ XvPortID port,
+ Drawable d,
+ GC gc,
+ 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);
+
+ LockDisplay(dpy);
+
+ FlushGC(dpy, gc);
+
+ 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;
+
+ 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);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
-int XvShmPutImage (
- Display *dpy,
- XvPortID port,
- Drawable d,
- GC gc,
- 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);
-
- LockDisplay(dpy);
-
- FlushGC(dpy, gc);
-
- 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;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+int
+XvShmPutImage(
+ Display *dpy,
+ XvPortID port,
+ Drawable d,
+ GC gc,
+ 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);
+
+ LockDisplay(dpy);
+
+ FlushGC(dpy, gc);
+
+ 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;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
static Bool
xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
{
- XExtDisplayInfo *info = xv_find_display(dpy);
- XvEvent *re = (XvEvent *)host;
- xvEvent *event = (xvEvent *)wire;
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ XvEvent *re = (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);
}
-
-
diff --git a/src/Xvlibint.h b/src/Xvlibint.h
index f16a515..1fdf748 100644
--- a/src/Xvlibint.h
+++ b/src/Xvlibint.h
@@ -46,27 +46,27 @@ SOFTWARE.
#if !defined(UNIXCPP)
#define XvGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = info->codes->major_opcode;\
- req->xvReqType = xv_##name; \
- req->length = (SIZEOF(xv##name##Req))>>2;\
- dpy->bufptr += SIZEOF(xv##name##Req);\
- dpy->request++
+ WORD64ALIGN \
+ if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax) \
+ _XFlush(dpy); \
+ req = (xv##name##Req *)(dpy->last_req = dpy->bufptr); \
+ req->reqType = info->codes->major_opcode; \
+ req->xvReqType = xv_##name; \
+ req->length = (SIZEOF(xv##name##Req)) >> 2; \
+ dpy->bufptr += SIZEOF(xv##name##Req); \
+ dpy->request++
#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
#define XvGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = info->codes->major_opcode;\
- req->xvReqType = xv_/**/name;\
- req->length = (SIZEOF(xv/**/name/**/Req))>>2;\
- dpy->bufptr += SIZEOF(xv/**/name/**/Req);\
- dpy->request++
+ WORD64ALIGN \
+ if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax) \
+ _XFlush(dpy); \
+ req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr); \
+ req->reqType = info->codes->major_opcode; \
+ req->xvReqType = xv_/**/name; \
+ req->length = (SIZEOF(xv/**/name/**/Req)) >> 2; \
+ dpy->bufptr += SIZEOF(xv/**/name/**/Req); \
+ dpy->request++
#endif