diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-19 12:02:41 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-19 14:29:50 -0700 |
commit | 0f537ab4913a8d2b3e58a40385a7745c4974bd76 (patch) | |
tree | f295b1b1ac258459707d67b70b0108ba1807ba8b | |
parent | 162422fa80332129168097fd4bcc094cd73a1e65 (diff) |
Convert to X.Org standard code style
Mostly via util/modular/x-indent-all.sh, plus some manual cleanup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | include/X11/extensions/XvMClib.h | 305 | ||||
-rw-r--r-- | include/X11/extensions/vldXvMC.h | 50 | ||||
-rw-r--r-- | src/XvMC.c | 543 | ||||
-rw-r--r-- | src/XvMClibint.h | 47 | ||||
-rw-r--r-- | wrapper/XvMCWrapper.c | 957 |
5 files changed, 942 insertions, 960 deletions
diff --git a/include/X11/extensions/XvMClib.h b/include/X11/extensions/XvMClib.h index b0e6c8b..fc59b44 100644 --- a/include/X11/extensions/XvMClib.h +++ b/include/X11/extensions/XvMClib.h @@ -6,209 +6,168 @@ #include <X11/extensions/XvMC.h> _XFUNCPROTOBEGIN - -Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase); -Status XvMCQueryVersion (Display *display, int *major_versionp, - int *minor_versionp); +Bool XvMCQueryExtension(Display *display, int *eventBase, int *errBase); +Status XvMCQueryVersion(Display *display, int *major_versionp, + int *minor_versionp); Status XvMCGetDRInfo(Display *dpy, XvPortID port, - char **name, char **busID, - int *major, int *minor, - int *patchLevel, - int *isLocal); - + char **name, char **busID, + int *major, int *minor, + int *patchLevel, + int *isLocal); -XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num); +XvMCSurfaceInfo *XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num); -Status XvMCCreateContext ( - Display *display, - XvPortID port, - int surface_type_id, - int width, - int height, - int flags, - XvMCContext * context -); +Status XvMCCreateContext(Display *display, + XvPortID port, + int surface_type_id, + int width, + int height, + int flags, + XvMCContext *context); -Status XvMCDestroyContext (Display *display, XvMCContext * context); +Status XvMCDestroyContext(Display *display, XvMCContext *context); Status -XvMCCreateSurface( - Display *display, - XvMCContext * context, - XvMCSurface * surface -); +XvMCCreateSurface(Display *display, + XvMCContext *context, + XvMCSurface *surface); Status XvMCDestroySurface(Display *display, XvMCSurface *surface); -XvImageFormatValues * XvMCListSubpictureTypes ( - Display * display, - XvPortID port, - int surface_type_id, - int *count_return -); +XvImageFormatValues *XvMCListSubpictureTypes(Display *display, + XvPortID port, + int surface_type_id, + int *count_return); Status -XvMCPutSurface( - Display *display, - XvMCSurface *surface, - Drawable draw, - short srcx, - short srcy, - unsigned short srcw, - unsigned short srch, - short destx, - short desty, - unsigned short destw, - unsigned short desth, - int flags -); +XvMCPutSurface(Display *display, + XvMCSurface *surface, + Drawable draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + int flags); Status XvMCHideSurface(Display *display, XvMCSurface *surface); Status -XvMCCreateSubpicture ( - Display *display, - XvMCContext *context, - XvMCSubpicture *subpicture, - unsigned short width, - unsigned short height, - int xvimage_id -); - - -Status -XvMCClearSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - short x, - short y, - unsigned short width, - unsigned short height, - unsigned int color -); +XvMCCreateSubpicture(Display *display, + XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, + unsigned short height, + int xvimage_id); Status -XvMCCompositeSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - XvImage *image, - short srcx, - short srcy, - unsigned short width, - unsigned short height, - short dstx, - short dsty -); +XvMCClearSubpicture(Display *display, + XvMCSubpicture *subpicture, + short x, + short y, + unsigned short width, + unsigned short height, + unsigned int color); Status -XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture); +XvMCCompositeSubpicture(Display *display, + XvMCSubpicture *subpicture, + XvImage *image, + short srcx, + short srcy, + unsigned short width, + unsigned short height, + short dstx, + short dsty); + +Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture); Status -XvMCSetSubpicturePalette ( - Display *display, - XvMCSubpicture *subpicture, - unsigned char *palette -); +XvMCSetSubpicturePalette(Display *display, + XvMCSubpicture *subpicture, + unsigned char *palette); Status -XvMCBlendSubpicture ( - Display *display, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh -); +XvMCBlendSubpicture(Display *display, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh); Status -XvMCBlendSubpicture2 ( - Display *display, - XvMCSurface *source_surface, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh -); - -Status XvMCSyncSurface (Display *display, XvMCSurface *surface); -Status XvMCFlushSurface (Display *display, XvMCSurface *surface); -Status XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat); - -Status XvMCRenderSurface ( - Display *display, - XvMCContext *context, - unsigned int picture_structure, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - unsigned int flags, - unsigned int num_macroblocks, - unsigned int first_macroblock, - XvMCMacroBlockArray *macroblock_array, - XvMCBlockArray *blocks -); - - -Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture); -Status XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture); +XvMCBlendSubpicture2(Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh); + +Status XvMCSyncSurface(Display *display, XvMCSurface *surface); +Status XvMCFlushSurface(Display *display, XvMCSurface *surface); +Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *stat); + +Status XvMCRenderSurface(Display *display, + XvMCContext *context, + unsigned int picture_structure, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks); + +Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture); +Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture); Status -XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat); - -Status XvMCCreateBlocks ( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCBlockArray *block -); - -Status XvMCDestroyBlocks (Display *display,XvMCBlockArray *block); - -Status XvMCCreateMacroBlocks ( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCMacroBlockArray *blocks -); - -Status XvMCDestroyMacroBlocks ( - Display *display, - XvMCMacroBlockArray *block -); - -XvAttribute * -XvMCQueryAttributes ( - Display *display, - XvMCContext *context, - int *number -); +XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpic, int *stat); + +Status XvMCCreateBlocks(Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCBlockArray *block); + +Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *block); + +Status XvMCCreateMacroBlocks(Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCMacroBlockArray *blocks); + +Status XvMCDestroyMacroBlocks(Display *display, + XvMCMacroBlockArray *block); + +XvAttribute *XvMCQueryAttributes(Display *display, + XvMCContext *context, + int *number); Status -XvMCSetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int value -); +XvMCSetAttribute(Display *display, + XvMCContext *context, + Atom attribute, + int value); Status -XvMCGetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int *value -); +XvMCGetAttribute(Display *display, + XvMCContext *context, + Atom attribute, + int *value); _XFUNCPROTOEND - #endif diff --git a/include/X11/extensions/vldXvMC.h b/include/X11/extensions/vldXvMC.h index fbd251e..53fb58f 100644 --- a/include/X11/extensions/vldXvMC.h +++ b/include/X11/extensions/vldXvMC.h @@ -24,7 +24,6 @@ * Author: Thomas Hellström, 2004. */ - #ifndef _VLDXVMC_H #define _VLDXVMC_H @@ -93,21 +92,20 @@ #define XVMC_P_PICTURE 2 #define XVMC_B_PICTURE 3 -typedef struct _XvMCMpegControl{ +typedef struct _XvMCMpegControl { unsigned - BVMV_range, /* Backward vertical motion vector range */ - BHMV_range, /* Backward horizontal motion vector range */ - FVMV_range, /* Forward vertical motion vector range */ - FHMV_range, /* Forward horizontal motion vector range */ - picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD, - * XVMC_FRAME_PICTURE - */ - intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */ - picture_coding_type,/* XVMC_X_PICTURE */ - mpeg_coding, /* XVMC_MPEG_2 */ - flags; /* See above */ -}XvMCMpegControl; - + BVMV_range, /* Backward vertical motion vector range */ + BHMV_range, /* Backward horizontal motion vector range */ + FVMV_range, /* Forward vertical motion vector range */ + FHMV_range, /* Forward horizontal motion vector range */ + picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD, + * XVMC_FRAME_PICTURE + */ + intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */ + picture_coding_type, /* XVMC_X_PICTURE */ + mpeg_coding, /* XVMC_MPEG_2 */ + flags; /* See above */ +} XvMCMpegControl; /* * The following function is called BEFORE starting sending slices to the @@ -117,12 +115,11 @@ typedef struct _XvMCMpegControl{ */ extern Status XvMCBeginSurface(Display *display, - XvMCContext *context, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - const XvMCMpegControl *control); - + XvMCContext *context, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + const XvMCMpegControl *control); /* * The quantizer matrix structure. This should be filled in by the user and @@ -150,16 +147,15 @@ typedef struct _XvMCQMatrix { */ extern Status XvMCLoadQMatrix(Display *display, XvMCContext *context, - const XvMCQMatrix *qmx); - + const XvMCQMatrix *qmx); /* * Put a slice to the decoder. The hardware will start processing it * immediately. */ -extern Status XvMCPutSlice(Display *display,XvMCContext *context, - char *slice, int nBytes); +extern Status XvMCPutSlice(Display *display, XvMCContext *context, + char *slice, int nBytes); /* * Put a slice without the slice start code to the decoder. * The hardware will start processing it @@ -168,7 +164,7 @@ extern Status XvMCPutSlice(Display *display,XvMCContext *context, * XvMCPutSlice2(display,context,slice+4,nBytes-4,slice[3]); */ -extern Status XvMCPutSlice2(Display *display,XvMCContext *context, - char *slice, int nBytes, int sliceCode); +extern Status XvMCPutSlice2(Display *display, XvMCContext *context, + char *slice, int nBytes, int sliceCode); #endif @@ -22,40 +22,37 @@ static XExtensionInfo _xvmc_info_data; static XExtensionInfo *xvmc_info = &_xvmc_info_data; static const char *xvmc_extension_name = XvMCName; -static const char *xvmc_error_list[] = -{ - "BadContext", - "BadSurface", - "BadSubpicture" +static const char *xvmc_error_list[] = { + "BadContext", + "BadSurface", + "BadSubpicture" }; -static XEXT_GENERATE_CLOSE_DISPLAY (xvmc_close_display, xvmc_info) - - -static XEXT_GENERATE_ERROR_STRING (xvmc_error_string, xvmc_extension_name, - XvMCNumErrors, xvmc_error_list) - +static XEXT_GENERATE_CLOSE_DISPLAY(xvmc_close_display, xvmc_info) +static XEXT_GENERATE_ERROR_STRING(xvmc_error_string, xvmc_extension_name, + XvMCNumErrors, xvmc_error_list) static XExtensionHooks xvmc_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - xvmc_close_display, /* close_display */ - NULL, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - xvmc_error_string /* error_string */ + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + xvmc_close_display, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + xvmc_error_string /* error_string */ }; -static XEXT_GENERATE_FIND_DISPLAY (xvmc_find_display, xvmc_info, - xvmc_extension_name, - &xvmc_extension_hooks, - XvMCNumEvents, NULL) +static XEXT_GENERATE_FIND_DISPLAY(xvmc_find_display, xvmc_info, + xvmc_extension_name, + &xvmc_extension_hooks, + XvMCNumEvents, NULL) -Bool XvMCQueryExtension (Display *dpy, int *event_basep, int *error_basep) +Bool +XvMCQueryExtension(Display *dpy, int *event_basep, int *error_basep) { XExtDisplayInfo *info = xvmc_find_display(dpy); @@ -63,35 +60,37 @@ Bool XvMCQueryExtension (Display *dpy, int *event_basep, int *error_basep) *event_basep = info->codes->first_event; *error_basep = info->codes->first_error; return True; - } else { + } + else { return False; } } -Status XvMCQueryVersion (Display *dpy, int *major, int *minor) +Status +XvMCQueryVersion(Display *dpy, int *major, int *minor) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcQueryVersionReply rep; - xvmcQueryVersionReq *req; + xvmcQueryVersionReq *req; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (QueryVersion, req); - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); + LockDisplay(dpy); + XvMCGetReq(QueryVersion, req); + if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); return BadImplementation; } *major = rep.major; *minor = rep.minor; - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } - -XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) +XvMCSurfaceInfo * +XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcListSurfaceTypesReply rep; @@ -100,123 +99,120 @@ XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) *num = 0; - XvMCCheckExtension (dpy, info, NULL); + XvMCCheckExtension(dpy, info, NULL); - LockDisplay (dpy); - XvMCGetReq (ListSurfaceTypes, req); + LockDisplay(dpy); + XvMCGetReq(ListSurfaceTypes, req); req->port = port; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); return NULL; } - if(rep.num > 0) { + if (rep.num > 0) { if (rep.num < (INT_MAX / sizeof(XvMCSurfaceInfo))) surface_info = Xmalloc(rep.num * sizeof(XvMCSurfaceInfo)); - if(surface_info) { - xvmcSurfaceInfo sinfo; - CARD32 i; - - *num = rep.num; - - for(i = 0; i < rep.num; i++) { - _XRead(dpy, (char*)&sinfo, sizeof(xvmcSurfaceInfo)); - surface_info[i].surface_type_id = sinfo.surface_type_id; - surface_info[i].chroma_format = sinfo.chroma_format; - surface_info[i].max_width = sinfo.max_width; - surface_info[i].max_height = sinfo.max_height; - surface_info[i].subpicture_max_width = - sinfo.subpicture_max_width; - surface_info[i].subpicture_max_height = - sinfo.subpicture_max_height; - surface_info[i].mc_type = sinfo.mc_type; - surface_info[i].flags = sinfo.flags; - } - } else - _XEatDataWords(dpy, rep.length); + if (surface_info) { + xvmcSurfaceInfo sinfo; + CARD32 i; + + *num = rep.num; + + for (i = 0; i < rep.num; i++) { + _XRead(dpy, (char *) &sinfo, sizeof(xvmcSurfaceInfo)); + surface_info[i].surface_type_id = sinfo.surface_type_id; + surface_info[i].chroma_format = sinfo.chroma_format; + surface_info[i].max_width = sinfo.max_width; + surface_info[i].max_height = sinfo.max_height; + surface_info[i].subpicture_max_width = + sinfo.subpicture_max_width; + surface_info[i].subpicture_max_height = + sinfo.subpicture_max_height; + surface_info[i].mc_type = sinfo.mc_type; + surface_info[i].flags = sinfo.flags; + } + } + else + _XEatDataWords(dpy, rep.length); } - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return surface_info; } - -XvImageFormatValues * XvMCListSubpictureTypes ( - Display * dpy, - XvPortID port, - int surface_type_id, - int *count_return -) +XvImageFormatValues * +XvMCListSubpictureTypes(Display *dpy, + XvPortID port, + int surface_type_id, + int *count_return) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcListSubpictureTypesReply rep; xvmcListSubpictureTypesReq *req; XvImageFormatValues *ret = NULL; - *count_return = 0; - XvMCCheckExtension (dpy, info, NULL); - + XvMCCheckExtension(dpy, info, NULL); - LockDisplay (dpy); - XvMCGetReq (ListSubpictureTypes, req); + LockDisplay(dpy); + XvMCGetReq(ListSubpictureTypes, req); req->port = port; req->surface_type_id = surface_type_id; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); return NULL; } - if(rep.num > 0) { + if (rep.num > 0) { if (rep.num < (INT_MAX / sizeof(XvImageFormatValues))) ret = Xmalloc(rep.num * sizeof(XvImageFormatValues)); - if(ret) { + if (ret) { xvImageFormatInfo Info; CARD32 i; *count_return = rep.num; - for(i = 0; i < rep.num; 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; + for (i = 0; i < rep.num; 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; } - } else - _XEatDataWords(dpy, rep.length); + } + else + _XEatDataWords(dpy, rep.length); } - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return ret; } - /****************************************************************** These are intended as a protocol interface to be used by direct rendering libraries. They are not intended to be client viewable @@ -238,13 +234,11 @@ XvImageFormatValues * XvMCListSubpictureTypes ( an XVMC_DIRECT context was specified. */ - -Status _xvmc_create_context ( - Display *dpy, - XvMCContext *context, - int *priv_count, - CARD32 **priv_data -) +Status +_xvmc_create_context(Display *dpy, + XvMCContext *context, + int *priv_count, + CARD32 **priv_data) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcCreateContextReply rep; @@ -253,10 +247,10 @@ Status _xvmc_create_context ( *priv_count = 0; *priv_data = NULL; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (CreateContext, req); + LockDisplay(dpy); + XvMCGetReq(CreateContext, req); context->context_id = XAllocID(dpy); req->context_id = context->context_id; req->port = context->port; @@ -264,49 +258,47 @@ Status _xvmc_create_context ( req->width = context->width; req->height = context->height; req->flags = context->flags; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); return BadImplementation; } context->width = rep.width_actual; context->height = rep.height_actual; context->flags = rep.flags_return; - if(rep.length) { - if (rep.length < (INT_MAX >> 2)) - *priv_data = Xmalloc(rep.length << 2); - if(*priv_data) { - _XRead(dpy, (char*)(*priv_data), rep.length << 2); - *priv_count = rep.length; - } else - _XEatDataWords(dpy, rep.length); + if (rep.length) { + if (rep.length < (INT_MAX >> 2)) + *priv_data = Xmalloc(rep.length << 2); + if (*priv_data) { + _XRead(dpy, (char *) (*priv_data), rep.length << 2); + *priv_count = rep.length; + } + else + _XEatDataWords(dpy, rep.length); } - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } -Status _xvmc_destroy_context ( - Display *dpy, - XvMCContext *context -) +Status +_xvmc_destroy_context(Display *dpy, XvMCContext *context) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcDestroyContextReq *req; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (DestroyContext, req); + LockDisplay(dpy); + XvMCGetReq(DestroyContext, req); req->context_id = context->context_id; - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } - /* _xvmc_create_surface - @@ -321,13 +313,12 @@ Status _xvmc_destroy_context ( */ -Status _xvmc_create_surface ( - Display *dpy, - XvMCContext *context, - XvMCSurface *surface, - int *priv_count, - CARD32 **priv_data -) +Status +_xvmc_create_surface(Display *dpy, + XvMCContext *context, + XvMCSurface *surface, + int *priv_count, + CARD32 **priv_data) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcCreateSurfaceReply rep; @@ -336,10 +327,10 @@ Status _xvmc_create_surface ( *priv_count = 0; *priv_data = NULL; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (CreateSurface, req); + LockDisplay(dpy); + XvMCGetReq(CreateSurface, req); surface->surface_id = XAllocID(dpy); surface->context_id = context->context_id; @@ -349,42 +340,41 @@ Status _xvmc_create_surface ( req->surface_id = surface->surface_id; req->context_id = surface->context_id; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); return BadImplementation; } - if(rep.length) { + if (rep.length) { if (rep.length < (INT_MAX >> 2)) *priv_data = Xmalloc(rep.length << 2); - if(*priv_data) { - _XRead(dpy, (char*)(*priv_data), rep.length << 2); + if (*priv_data) { + _XRead(dpy, (char *) (*priv_data), rep.length << 2); *priv_count = rep.length; - } else + } + else _XEatDataWords(dpy, rep.length); } - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } -Status _xvmc_destroy_surface ( - Display *dpy, - XvMCSurface *surface -) +Status +_xvmc_destroy_surface(Display *dpy, XvMCSurface *surface) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcDestroySurfaceReq *req; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (DestroySurface, req); + LockDisplay(dpy); + XvMCGetReq(DestroySurface, req); req->surface_id = surface->surface_id; - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } @@ -403,13 +393,12 @@ Status _xvmc_destroy_surface ( */ -Status _xvmc_create_subpicture ( - Display *dpy, - XvMCContext *context, - XvMCSubpicture *subpicture, - int *priv_count, - CARD32 **priv_data -) +Status +_xvmc_create_subpicture(Display *dpy, + XvMCContext *context, + XvMCSubpicture *subpicture, + int *priv_count, + CARD32 **priv_data) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcCreateSubpictureReply rep; @@ -418,10 +407,10 @@ Status _xvmc_create_subpicture ( *priv_count = 0; *priv_data = NULL; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (CreateSubpicture, req); + LockDisplay(dpy); + XvMCGetReq(CreateSubpicture, req); subpicture->subpicture_id = XAllocID(dpy); subpicture->context_id = context->context_id; @@ -431,9 +420,9 @@ Status _xvmc_create_subpicture ( req->xvimage_id = subpicture->xvimage_id; req->width = subpicture->width; req->height = subpicture->height; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); return BadImplementation; } @@ -446,44 +435,44 @@ Status _xvmc_create_subpicture ( subpicture->component_order[2] = rep.component_order[2]; subpicture->component_order[3] = rep.component_order[3]; - if(rep.length) { + if (rep.length) { if (rep.length < (INT_MAX >> 2)) *priv_data = Xmalloc(rep.length << 2); - if(*priv_data) { - _XRead(dpy, (char*)(*priv_data), rep.length << 2); + if (*priv_data) { + _XRead(dpy, (char *) (*priv_data), rep.length << 2); *priv_count = rep.length; - } else + } + else _XEatDataWords(dpy, rep.length); } - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } -Status _xvmc_destroy_subpicture( - Display *dpy, - XvMCSubpicture *subpicture -) +Status +_xvmc_destroy_subpicture(Display *dpy, XvMCSubpicture *subpicture) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcDestroySubpictureReq *req; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (DestroySubpicture, req); + LockDisplay(dpy); + XvMCGetReq(DestroySubpicture, req); req->subpicture_id = subpicture->subpicture_id; - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); return Success; } -Status XvMCGetDRInfo(Display *dpy, XvPortID port, - char **name, char **busID, - int *major, int *minor, - int *patchLevel, - int *isLocal) +Status +XvMCGetDRInfo(Display *dpy, XvPortID port, + char **name, char **busID, + int *major, int *minor, + int *patchLevel, + int *isLocal) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcGetDRInfoReply rep; @@ -495,6 +484,7 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port, volatile CARD32 *shMem; struct timezone here; struct timeval now; + here.tz_minuteswest = 0; here.tz_dsttime = 0; #endif @@ -502,10 +492,10 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port, *name = NULL; *busID = NULL; - XvMCCheckExtension (dpy, info, BadImplementation); + XvMCCheckExtension(dpy, info, BadImplementation); - LockDisplay (dpy); - XvMCGetReq (GetDRInfo, req); + LockDisplay(dpy); + XvMCGetReq(GetDRInfo, req); req->port = port; magic = 0; @@ -524,84 +514,86 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port, */ if (shmKey >= 0) { - shMem = (CARD32 *) shmat(shmKey, NULL, 0); - shmctl(shmKey, IPC_RMID, NULL); - if (shMem != (void *) -1) { - - register volatile CARD32 *shMemC = shMem; - register int i; - - gettimeofday( &now, &here); - magic = now.tv_usec & 0x000FFFFF; - req->magic = magic; - i = 1024 / sizeof(CARD32); - while(i--) { - *shMemC++ = magic; - magic = ~magic; - } - } else { - req->shmKey = -1; - shmKey = -1; - } + shMem = (CARD32 *) shmat(shmKey, NULL, 0); + shmctl(shmKey, IPC_RMID, NULL); + if (shMem != (void *) -1) { + + register volatile CARD32 *shMemC = shMem; + register int i; + + gettimeofday(&now, &here); + magic = now.tv_usec & 0x000FFFFF; + req->magic = magic; + i = 1024 / sizeof(CARD32); + while (i--) { + *shMemC++ = magic; + magic = ~magic; + } + } + else { + req->shmKey = -1; + shmKey = -1; + } } #else req->shmKey = 0; #endif - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); #ifdef HAVE_SHMAT - if (shmKey >= 0) { - shmdt( (const void *) shMem ); - } + if (shmKey >= 0) { + shmdt((const void *) shMem); + } #endif return -1; } #ifdef HAVE_SHMAT if (shmKey >= 0) { - shmdt( (const void *) shMem ); + shmdt((const void *) shMem); } #endif if (rep.length > 0) { - unsigned long realSize = 0; - char *tmpBuf = NULL; - - if ((rep.length < (INT_MAX >> 2)) && - /* protect against overflow in strncpy below */ - (rep.nameLen + rep.busIDLen > rep.nameLen)) { - realSize = rep.length << 2; - if (realSize >= (rep.nameLen + rep.busIDLen)) { - tmpBuf = Xmalloc(realSize); - *name = Xmalloc(rep.nameLen); - *busID = Xmalloc(rep.busIDLen); - } - } - - if (*name && *busID && tmpBuf) { - _XRead(dpy, tmpBuf, realSize); - strncpy(*name,tmpBuf,rep.nameLen); - (*name)[rep.nameLen == 0 ? 0 : rep.nameLen - 1] = '\0'; - strncpy(*busID,tmpBuf+rep.nameLen,rep.busIDLen); - (*busID)[rep.busIDLen == 0 ? 0 : rep.busIDLen - 1] = '\0'; - XFree(tmpBuf); - } else { - XFree(*name); - *name = NULL; - XFree(*busID); - *busID = NULL; - XFree(tmpBuf); - - _XEatDataWords(dpy, rep.length); - UnlockDisplay (dpy); - SyncHandle (); - return -1; - - } + unsigned long realSize = 0; + char *tmpBuf = NULL; + + if ((rep.length < (INT_MAX >> 2)) && + /* protect against overflow in strncpy below */ + (rep.nameLen + rep.busIDLen > rep.nameLen)) { + realSize = rep.length << 2; + if (realSize >= (rep.nameLen + rep.busIDLen)) { + tmpBuf = Xmalloc(realSize); + *name = Xmalloc(rep.nameLen); + *busID = Xmalloc(rep.busIDLen); + } + } + + if (*name && *busID && tmpBuf) { + _XRead(dpy, tmpBuf, realSize); + strncpy(*name, tmpBuf, rep.nameLen); + (*name)[rep.nameLen == 0 ? 0 : rep.nameLen - 1] = '\0'; + strncpy(*busID, tmpBuf + rep.nameLen, rep.busIDLen); + (*busID)[rep.busIDLen == 0 ? 0 : rep.busIDLen - 1] = '\0'; + XFree(tmpBuf); + } + else { + XFree(*name); + *name = NULL; + XFree(*busID); + *busID = NULL; + XFree(tmpBuf); + + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return -1; + + } } - UnlockDisplay (dpy); - SyncHandle (); + UnlockDisplay(dpy); + SyncHandle(); *major = rep.major; *minor = rep.minor; *patchLevel = rep.patchLevel; @@ -613,4 +605,3 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port, *isLocal = 1; return (rep.length > 0) ? Success : BadImplementation; } - diff --git a/src/XvMClibint.h b/src/XvMClibint.h index 195a77d..b21b966 100644 --- a/src/XvMClibint.h +++ b/src/XvMClibint.h @@ -9,7 +9,6 @@ #define XvMCCheckExtension(dpy, i, val) \ XextCheckExtension(dpy, i, xvmc_extension_name, val) - #define XvMCGetReq(name, req) \ WORD64ALIGN\ if ((dpy->bufptr + sizeof(xvmc##name##Req)) > dpy->bufmax)\ @@ -24,41 +23,41 @@ _XFUNCPROTOBEGIN Status _xvmc_create_context( - Display * /* dpy */, - XvMCContext * /* context */, - int * /* priv_count */, - CARD32 ** /* priv_data */ + Display * /* dpy */, + XvMCContext * /* context */, + int * /* priv_count */, + CARD32 ** /* priv_data */ ); Status _xvmc_destroy_context( - Display * /* dpy */, - XvMCContext * /* context */ + Display * /* dpy */, + XvMCContext * /* context */ ); -Status _xvmc_create_surface ( - Display * /* dpy */, - XvMCContext * /* context */, - XvMCSurface * /* surface */, - int * /* priv_count */, - CARD32 ** /* priv_data */ +Status _xvmc_create_surface( + Display * /* dpy */, + XvMCContext * /* context */, + XvMCSurface * /* surface */, + int * /* priv_count */, + CARD32 ** /* priv_data */ ); -Status _xvmc_destroy_surface ( - Display * /* dpy */, - XvMCSurface * /* surface */ +Status _xvmc_destroy_surface( + Display * /* dpy */, + XvMCSurface * /* surface */ ); -Status _xvmc_create_subpicture ( - Display * /* dpy */, - XvMCContext * /* context */, - XvMCSubpicture * /* subpicture */, - int * /* priv_count */, - CARD32 ** /* priv_data */ +Status _xvmc_create_subpicture( + Display * /* dpy */, + XvMCContext * /* context */, + XvMCSubpicture * /* subpicture */, + int * /* priv_count */, + CARD32 ** /* priv_data */ ); Status _xvmc_destroy_subpicture( - Display * /* dpy */, - XvMCSubpicture * /* subpicture */ + Display * /* dpy */, + XvMCSubpicture * /* subpicture */ ); _XFUNCPROTOEND diff --git a/wrapper/XvMCWrapper.c b/wrapper/XvMCWrapper.c index 7a4c86d..7a07634 100644 --- a/wrapper/XvMCWrapper.c +++ b/wrapper/XvMCWrapper.c @@ -26,9 +26,10 @@ */ /* - * BUGS: The wrapper really should maintain one symbol table per port. This - * could possibly be implemented. To do that, the port-independent symbols need to be lifted out, - * and one would have to create a number of mapping tables: + * BUGS: The wrapper really should maintain one symbol table per port. + * This could possibly be implemented. To do that, the port-independent + * symbols need to be lifted out, and one would have to create a number + * of mapping tables: * * port -> symbol table * context -> port @@ -36,12 +37,12 @@ * subpicture -> port * * and reference the right table when needed. - * This needs to be done only if there is a player that wants to access two displays with different - * hardware simultaneously. Not likely as of today. + * This needs to be done only if there is a player that wants to access two + * displays with different hardware simultaneously. Not likely as of today. */ #ifdef HAVE_CONFIG_H - #include "config.h" +#include "config.h" #endif #include <X11/Xlib.h> @@ -54,111 +55,124 @@ #include <ctype.h> #include <stdlib.h> - typedef Bool (*XvMCQueryExtensionP) (Display *, int *, int *); -typedef Status (*XvMCQueryVersionP) (Display *, int *,int *); -typedef XvMCSurfaceInfo * (*XvMCListSurfaceTypesP)(Display *, XvPortID, int *); -typedef Status (* XvMCCreateContextP) (Display *,XvPortID,int ,int ,int ,int ,XvMCContext * ); -typedef Status (*XvMCDestroyContextP) (Display *, XvMCContext * ); -typedef Status (*XvMCCreateSurfaceP)(Display *,XvMCContext *,XvMCSurface *); -typedef Status (*XvMCDestroySurfaceP)(Display *, XvMCSurface *); -typedef XvImageFormatValues * (*XvMCListSubpictureTypesP) (Display *,XvPortID ,int ,int *); -typedef Status (*XvMCPutSurfaceP)(Display *,XvMCSurface *,Drawable ,short , short , unsigned short , - unsigned short ,short ,short ,unsigned short ,unsigned short ,int ); -typedef Status (*XvMCHideSurfaceP)(Display *, XvMCSurface *); -typedef Status (*XvMCCreateSubpictureP) (Display *, XvMCContext *, XvMCSubpicture *, - unsigned short, unsigned short,int); -typedef Status (*XvMCClearSubpictureP) (Display *,XvMCSubpicture *,short,short,unsigned short,unsigned short, - unsigned int); -typedef Status (*XvMCCompositeSubpictureP) (Display *, XvMCSubpicture *,XvImage *,short,short, - unsigned short, unsigned short,short,short); +typedef Status (*XvMCQueryVersionP) (Display *, int *, int *); +typedef XvMCSurfaceInfo *(*XvMCListSurfaceTypesP) (Display *, XvPortID, int *); +typedef Status (*XvMCCreateContextP) (Display *, XvPortID, int, int, int, int, + XvMCContext *); +typedef Status (*XvMCDestroyContextP) (Display *, XvMCContext *); +typedef Status (*XvMCCreateSurfaceP) (Display *, XvMCContext *, XvMCSurface *); +typedef Status (*XvMCDestroySurfaceP) (Display *, XvMCSurface *); +typedef XvImageFormatValues *(*XvMCListSubpictureTypesP)(Display *, XvPortID, + int, int *); +typedef Status (*XvMCPutSurfaceP) (Display *, XvMCSurface *, Drawable, short, + short, unsigned short, unsigned short, short, + short, unsigned short, unsigned short, int); +typedef Status (*XvMCHideSurfaceP) (Display *, XvMCSurface *); +typedef Status (*XvMCCreateSubpictureP) (Display *, XvMCContext *, + XvMCSubpicture *, unsigned short, + unsigned short, int); +typedef Status (*XvMCClearSubpictureP) (Display *, XvMCSubpicture *, short, + short, unsigned short, unsigned short, + unsigned int); +typedef Status (*XvMCCompositeSubpictureP) (Display *, XvMCSubpicture *, + XvImage *, short, short, + unsigned short, unsigned short, + short, short); typedef Status (*XvMCDestroySubpictureP) (Display *, XvMCSubpicture *); -typedef Status (*XvMCSetSubpicturePaletteP) (Display *, XvMCSubpicture *, unsigned char *); -typedef Status (*XvMCBlendSubpictureP) (Display *d,XvMCSurface *,XvMCSubpicture *,short, - short,unsigned short,unsigned short,short,short, - unsigned short,unsigned short); -typedef Status (*XvMCBlendSubpicture2P) (Display *,XvMCSurface *,XvMCSurface *, - XvMCSubpicture *,short,short,unsigned short, - unsigned short,short,short,unsigned short, - unsigned short); +typedef Status (*XvMCSetSubpicturePaletteP) (Display *, XvMCSubpicture *, + unsigned char *); +typedef Status (*XvMCBlendSubpictureP) (Display * d, XvMCSurface *, + XvMCSubpicture *, short, short, + unsigned short, unsigned short, short, + short, unsigned short, unsigned short); +typedef Status (*XvMCBlendSubpicture2P) (Display *, XvMCSurface *, XvMCSurface *, + XvMCSubpicture *, short, short, + unsigned short, unsigned short, short, + short, unsigned short, unsigned short); typedef Status (*XvMCSyncSurfaceP) (Display *, XvMCSurface *); typedef Status (*XvMCFlushSurfaceP) (Display *, XvMCSurface *); typedef Status (*XvMCGetSurfaceStatusP) (Display *, XvMCSurface *, int *); -typedef Status (*XvMCRenderSurfaceP) (Display *,XvMCContext *,unsigned int,XvMCSurface *, - XvMCSurface *,XvMCSurface *,unsigned int,unsigned int, - unsigned int,XvMCMacroBlockArray *,XvMCBlockArray *); +typedef Status (*XvMCRenderSurfaceP) (Display *, XvMCContext *, unsigned int, + XvMCSurface *, XvMCSurface *, + XvMCSurface *, unsigned int, unsigned int, + unsigned int, XvMCMacroBlockArray *, + XvMCBlockArray *); typedef Status (*XvMCSyncSubpictureP) (Display *, XvMCSubpicture *); typedef Status (*XvMCFlushSubpictureP) (Display *, XvMCSubpicture *); typedef Status (*XvMCGetSubpictureStatusP) (Display *, XvMCSubpicture *, int *); -typedef Status (*XvMCCreateBlocksP) (Display *, XvMCContext *,unsigned int,XvMCBlockArray *); -typedef Status (*XvMCDestroyBlocksP) (Display *,XvMCBlockArray *); -typedef Status (*XvMCCreateMacroBlocksP) (Display *,XvMCContext *,unsigned int, - XvMCMacroBlockArray *); -typedef Status (*XvMCDestroyMacroBlocksP) (Display *,XvMCMacroBlockArray *); -typedef XvAttribute *(*XvMCQueryAttributesP) (Display *,XvMCContext *,int *); -typedef Status (*XvMCSetAttributeP) (Display *,XvMCContext *, Atom, int); -typedef Status (*XvMCGetAttributeP) (Display *,XvMCContext *, Atom, int *); +typedef Status (*XvMCCreateBlocksP) (Display *, XvMCContext *, unsigned int, + XvMCBlockArray *); +typedef Status (*XvMCDestroyBlocksP) (Display *, XvMCBlockArray *); +typedef Status (*XvMCCreateMacroBlocksP) (Display *, XvMCContext *, unsigned int, + XvMCMacroBlockArray *); +typedef Status (*XvMCDestroyMacroBlocksP) (Display *, XvMCMacroBlockArray *); +typedef XvAttribute *(*XvMCQueryAttributesP)(Display *, XvMCContext *, int *); +typedef Status (*XvMCSetAttributeP) (Display *, XvMCContext *, Atom, int); +typedef Status (*XvMCGetAttributeP) (Display *, XvMCContext *, Atom, int *); /* * Nonstandard VLD acceleration level: */ -typedef Status (*XvMCBeginSurfaceP) (Display *,XvMCContext *,XvMCSurface *, - XvMCSurface *,XvMCSurface *f,const XvMCMpegControl *); -typedef Status (*XvMCLoadQMatrixP) (Display *, XvMCContext *,const XvMCQMatrix *); -typedef Status (*XvMCPutSliceP)(Display *,XvMCContext *, char *,int); -typedef Status (*XvMCPutSlice2P)(Display *,XvMCContext *, char *,int, unsigned); -typedef Status (*XvMCGetDRInfoP)(Display *, XvPortID, char **, char **, int *, int *, - int *, int *); - +typedef Status (*XvMCBeginSurfaceP) (Display *, XvMCContext *, XvMCSurface *, + XvMCSurface *, XvMCSurface * f, + const XvMCMpegControl *); +typedef Status (*XvMCLoadQMatrixP) (Display *, XvMCContext *, + const XvMCQMatrix *); +typedef Status (*XvMCPutSliceP) (Display *, XvMCContext *, char *, int); +typedef Status (*XvMCPutSlice2P) (Display *, XvMCContext *, char *, int, + unsigned); +typedef Status (*XvMCGetDRInfoP) (Display *, XvPortID, char **, char **, int *, + int *, int *, int *); typedef struct { - XvMCQueryExtensionP XvMCQueryExtension; - XvMCQueryVersionP XvMCQueryVersion; - XvMCListSurfaceTypesP XvMCListSurfaceTypes; - XvMCCreateContextP XvMCCreateContext; - XvMCDestroyContextP XvMCDestroyContext; - XvMCCreateSurfaceP XvMCCreateSurface; - XvMCDestroySurfaceP XvMCDestroySurface; + XvMCQueryExtensionP XvMCQueryExtension; + XvMCQueryVersionP XvMCQueryVersion; + XvMCListSurfaceTypesP XvMCListSurfaceTypes; + XvMCCreateContextP XvMCCreateContext; + XvMCDestroyContextP XvMCDestroyContext; + XvMCCreateSurfaceP XvMCCreateSurface; + XvMCDestroySurfaceP XvMCDestroySurface; XvMCListSubpictureTypesP XvMCListSubpictureTypes; - XvMCPutSurfaceP XvMCPutSurface; - XvMCHideSurfaceP XvMCHideSurface; - XvMCCreateSubpictureP XvMCCreateSubpicture; - XvMCClearSubpictureP XvMCClearSubpicture; + XvMCPutSurfaceP XvMCPutSurface; + XvMCHideSurfaceP XvMCHideSurface; + XvMCCreateSubpictureP XvMCCreateSubpicture; + XvMCClearSubpictureP XvMCClearSubpicture; XvMCCompositeSubpictureP XvMCCompositeSubpicture; - XvMCDestroySubpictureP XvMCDestroySubpicture; - XvMCSetSubpicturePaletteP XvMCSetSubpicturePalette; - XvMCBlendSubpictureP XvMCBlendSubpicture; - XvMCBlendSubpicture2P XvMCBlendSubpicture2; - XvMCSyncSurfaceP XvMCSyncSurface; - XvMCFlushSurfaceP XvMCFlushSurface; - XvMCGetSurfaceStatusP XvMCGetSurfaceStatus; - XvMCRenderSurfaceP XvMCRenderSurface; - XvMCSyncSubpictureP XvMCSyncSubpicture; - XvMCFlushSubpictureP XvMCFlushSubpicture; + XvMCDestroySubpictureP XvMCDestroySubpicture; + XvMCSetSubpicturePaletteP XvMCSetSubpicturePalette; + XvMCBlendSubpictureP XvMCBlendSubpicture; + XvMCBlendSubpicture2P XvMCBlendSubpicture2; + XvMCSyncSurfaceP XvMCSyncSurface; + XvMCFlushSurfaceP XvMCFlushSurface; + XvMCGetSurfaceStatusP XvMCGetSurfaceStatus; + XvMCRenderSurfaceP XvMCRenderSurface; + XvMCSyncSubpictureP XvMCSyncSubpicture; + XvMCFlushSubpictureP XvMCFlushSubpicture; XvMCGetSubpictureStatusP XvMCGetSubpictureStatus; - XvMCCreateBlocksP XvMCCreateBlocks; - XvMCDestroyBlocksP XvMCDestroyBlocks; - XvMCCreateMacroBlocksP XvMCCreateMacroBlocks; - XvMCDestroyMacroBlocksP XvMCDestroyMacroBlocks; - XvMCQueryAttributesP XvMCQueryAttributes; - XvMCSetAttributeP XvMCSetAttribute; - XvMCGetAttributeP XvMCGetAttribute; + XvMCCreateBlocksP XvMCCreateBlocks; + XvMCDestroyBlocksP XvMCDestroyBlocks; + XvMCCreateMacroBlocksP XvMCCreateMacroBlocks; + XvMCDestroyMacroBlocksP XvMCDestroyMacroBlocks; + XvMCQueryAttributesP XvMCQueryAttributes; + XvMCSetAttributeP XvMCSetAttribute; + XvMCGetAttributeP XvMCGetAttribute; /* * Nonstandard VLD acceleration level: */ - XvMCBeginSurfaceP XvMCBeginSurface; - XvMCLoadQMatrixP XvMCLoadQMatrix; - XvMCPutSliceP XvMCPutSlice; - XvMCPutSlice2P XvMCPutSlice2; + XvMCBeginSurfaceP XvMCBeginSurface; + XvMCLoadQMatrixP XvMCLoadQMatrix; + XvMCPutSliceP XvMCPutSlice; + XvMCPutSlice2P XvMCPutSlice2; /* * Driver name function. */ - XvMCGetDRInfoP XvMCGetDRInfo; + XvMCGetDRInfoP XvMCGetDRInfo; int preInitialised; int initialised; @@ -198,36 +212,36 @@ static void *handle2; if (dlerror() != NULL) return; \ } - /* * Try to dlopen a shared library, versionless first. */ - -static void *dlopenversion(const char *lib, const char *version, int flag) -{ - void *ret; - int curLen,verLen; - char *curName; - const char *tail; - - - curLen = strlen(lib) + (verLen = strlen(version)) + 1; - curName = (char *) malloc(curLen * sizeof(char)); - strncpy( curName, lib, curLen); - if (verLen > 1) { - if (NULL != (tail = strstr(version+1,"."))) { - strncat( curName, version, tail - version); - } else { - strncat( curName, version, verLen); +static void * +dlopenversion(const char *lib, const char *version, int flag) +{ + void *ret; + int curLen, verLen; + char *curName; + const char *tail; + + curLen = strlen(lib) + (verLen = strlen(version)) + 1; + curName = (char *) malloc(curLen * sizeof(char)); + strncpy(curName, lib, curLen); + if (verLen > 1) { + if (NULL != (tail = strstr(version + 1, "."))) { + strncat(curName, version, tail - version); + } + else { + strncat(curName, version, verLen); + } } - } - ret = dlopen(curName, flag); - free(curName); - return ret; + ret = dlopen(curName, flag); + free(curName); + return ret; } -static int preInitW(Display *dpy) +static int +preInitW(Display *dpy) { /* @@ -241,16 +255,18 @@ static int preInitW(Display *dpy) xW.initialised = 0; xvhandle = dlopenversion("libXv.so", XV_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); if (!xvhandle) { - fprintf(stderr,"XvMCWrapper: Warning! Could not open shared " - "library \"libXv.so" XV_SOVERSION "\"\nThis may cause relocation " - "errors later.\nError was: \"%s\".\n",dlerror()); + fprintf(stderr, "XvMCWrapper: Warning! Could not open shared " + "library \"libXv.so" XV_SOVERSION + "\"\nThis may cause relocation " + "errors later.\nError was: \"%s\".\n", dlerror()); } - handle2 = dlopenversion("libXvMC.so", XVMC_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); + handle2 = + dlopenversion("libXvMC.so", XVMC_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); if (!handle2) { - fprintf(stderr,"XvMCWrapper: Could not load XvMC " - "library \"libXvMC.so" XVMC_SOVERSION "\". Failing\n"); - fprintf(stderr,"%s\n",dlerror()); - return 1; + fprintf(stderr, "XvMCWrapper: Could not load XvMC " + "library \"libXvMC.so" XVMC_SOVERSION "\". Failing\n"); + fprintf(stderr, "%s\n", dlerror()); + return 1; } XW_RSYM(xW, handle2, handleZ, XvMCQueryExtension, 1); XW_RSYM(xW, handle2, handleZ, XvMCQueryVersion, 1); @@ -258,7 +274,8 @@ static int preInitW(Display *dpy) return 0; } -static void initW(Display *dpy, XvPortID port) +static void +initW(Display *dpy, XvPortID port) { char nameBuffer[BUFLEN]; void *handle; @@ -267,96 +284,102 @@ static void initW(Display *dpy, XvPortID port) char *err; FILE *configFile; int nameLen = 0; - int major,minor,patchLevel,isLocal; + int major, minor, patchLevel, isLocal; char *busID = NULL; wrapperInit = 1; xW.initialised = 0; if (!wrapperPreInit) - if (preInitW( dpy )) return; + if (preInitW(dpy)) + return; /* * Will the DDX tell us the client driver name? */ xW.XvMCGetDRInfo = (XvMCGetDRInfoP) - dlsym(handle2,"XvMCGetDRInfo"); + dlsym(handle2, "XvMCGetDRInfo"); if ((err = dlerror()) == NULL) { - if (0 == xW.XvMCGetDRInfo( dpy, port, &clientName, &busID, &major, - &minor,&patchLevel, &isLocal)) { - nameLen = strlen(clientName); - XFree(busID); - if (!isLocal) { - fprintf(stderr,"XvMCWrapper: X server is not local. Cannot run XvMC.\n"); - XFree(clientName); - return; - } - } else { - clientName = NULL; - } + if (0 == xW.XvMCGetDRInfo(dpy, port, &clientName, &busID, &major, + &minor, &patchLevel, &isLocal)) { + nameLen = strlen(clientName); + XFree(busID); + if (!isLocal) { + fprintf(stderr, + "XvMCWrapper: X server is not local. Cannot run XvMC.\n"); + XFree(clientName); + return; + } + } + else { + clientName = NULL; + } } - if (clientName && (nameLen < BUFLEN-7) && (nameLen > 0)) { - nameLen += 3; - strncpy(nameBuffer,"lib",BUFLEN-1); - strncpy(nameBuffer+3, clientName, BUFLEN-4); - strncpy(nameBuffer + nameLen, ".so", BUFLEN-nameLen-1); - nameBuffer[BUFLEN-1] = 0; - XFree(clientName); - handle = dlopenversion(nameBuffer, XVMC_SOVERSION,RTLD_LAZY); - } else { - /* - * No. Try to obtain it from the config file. - */ - - if (clientName) XFree(clientName); - - configFile = fopen(STRS(XVMC_CONFIGDIR) "/XvMCConfig","r"); - - xW.initialised = 0; - xW.vldextension = 0; - - if (NULL == configFile) { - fprintf(stderr,"XvMCWrapper: Could not open config file \"%s\".\n", - STRS(XVMC_CONFIGDIR) "/XvMCConfig"); - perror("XvMCWrapper"); - return; - } - - if (NULL == fgets(nameBuffer, BUFLEN, configFile)) { - fclose(configFile); - fprintf(stderr,"XvMCWrapper: Could not read XvMC library name.\n"); - perror("XvMCWrapper"); - return; - } - - fclose(configFile); - if ((tmp = strlen(nameBuffer)) == 0) { - fprintf(stderr,"XvMCWrapper: Zero length XvMC library name.\n"); - fprintf(stderr,"%s\n",dlerror()); - return; - } - - /* - * Skip trailing newlines and garbage. - */ - - while (iscntrl(nameBuffer[tmp-1])) { - nameBuffer[tmp-1] = 0; - if (--tmp == 0) { - fprintf(stderr,"XvMCWrapper: Zero length XvMC library name.\n"); - return; - } - } - handle = dlopen(nameBuffer,RTLD_LAZY); + if (clientName && (nameLen < BUFLEN - 7) && (nameLen > 0)) { + nameLen += 3; + strncpy(nameBuffer, "lib", BUFLEN - 1); + strncpy(nameBuffer + 3, clientName, BUFLEN - 4); + strncpy(nameBuffer + nameLen, ".so", BUFLEN - nameLen - 1); + nameBuffer[BUFLEN - 1] = 0; + XFree(clientName); + handle = dlopenversion(nameBuffer, XVMC_SOVERSION, RTLD_LAZY); + } + else { + /* + * No. Try to obtain it from the config file. + */ + + if (clientName) + XFree(clientName); + + configFile = fopen(STRS(XVMC_CONFIGDIR) "/XvMCConfig", "r"); + + xW.initialised = 0; + xW.vldextension = 0; + + if (NULL == configFile) { + fprintf(stderr, "XvMCWrapper: Could not open config file \"%s\".\n", + STRS(XVMC_CONFIGDIR) "/XvMCConfig"); + perror("XvMCWrapper"); + return; + } + + if (NULL == fgets(nameBuffer, BUFLEN, configFile)) { + fclose(configFile); + fprintf(stderr, "XvMCWrapper: Could not read XvMC library name.\n"); + perror("XvMCWrapper"); + return; + } + + fclose(configFile); + if ((tmp = strlen(nameBuffer)) == 0) { + fprintf(stderr, "XvMCWrapper: Zero length XvMC library name.\n"); + fprintf(stderr, "%s\n", dlerror()); + return; + } + + /* + * Skip trailing newlines and garbage. + */ + + while (iscntrl(nameBuffer[tmp - 1])) { + nameBuffer[tmp - 1] = 0; + if (--tmp == 0) { + fprintf(stderr, + "XvMCWrapper: Zero length XvMC library name.\n"); + return; + } + } + handle = dlopen(nameBuffer, RTLD_LAZY); } if (!handle) { - fprintf(stderr,"XvMCWrapper: Could not load hardware specific XvMC " - "library \"%s\".\n",nameBuffer); - fprintf(stderr,"%s\n",dlerror()); - return; + fprintf(stderr, "XvMCWrapper: Could not load hardware specific XvMC " + "library \"%s\".\n", nameBuffer); + fprintf(stderr, "%s\n", dlerror()); + return; } XW_RSYM(xW, handle, handle2, XvMCListSurfaceTypes,); @@ -396,386 +419,400 @@ static void initW(Display *dpy, XvPortID port) xW.vldextension = 1; } - -Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase) +Bool +XvMCQueryExtension(Display *display, int *eventBase, int *errBase) { - if (!wrapperPreInit) preInitW( display ); - if (!xW.preInitialised) return 0; - return (*xW.XvMCQueryExtension)(display, eventBase, errBase); + if (!wrapperPreInit) + preInitW(display); + if (!xW.preInitialised) + return 0; + return (*xW.XvMCQueryExtension) (display, eventBase, errBase); } -Status XvMCQueryVersion (Display *display, int *major_versionp, - int *minor_versionp) +Status +XvMCQueryVersion(Display *display, int *major_versionp, int *minor_versionp) { - if (!wrapperPreInit) preInitW( display ); - if (!xW.preInitialised) return 0; - return (*xW.XvMCQueryVersion)(display, major_versionp, minor_versionp); + if (!wrapperPreInit) + preInitW(display); + if (!xW.preInitialised) + return 0; + return (*xW.XvMCQueryVersion) (display, major_versionp, minor_versionp); } - -XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) +XvMCSurfaceInfo * +XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) { - if (!wrapperInit) initW( dpy, port); - if (!xW.initialised) return NULL; - return (*xW.XvMCListSurfaceTypes)(dpy, port, num); + if (!wrapperInit) + initW(dpy, port); + if (!xW.initialised) + return NULL; + return (*xW.XvMCListSurfaceTypes) (dpy, port, num); } -Status XvMCCreateContext ( - Display *display, - XvPortID port, - int surface_type_id, - int width, - int height, - int flags, - XvMCContext * context - ) -{ - if (!wrapperInit) initW(display, port); - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateContext)(display, port, surface_type_id, - width, height, flags, context); +Status +XvMCCreateContext(Display *display, + XvPortID port, + int surface_type_id, + int width, + int height, + int flags, + XvMCContext *context) +{ + if (!wrapperInit) + initW(display, port); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCCreateContext) (display, port, surface_type_id, + width, height, flags, context); } -Status XvMCDestroyContext (Display *display, XvMCContext * context) +Status +XvMCDestroyContext(Display *display, XvMCContext *context) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroyContext)(display, context); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCDestroyContext) (display, context); } Status -XvMCCreateSurface( - Display *display, - XvMCContext * context, - XvMCSurface * surface - ) +XvMCCreateSurface(Display *display, + XvMCContext *context, + XvMCSurface *surface) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateSurface)(display, context, surface); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCCreateSurface) (display, context, surface); } -Status XvMCDestroySurface(Display *display, XvMCSurface *surface) +Status +XvMCDestroySurface(Display *display, XvMCSurface *surface) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroySurface)(display, surface); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCDestroySurface) (display, surface); } - -XvImageFormatValues * XvMCListSubpictureTypes ( - Display * display, - XvPortID port, - int surface_type_id, - int *count_return - ) +XvImageFormatValues * +XvMCListSubpictureTypes(Display *display, + XvPortID port, + int surface_type_id, + int *count_return) { - if (!xW.initialised) return NULL; - return (*xW.XvMCListSubpictureTypes)(display, port, surface_type_id, - count_return); + if (!xW.initialised) + return NULL; + return (*xW.XvMCListSubpictureTypes) (display, port, surface_type_id, + count_return); } - Status -XvMCPutSurface( - Display *display, - XvMCSurface *surface, - Drawable draw, - short srcx, - short srcy, - unsigned short srcw, - unsigned short srch, - short destx, - short desty, - unsigned short destw, - unsigned short desth, - int flags - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCPutSurface)(display, surface, draw, srcx, srcy, srcw, srch, - destx, desty, destw, desth, flags); +XvMCPutSurface(Display *display, + XvMCSurface * surface, + Drawable draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + int flags) +{ + if (!xW.initialised) + return BadValue; + return (*xW.XvMCPutSurface) (display, surface, draw, srcx, srcy, srcw, srch, + destx, desty, destw, desth, flags); } -Status XvMCHideSurface(Display *display, XvMCSurface *surface) +Status +XvMCHideSurface(Display *display, XvMCSurface *surface) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCHideSurface)(display, surface); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCHideSurface) (display, surface); } - Status -XvMCCreateSubpicture ( - Display *display, - XvMCContext *context, - XvMCSubpicture *subpicture, - unsigned short width, - unsigned short height, - int xvimage_id - ) +XvMCCreateSubpicture(Display *display, + XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, + unsigned short height, + int xvimage_id) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateSubpicture)(display, context, subpicture, width, height, - xvimage_id); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCCreateSubpicture) (display, context, subpicture, width, + height, xvimage_id); } - Status -XvMCClearSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - short x, - short y, - unsigned short width, - unsigned short height, - unsigned int color - ) +XvMCClearSubpicture(Display *display, + XvMCSubpicture *subpicture, + short x, + short y, + unsigned short width, + unsigned short height, + unsigned int color) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCClearSubpicture)(display, subpicture, x, y, width, height, color); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCClearSubpicture) (display, subpicture, x, y, width, height, + color); } - Status -XvMCCompositeSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - XvImage *image, - short srcx, - short srcy, - unsigned short width, - unsigned short height, - short dstx, - short dsty - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCCompositeSubpicture)(display, subpicture, image, srcx, srcy, - width, height, dstx, dsty); +XvMCCompositeSubpicture(Display *display, + XvMCSubpicture *subpicture, + XvImage *image, + short srcx, + short srcy, + unsigned short width, + unsigned short height, + short dstx, + short dsty) +{ + if (!xW.initialised) + return BadValue; + return (*xW.XvMCCompositeSubpicture) (display, subpicture, image, srcx, + srcy, width, height, dstx, dsty); } Status -XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture) +XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroySubpicture)(display, subpicture); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCDestroySubpicture) (display, subpicture); } Status -XvMCSetSubpicturePalette ( - Display *display, - XvMCSubpicture *subpicture, - unsigned char *palette - ) +XvMCSetSubpicturePalette(Display *display, + XvMCSubpicture *subpicture, + unsigned char *palette) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCSetSubpicturePalette)(display, subpicture, palette); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCSetSubpicturePalette) (display, subpicture, palette); } - Status -XvMCBlendSubpicture ( - Display *display, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCBlendSubpicture)(display, target_surface, subpicture, - subx, suby, subw, subh, surfx, surfy, - surfw, surfh); +XvMCBlendSubpicture(Display *display, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh) +{ + if (!xW.initialised) + return BadValue; + return (*xW.XvMCBlendSubpicture) (display, target_surface, subpicture, + subx, suby, subw, subh, surfx, surfy, + surfw, surfh); } Status -XvMCBlendSubpicture2 ( - Display *display, - XvMCSurface *source_surface, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCBlendSubpicture2)(display, source_surface, target_surface, subpicture, - subx, suby, subw, subh, surfx, surfy, surfw, surfh); +XvMCBlendSubpicture2(Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh) +{ + if (!xW.initialised) + return BadValue; + return (*xW.XvMCBlendSubpicture2) (display, source_surface, target_surface, + subpicture, subx, suby, subw, subh, + surfx, surfy, surfw, surfh); } - -Status XvMCSyncSurface (Display *display, XvMCSurface *surface) +Status +XvMCSyncSurface(Display *display, XvMCSurface *surface) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCSyncSurface)(display, surface); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCSyncSurface) (display, surface); } -Status XvMCFlushSurface (Display *display, XvMCSurface *surface) +Status +XvMCFlushSurface(Display *display, XvMCSurface *surface) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCFlushSurface)(display, surface); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCFlushSurface) (display, surface); } -Status XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat) +Status +XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *stat) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCGetSurfaceStatus)(display, surface, stat); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCGetSurfaceStatus) (display, surface, stat); } -Status XvMCRenderSurface ( - Display *display, - XvMCContext *context, - unsigned int picture_structure, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - unsigned int flags, - unsigned int num_macroblocks, - unsigned int first_macroblock, - XvMCMacroBlockArray *macroblock_array, - XvMCBlockArray *blocks - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCRenderSurface)(display, context, picture_structure, target_surface, - past_surface, future_surface, flags, num_macroblocks, - first_macroblock, macroblock_array, blocks); +Status +XvMCRenderSurface(Display *display, + XvMCContext *context, + unsigned int picture_structure, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks) +{ + if (!xW.initialised) + return BadValue; + return (*xW.XvMCRenderSurface) (display, context, picture_structure, + target_surface, past_surface, + future_surface, flags, num_macroblocks, + first_macroblock, macroblock_array, blocks); } -Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) +Status +XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCSyncSubpicture)(display, subpicture); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCSyncSubpicture) (display, subpicture); } -Status XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture) +Status +XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCFlushSubpicture)(display, subpicture); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCFlushSubpicture) (display, subpicture); } + Status -XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat) +XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpic, int *stat) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCGetSubpictureStatus)(display, subpic, stat); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCGetSubpictureStatus) (display, subpic, stat); } -Status XvMCCreateBlocks ( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCBlockArray *block - ) +Status +XvMCCreateBlocks(Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCBlockArray *block) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateBlocks)(display, context, num_blocks, block); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCCreateBlocks) (display, context, num_blocks, block); } - -Status XvMCDestroyBlocks (Display *display,XvMCBlockArray *block) +Status +XvMCDestroyBlocks(Display *display, XvMCBlockArray *block) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroyBlocks)(display, block); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCDestroyBlocks) (display, block); } -Status XvMCCreateMacroBlocks ( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCMacroBlockArray *blocks - ) +Status +XvMCCreateMacroBlocks(Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCMacroBlockArray *blocks) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateMacroBlocks)(display, context, num_blocks, blocks); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCCreateMacroBlocks) (display, context, num_blocks, blocks); } - -Status XvMCDestroyMacroBlocks ( - Display *display, - XvMCMacroBlockArray *block - ) +Status +XvMCDestroyMacroBlocks(Display *display, + XvMCMacroBlockArray *block) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroyMacroBlocks)(display, block); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCDestroyMacroBlocks) (display, block); } - XvAttribute * -XvMCQueryAttributes ( - Display *display, - XvMCContext *context, - int *number - ) +XvMCQueryAttributes(Display *display, + XvMCContext *context, + int *number) { - if (!xW.initialised) return NULL; - return (*xW.XvMCQueryAttributes)(display, context, number); + if (!xW.initialised) + return NULL; + return (*xW.XvMCQueryAttributes) (display, context, number); } - Status -XvMCSetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int value - ) +XvMCSetAttribute(Display *display, + XvMCContext *context, + Atom attribute, + int value) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCSetAttribute)(display, context, attribute, value); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCSetAttribute) (display, context, attribute, value); } - Status -XvMCGetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int *value - ) +XvMCGetAttribute(Display *display, + XvMCContext *context, + Atom attribute, + int *value) { - if (!xW.initialised) return BadValue; - return (*xW.XvMCGetAttribute)(display, context, attribute, value); + if (!xW.initialised) + return BadValue; + return (*xW.XvMCGetAttribute) (display, context, attribute, value); } - -Status XvMCBeginSurface(Display *display, - XvMCContext *context, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - const XvMCMpegControl *control) +Status +XvMCBeginSurface(Display *display, + XvMCContext *context, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + const XvMCMpegControl *control) { - if (!xW.vldextension) return BadValue; - return (*xW.XvMCBeginSurface)(display, context, target_surface, past_surface, future_surface, - control); + if (!xW.vldextension) + return BadValue; + return (*xW.XvMCBeginSurface) (display, context, target_surface, + past_surface, future_surface, control); } -Status XvMCLoadQMatrix(Display *display, XvMCContext *context, - const XvMCQMatrix *qmx) +Status +XvMCLoadQMatrix(Display *display, XvMCContext *context, + const XvMCQMatrix *qmx) { - if (!xW.vldextension) return BadValue; - return (*xW.XvMCLoadQMatrix)(display, context, qmx); + if (!xW.vldextension) + return BadValue; + return (*xW.XvMCLoadQMatrix) (display, context, qmx); } -Status XvMCPutSlice(Display *display,XvMCContext *context, - char *slice, int nBytes) +Status +XvMCPutSlice(Display *display, XvMCContext *context, char *slice, int nBytes) { - if (!xW.vldextension) return BadValue; - return (*xW.XvMCPutSlice)(display, context, slice, nBytes); + if (!xW.vldextension) + return BadValue; + return (*xW.XvMCPutSlice) (display, context, slice, nBytes); } -Status XvMCPutSlice2(Display *display,XvMCContext *context, - char *slice, int nBytes, int sliceCode) +Status +XvMCPutSlice2(Display *display, XvMCContext *context, + char *slice, int nBytes, int sliceCode) { - if (!xW.vldextension) return BadValue; - return (*xW.XvMCPutSlice2)(display, context, slice, nBytes, sliceCode); + if (!xW.vldextension) + return BadValue; + return (*xW.XvMCPutSlice2) (display, context, slice, nBytes, sliceCode); } |