xenocara/lib/libXvMC/wrapper/XvMCWrapper.c

821 lines
27 KiB
C
Raw Normal View History

/*****************************************************************************
* XvMC Wrapper including the Nonstandard VLD extension.
*
* Copyright (c) 2004 The Unichrome project. All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Thomas Hellström (2004)
*/
/*
2024-04-29 00:35:41 +00:00
* 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
* surface -> port
* subpicture -> port
*
* and reference the right table when needed.
2024-04-29 00:35:41 +00:00
* 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
2024-04-29 00:35:41 +00:00
#include "config.h"
#endif
#include <X11/Xlib.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/XvMClib.h>
#include "X11/extensions/vldXvMC.h"
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
typedef Bool (*XvMCQueryExtensionP) (Display *, int *, int *);
2024-04-29 00:35:41 +00:00
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 *);
2024-04-29 00:35:41 +00:00
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 *);
2024-04-29 00:35:41 +00:00
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 *);
2024-04-29 00:35:41 +00:00
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:
*/
2024-04-29 00:35:41 +00:00
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, int);
typedef Status (*XvMCGetDRInfoP) (Display *, XvPortID, char **, char **, int *,
int *, int *, int *);
typedef struct {
2024-04-29 00:35:41 +00:00
XvMCQueryExtensionP XvMCQueryExtension;
XvMCQueryVersionP XvMCQueryVersion;
XvMCListSurfaceTypesP XvMCListSurfaceTypes;
XvMCCreateContextP XvMCCreateContext;
XvMCDestroyContextP XvMCDestroyContext;
XvMCCreateSurfaceP XvMCCreateSurface;
XvMCDestroySurfaceP XvMCDestroySurface;
XvMCListSubpictureTypesP XvMCListSubpictureTypes;
2024-04-29 00:35:41 +00:00
XvMCPutSurfaceP XvMCPutSurface;
XvMCHideSurfaceP XvMCHideSurface;
XvMCCreateSubpictureP XvMCCreateSubpicture;
XvMCClearSubpictureP XvMCClearSubpicture;
XvMCCompositeSubpictureP XvMCCompositeSubpicture;
2024-04-29 00:35:41 +00:00
XvMCDestroySubpictureP XvMCDestroySubpicture;
XvMCSetSubpicturePaletteP XvMCSetSubpicturePalette;
XvMCBlendSubpictureP XvMCBlendSubpicture;
XvMCBlendSubpicture2P XvMCBlendSubpicture2;
XvMCSyncSurfaceP XvMCSyncSurface;
XvMCFlushSurfaceP XvMCFlushSurface;
XvMCGetSurfaceStatusP XvMCGetSurfaceStatus;
XvMCRenderSurfaceP XvMCRenderSurface;
XvMCSyncSubpictureP XvMCSyncSubpicture;
XvMCFlushSubpictureP XvMCFlushSubpicture;
XvMCGetSubpictureStatusP XvMCGetSubpictureStatus;
2024-04-29 00:35:41 +00:00
XvMCCreateBlocksP XvMCCreateBlocks;
XvMCDestroyBlocksP XvMCDestroyBlocks;
XvMCCreateMacroBlocksP XvMCCreateMacroBlocks;
XvMCDestroyMacroBlocksP XvMCDestroyMacroBlocks;
XvMCQueryAttributesP XvMCQueryAttributes;
XvMCSetAttributeP XvMCSetAttribute;
XvMCGetAttributeP XvMCGetAttribute;
/*
* Nonstandard VLD acceleration level:
*/
2024-04-29 00:35:41 +00:00
XvMCBeginSurfaceP XvMCBeginSurface;
XvMCLoadQMatrixP XvMCLoadQMatrix;
XvMCPutSliceP XvMCPutSlice;
XvMCPutSlice2P XvMCPutSlice2;
/*
* Driver name function.
*/
2024-04-29 00:35:41 +00:00
XvMCGetDRInfoP XvMCGetDRInfo;
int preInitialised;
int initialised;
int vldextension;
} XvMCWrapper;
static XvMCWrapper xW;
static int wrapperInit = 0;
static int wrapperPreInit = 0;
static void *xvhandle;
static void *handle2;
#define BUFLEN 200
#define STRS(ARG) STR(ARG)
#define STR(ARG) #ARG
#define XW_RSYM(base,handle,handle2,pointer, retval) \
do { \
register char *symerr; \
base.pointer = (pointer##P) dlsym((handle),#pointer); \
if ((symerr = dlerror()) != NULL) { \
if (!handle2) { \
fprintf(stderr,"%s\n",symerr); return retval; \
} \
base.pointer = (pointer##P) dlsym((handle2),#pointer); \
if ((symerr = dlerror()) != NULL) { \
fprintf(stderr,"%s\n",symerr); return retval; \
} \
} \
} while (0);
#define XW_RSYM2(base,handle,handle2,pointer) \
base.pointer = (pointer##P) dlsym((handle),#pointer); \
if (dlerror() != NULL) { \
base.pointer = (pointer##P) dlsym((handle2),#pointer); \
if (dlerror() != NULL) return; \
}
/*
* Try to dlopen a shared library, versionless first.
*/
2024-04-29 00:35:41 +00:00
static void *
dlopenversion(const char *lib, const char *version, int flag)
{
void *ret;
size_t curLen, verLen;
char *curName;
curLen = strlen(lib) + (verLen = strlen(version)) + 1;
curName = (char *) malloc(curLen * sizeof(char));
strncpy(curName, lib, curLen);
if (verLen > 1) {
const char *tail = strstr(version + 1, ".");
if (NULL != tail) {
strncat(curName, version, (size_t) (tail - version));
}
else {
strncat(curName, version, verLen);
}
}
2024-04-29 00:35:41 +00:00
ret = dlopen(curName, flag);
free(curName);
return ret;
}
2024-04-29 00:35:41 +00:00
static int
preInitW(Display *dpy)
{
/*
* Resolve functions that are not hw driver specific.
*/
void *handleZ = NULL;
wrapperPreInit = 1;
xW.preInitialised = 0;
xW.initialised = 0;
xvhandle = dlopenversion("libXv.so", XV_SOVERSION, RTLD_LAZY | RTLD_GLOBAL);
if (!xvhandle) {
2024-04-29 00:35:41 +00:00
fprintf(stderr, "XvMCWrapper: Warning! Could not open shared "
"library \"libXv.so" XV_SOVERSION
"\"\nThis may cause relocation "
"errors later.\nError was: \"%s\".\n", dlerror());
}
2024-04-29 00:35:41 +00:00
handle2 =
dlopenversion("libXvMC.so", XVMC_SOVERSION, RTLD_LAZY | RTLD_GLOBAL);
if (!handle2) {
2024-04-29 00:35:41 +00:00
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);
xW.preInitialised = 1;
return 0;
}
2024-04-29 00:35:41 +00:00
static void
initW(Display *dpy, XvPortID port)
{
char nameBuffer[BUFLEN];
void *handle;
char *clientName = NULL;
char *err;
2024-04-29 00:35:41 +00:00
size_t nameLen = 0;
wrapperInit = 1;
xW.initialised = 0;
if (!wrapperPreInit)
2024-04-29 00:35:41 +00:00
if (preInitW(dpy))
return;
/*
* Will the DDX tell us the client driver name?
*/
xW.XvMCGetDRInfo = (XvMCGetDRInfoP)
2024-04-29 00:35:41 +00:00
dlsym(handle2, "XvMCGetDRInfo");
if ((err = dlerror()) == NULL) {
2024-04-29 00:35:41 +00:00
int major, minor, patchLevel, isLocal;
char *busID = 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;
}
}
2024-04-29 00:35:41 +00:00
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.
*/
size_t tmp;
FILE *configFile;
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) {
2024-04-29 00:35:41 +00:00
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,);
XW_RSYM(xW, handle, handle2, XvMCCreateContext,);
XW_RSYM(xW, handle, handle2, XvMCDestroyContext,);
XW_RSYM(xW, handle, handle2, XvMCCreateSurface,);
XW_RSYM(xW, handle, handle2, XvMCDestroySurface,);
XW_RSYM(xW, handle, handle2, XvMCListSubpictureTypes,);
XW_RSYM(xW, handle, handle2, XvMCHideSurface,);
XW_RSYM(xW, handle, handle2, XvMCCreateSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCClearSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCCompositeSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCDestroySubpicture,);
XW_RSYM(xW, handle, handle2, XvMCSetSubpicturePalette,);
XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture2,);
XW_RSYM(xW, handle, handle2, XvMCPutSurface,);
XW_RSYM(xW, handle, handle2, XvMCSyncSurface,);
XW_RSYM(xW, handle, handle2, XvMCFlushSurface,);
XW_RSYM(xW, handle, handle2, XvMCGetSurfaceStatus,);
XW_RSYM(xW, handle, handle2, XvMCRenderSurface,);
XW_RSYM(xW, handle, handle2, XvMCSyncSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCFlushSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCGetSubpictureStatus,);
XW_RSYM(xW, handle, handle2, XvMCCreateBlocks,);
XW_RSYM(xW, handle, handle2, XvMCDestroyBlocks,);
XW_RSYM(xW, handle, handle2, XvMCCreateMacroBlocks,);
XW_RSYM(xW, handle, handle2, XvMCDestroyMacroBlocks,);
XW_RSYM(xW, handle, handle2, XvMCQueryAttributes,);
XW_RSYM(xW, handle, handle2, XvMCSetAttribute,);
XW_RSYM(xW, handle, handle2, XvMCGetAttribute,);
xW.initialised = 1;
XW_RSYM2(xW, handle, handle2, XvMCBeginSurface);
XW_RSYM(xW, handle, handle2, XvMCLoadQMatrix,);
XW_RSYM(xW, handle, handle2, XvMCPutSlice,);
XW_RSYM(xW, handle, handle2, XvMCPutSlice2,);
xW.vldextension = 1;
}
2024-04-29 00:35:41 +00:00
Bool
XvMCQueryExtension(Display *display, int *eventBase, int *errBase)
{
2024-04-29 00:35:41 +00:00
if (!wrapperPreInit)
preInitW(display);
if (!xW.preInitialised)
return 0;
return (*xW.XvMCQueryExtension) (display, eventBase, errBase);
}
2024-04-29 00:35:41 +00:00
Status
XvMCQueryVersion(Display *display, int *major_versionp, int *minor_versionp)
{
2024-04-29 00:35:41 +00:00
if (!wrapperPreInit)
preInitW(display);
if (!xW.preInitialised)
return 0;
return (*xW.XvMCQueryVersion) (display, major_versionp, minor_versionp);
}
2024-04-29 00:35:41 +00:00
XvMCSurfaceInfo *
XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num)
{
2024-04-29 00:35:41 +00:00
if (!wrapperInit)
initW(dpy, port);
if (!xW.initialised)
return NULL;
return (*xW.XvMCListSurfaceTypes) (dpy, port, num);
}
2024-04-29 00:35:41 +00:00
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);
}
2024-04-29 00:35:41 +00:00
Status
XvMCDestroyContext(Display *display, XvMCContext *context)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroyContext) (display, context);
}
Status
2024-04-29 00:35:41 +00:00
XvMCCreateSurface(Display *display,
XvMCContext *context,
XvMCSurface *surface)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateSurface) (display, context, surface);
}
2024-04-29 00:35:41 +00:00
Status
XvMCDestroySurface(Display *display, XvMCSurface *surface)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroySurface) (display, surface);
}
2024-04-29 00:35:41 +00:00
XvImageFormatValues *
XvMCListSubpictureTypes(Display *display,
XvPortID port,
int surface_type_id,
int *count_return)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return NULL;
return (*xW.XvMCListSubpictureTypes) (display, port, surface_type_id,
count_return);
}
Status
2024-04-29 00:35:41 +00:00
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);
}
2024-04-29 00:35:41 +00:00
Status
XvMCHideSurface(Display *display, XvMCSurface *surface)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCHideSurface) (display, surface);
}
Status
2024-04-29 00:35:41 +00:00
XvMCCreateSubpicture(Display *display,
XvMCContext *context,
XvMCSubpicture *subpicture,
unsigned short width,
unsigned short height,
int xvimage_id)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateSubpicture) (display, context, subpicture, width,
height, xvimage_id);
}
Status
2024-04-29 00:35:41 +00:00
XvMCClearSubpicture(Display *display,
XvMCSubpicture *subpicture,
short x,
short y,
unsigned short width,
unsigned short height,
unsigned int color)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCClearSubpicture) (display, subpicture, x, y, width, height,
color);
}
Status
2024-04-29 00:35:41 +00:00
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
2024-04-29 00:35:41 +00:00
XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroySubpicture) (display, subpicture);
}
Status
2024-04-29 00:35:41 +00:00
XvMCSetSubpicturePalette(Display *display,
XvMCSubpicture *subpicture,
unsigned char *palette)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSetSubpicturePalette) (display, subpicture, palette);
}
Status
2024-04-29 00:35:41 +00:00
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
2024-04-29 00:35:41 +00:00
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);
}
2024-04-29 00:35:41 +00:00
Status
XvMCSyncSurface(Display *display, XvMCSurface *surface)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSyncSurface) (display, surface);
}
2024-04-29 00:35:41 +00:00
Status
XvMCFlushSurface(Display *display, XvMCSurface *surface)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCFlushSurface) (display, surface);
}
2024-04-29 00:35:41 +00:00
Status
XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *stat)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCGetSurfaceStatus) (display, surface, stat);
}
2024-04-29 00:35:41 +00:00
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);
}
2024-04-29 00:35:41 +00:00
Status
XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSyncSubpicture) (display, subpicture);
}
2024-04-29 00:35:41 +00:00
Status
XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCFlushSubpicture) (display, subpicture);
}
2024-04-29 00:35:41 +00:00
Status
2024-04-29 00:35:41 +00:00
XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpic, int *stat)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCGetSubpictureStatus) (display, subpic, stat);
}
2024-04-29 00:35:41 +00:00
Status
XvMCCreateBlocks(Display *display,
XvMCContext *context,
unsigned int num_blocks,
XvMCBlockArray *block)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateBlocks) (display, context, num_blocks, block);
}
2024-04-29 00:35:41 +00:00
Status
XvMCDestroyBlocks(Display *display, XvMCBlockArray *block)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroyBlocks) (display, block);
}
2024-04-29 00:35:41 +00:00
Status
XvMCCreateMacroBlocks(Display *display,
XvMCContext *context,
unsigned int num_blocks,
XvMCMacroBlockArray *blocks)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateMacroBlocks) (display, context, num_blocks, blocks);
}
2024-04-29 00:35:41 +00:00
Status
XvMCDestroyMacroBlocks(Display *display,
XvMCMacroBlockArray *block)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroyMacroBlocks) (display, block);
}
XvAttribute *
2024-04-29 00:35:41 +00:00
XvMCQueryAttributes(Display *display,
XvMCContext *context,
int *number)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return NULL;
return (*xW.XvMCQueryAttributes) (display, context, number);
}
Status
2024-04-29 00:35:41 +00:00
XvMCSetAttribute(Display *display,
XvMCContext *context,
Atom attribute,
int value)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSetAttribute) (display, context, attribute, value);
}
Status
2024-04-29 00:35:41 +00:00
XvMCGetAttribute(Display *display,
XvMCContext *context,
Atom attribute,
int *value)
{
2024-04-29 00:35:41 +00:00
if (!xW.initialised)
return BadValue;
return (*xW.XvMCGetAttribute) (display, context, attribute, value);
}
2024-04-29 00:35:41 +00:00
Status
XvMCBeginSurface(Display *display,
XvMCContext *context,
XvMCSurface *target_surface,
XvMCSurface *past_surface,
XvMCSurface *future_surface,
const XvMCMpegControl *control)
{
2024-04-29 00:35:41 +00:00
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCBeginSurface) (display, context, target_surface,
past_surface, future_surface, control);
}
2024-04-29 00:35:41 +00:00
Status
XvMCLoadQMatrix(Display *display, XvMCContext *context,
const XvMCQMatrix *qmx)
{
2024-04-29 00:35:41 +00:00
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCLoadQMatrix) (display, context, qmx);
}
2024-04-29 00:35:41 +00:00
Status
XvMCPutSlice(Display *display, XvMCContext *context, char *slice, int nBytes)
{
2024-04-29 00:35:41 +00:00
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCPutSlice) (display, context, slice, nBytes);
}
2024-04-29 00:35:41 +00:00
Status
XvMCPutSlice2(Display *display, XvMCContext *context,
char *slice, int nBytes, int sliceCode)
{
2024-04-29 00:35:41 +00:00
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCPutSlice2) (display, context, slice, nBytes, sliceCode);
}