head 1.4; access; symbols trunk-20040613:1.4 mach64-last-merge:1.4 driinterface-0-0-3-20040303-merge:1.4 driinterface-0-0-3-20040303-premerge:1.4 driinterface-0-0-3-20040303:1.4 driinterface-0-0-3-branch:1.4.0.14 mach64-0-0-7-branch:1.4.0.12 driinterface-0-0-2-branch:1.4.0.10 newmesa-0-0-1-20031209-merge:1.4 trunk-20031209:1.4 newmesa-0-0-1-20031209:1.4 newmesa-0-0-1-branch:1.4.0.8 driinterface-0-0-1-branch:1.4.0.6 savage-2-0-0-branch:1.4.0.4 savage-2-0-0-fork:1.4 config-0-0-1-20031005-freeze:1.3 savage-1_0_0-20031002-trunk-premerge:1.3 cle266-0-0-1-branch:1.4.0.2 i865-agp-0-1-20030929:1.3 trunk-20030916:1.4 XFree86-4_3_99_12-merge:1.4 trunk-20030912:1.3 i865-agp-0-1-20030905:1.3 i865-agp-0-1-20030728:1.3 i865-agp-0-1-20030707:1.3 savage-1_0_0-branch:1.3.0.24 newdrm-0-0-1-branch:1.3.0.22 i865-agp-0-1-branch:1.3.0.20 config-0-0-1-branch:1.3.0.18 texmem-0-0-1-20030429-merge:1.3 texmem-0-0-1-20030429-premerge:1.3 texmem-0-0-1-20030407:1.3.4.1 trident-0-0-2-branch:1.3.0.16 mach64-0-0-6-20030330:1.3 mach64-0-0-6-20030329-freeze:1.3 texmem-0-0-1-20030328-freeze:1.3.4.1 X_4_3_0-20030324-merge:1.1.1.9 X_4_3_0-20020324-preimport:1.3 drm-filp-0-1-branch:1.3.0.14 mesa-4-0-4-20030222:1.3 bsd-4-0-0-20030221-merge:1.3 bsd-4-0-0-20030220:1.3 bsd-4-0-0-20030220-freeze:1.3 mesa-4-0-4-20030216:1.3 mach64-0-0-6-branch:1.3.0.12 mesa-4-0-4-20030208:1.3 texmem-0-0-1-20030204-trunk-merge:1.3.4.1 texmem-0-0-1-20030204-trunk-premerge:1.3.4.1 mesa-4-0-4-20030203:1.3 mesa-4-0-4-20030129:1.3 texmem-0-0-1-20030125-trunk-merge:1.3.4.1 texmem-0-0-1-20030123-trunk-premerge:1.3.4.1 mesa-4-0-4-20030114:1.3 agpgart_2_0_branch:1.3.0.10 mesa-4-0-4-20021220:1.3 mesa-4-0-4-20021216:1.3 mesa-4-0-4-20021215:1.3 mesa-4-0-4-20021214:1.3 mesa-4-0-4-branch:1.3.0.8 texmem-0-0-1-20021127-mesa-4-1-merge:1.3.4.1 trunk-20021125:1.3 mesa-4-1-branch:1.3.0.6 texmem-0-0-1:1.3.0.4 bsd-4-0-0-branch:1.3.0.2 X_4_1_99_1-20010822-merge:1.1.1.8 X_4_1_99_1:1.1.1.8 X_4_1_99_1-20010822-preimport:1.1.1.8 multihead-1-0-0-20010730:1.1.1.7.34.1 multihead-1-0-0-20010730-merge:1.1.1.8 multihead-1-0-0-20010727-freeze:1.1.1.7 X_4_1_0-20010615-merge:1.1.1.8 mesa-3-5-20010621-freeze:1.1.1.7 X_4_1_0:1.1.1.8 X_4_1_0-20010614-preimport:1.1.1.7 multihead-1-0-0-branch:1.1.1.7.0.34 X_4_0_99_3-20010502-merge:1.1.1.7 X_4_0_99_3:1.1.1.7 X_4_0_99_3-20010501-preimport:1.1.1.7 bsd-2-0-0-branch:1.1.1.7.0.32 X_4_0_99_2-20010410-merge:1.1.1.7 X_4_0_99_2:1.1.1.7 X_4_0_99_2-20010409-preimport:1.1.1.7 ati-pcigart-1-0-0-20010405-merge:1.1.1.7 ati-pcigart-1-0-0-20010405:1.1.1.7 ati-pcigart-1-0-0-20010405-freeze:1.1.1.7 ati-pcigart-1-0-0-branch:1.1.1.7.0.30 mesa-3-5-20010323-freeze:1.1.1.7 X_4_0_99_1-20010321-merge:1.1.1.7 X_4_0_99_1:1.1.1.7 X_4_0_99_1-20010319-preimport:1.1.1.7 full-1-0-0-20010315-head:1.1.1.7 sarea-1-0-0-20010314-merge:1.1.1.7 sarea-1-0-0-20010314:1.1.1.7 full-1-0-0-branch:1.1.1.7 sarea-1-0-0-20010307:1.1.1.7 sarea-1-0-0-20010307-freeze:1.1.1.7 tdfx-3-1-0-20010306-merge:1.1.1.7 tdfx-3-1-0-20010306-freeze:1.1.1.7 tdfx-3-1-0-20010306:1.1.1.7 tdfx-3-1-0-20010305-merge:1.1.1.7 tdfx-3-1-0-20010305-freeze2:1.1.1.7 tdfx-3-1-0-20010305-freeze:1.1.1.7 tdfx-3-1-0-20010301-freeze:1.1.1.7 ati-pcigart-0-0-1-branch-02282001-freeze:1.1.1.7 ati-5-0-1-20010220-head:1.1.1.7 ati-5-0-1-branch:1.1.1.7.0.28 sarea-1-0-0-branch:1.1.1.7.0.26 mga-1-0-0-20010215-merge:1.1.1.7 mga-1-0-0-20010215-freeze:1.1.1.7 tdfx-3-1-0-branch:1.1.1.7.0.24 tdfx-3-0-1-branch:1.1.1.7 ati-pcigart-0-0-1-branch:1.1.1.7.0.22 mesa-3-5-branch:1.1.1.7.0.20 tdfx-3-0-0-20010109-merge:1.1.1.7 tdfx-3-0-0-20010108:1.1.1.7 ati-5-0-0-20010105-merge:1.1.1.7 ati-5-0-0-20010105:1.1.1.7 ati-5-0-0-20000104-freeze:1.1.1.7 tdfx-3-0-0-20010104-freeze:1.1.1.7 ati-5-0-0-20001223-merge:1.1.1.7 ati-5-0-0-20001223-freeze:1.1.1.7 X_4_0_2-20001221-merge:1.1.1.7 X_4_0_2:1.1.1.7 mga-1-0-0-branch:1.1.1.7.0.18 X_4_0_1h-20001207-merge:1.1.1.7 X_4_0_1h-20001205-merge:1.1.1.7 X_4_0_1h:1.1.1.7 ati-4-1-1-20001202-merge-trunk:1.1.1.7 sse-1-0-1-branch:1.1.1.7.0.16 ati-4-1-1-20001202-merge:1.1.1.5 tdfx-3-0-0-20001201:1.1.1.7 ati-4-1-1-20001201-freeze:1.1.1.5 tdfx-3-0-0-20001201-freeze:1.1.1.7 X_4_0_1g-20001130-merge:1.1.1.7 X_4_0_1g:1.1.1.7 X_4_0_1f-20001130-merge:1.1.1.7 X_4_0_1f:1.1.1.7 ati-4-1-1-20001125-freeze:1.1.1.5 mach64-0-0-1-branch:1.1.1.7.0.14 ati-5-0-0-branch:1.1.1.7.0.12 X_4_0_1e-20001107-merge:1.1.1.7 X_4_0_1e:1.1.1.7 X_4_0_1d-20001107-merge:1.1.1.7 X_4_0_1d:1.1.1.7 ppc-1-0-1-branch:1.1.1.7.0.10 radeon-1-0-0-20001017:1.1.1.5 full-0-0-2-branch:1.1.1.7.0.8 full-0-0-1-branch:1.1.1.7.0.6 ati-4-1-1-20001009-freeze:1.1.1.5 mga-readpix-0-0-1-branch:1.1.1.7.0.4 tdfx-3-0-0-branch:1.1.1.7.0.2 X_4_0_1d-pre:1.1.1.7 ati-4-1-1-20000919-stable:1.1.1.5 radeon-1-0-0-branch:1.1.1.5.0.20 ppc-1-0-0-20000912:1.1.1.5 mga-lock-debug-0-2-0-branch:1.1.1.5.0.18 sse-1-0-0-branch:1.1.1.5.0.16 mga-lock-debug-0-0-1-branch:1.1.1.5.0.14 gamma-2-0-0-branch:1.1.1.5.0.12 tdfx-2-1-20000907-merge:1.1.1.5 tdfx-2-1-20000906:1.1.1.4.26.1 tdfx-2-1-20000905-freeze:1.1.1.4.26.1 ppc-1-0-0-2000-09-01-freeze:1.1.1.5 m3-0-0-1-branch:1.1.1.5.0.10 mach64-0-0-0-branch:1.1.1.5.0.8 ati-4-1-1-branch:1.1.1.5.0.6 X_4_0_1b-20000816-merge:1.1.1.5 X_4_0_1b:1.1.1.5 ati-4-0-2-branch:1.1.1.5.0.4 ppc-1-0-0-branch:1.1.1.5.0.2 tdfx-2-1-20000711:1.1.1.4.26.1 tdfx-2-1-20000711-freeze:1.1.1.4 X_4_0_1:1.1.1.5 tdfx-2-1-branch:1.1.1.4.0.26 pre401-20000613-freeze:1.1.1.4 bsd-1-0-1-20000613-merge:1.1.1.4 bsd-1-0-1-20000613:1.1.1.4 bsd-1-0-1-20000612-freeze:1.1.1.4 tdfx-2-0-20000612-merge:1.1.1.4 ati-4-1-0-20000613-merge:1.1.1.4 ati-4-1-0-20000613:1.1.1.4 tdfx-2-0-20000608-merge:1.1.1.4 tdfx-2-0-20000608-freeze:1.1.1.4 ati-4-1-0-branch:1.1.1.4.0.24 glxmisc-3-0-0-20000608-merge:1.1.1.4 glxmisc-3-0-0-20000607:1.1.1.4 glxmisc-3-0-0-20000606-freeze:1.1.1.4 bsd-1-0-1-branch:1.1.1.4.0.22 bsd-1-0-0-20000531-merge:1.1.1.4 bsd-1-0-0-20000530-merge:1.1.1.4 bsd-1-0-0-20000530-freeze:1.1.1.4 tdfx-2-0-20000222-merge:1.1.1.4 tdfx-2-0-20000222-freeze:1.1.1.4 ati-4-0-1-20000518-merge:1.1.1.4 ati-4-0-1-20000518:1.1.1.4 video-1-0-0-branch:1.1.1.4.0.20 gamma-1-0-0-branch:1.1.1.4.0.18 mgadh-0-0-3-branch:1.1.1.4.0.16 glxmisc-3-0-0-branch:1.1.1.4.0.14 glxmisc-2-0-0-20000503-merge:1.1.1.4 bsd-1-0-0-branch:1.1.1.4.0.12 glxmisc-2-0-0-20000503:1.1.1.4 glxmisc-2-0-0-branch:1.1.1.4.0.10 tdfx-2-0-branch:1.1.1.4.0.8 tdfx-2-0-trunk:1.1.1.4 glxmisc-1-0-0-20000420-merge:1.1.1.4 glxmisc-1-0-0-20000420:1.1.1.4 ati-4-0-1-beta:1.1.1.4 glxmisc-1-0-0-branch:1.1.1.4.0.6 mga-0-0-3-branch:1.1.1.4.0.4 mga-0-0-2-20000404-merge:1.1.1.4 ati-4-0-1-alpha:1.1.1.4 ati-4-0-1-20000319-base:1.1.1.4 ati-4-0-1-branch:1.1.1.4.0.2 ati-4-0-0-20000319:1.1.1.1 X_4_0-20000315-merge:1.1.1.4 X_4_0:1.1.1.4 freeze-20000226:1.1.1.3 dispatch-0-0-3-20000225-merge:1.1.1.3 dispatch-0-0-3-20000225:1.1.1.2 mga-0-0-1-20000225-merge:1.1.1.1 mga-0-0-2-branch:1.1.1.3.0.4 smt-0-0-2-branch:1.1.1.3.0.2 smt-0-0-1-20000222-freeze:1.1.1.2 X_3_9_18-20000222-merge:1.1.1.3 X_3_9_18:1.1.1.3 smt-0-0-1-stage2c:1.1.1.2 smt-0-0-1-stage2b:1.1.1.2.0.8 dispatch-0-0-3-branch:1.1.1.2.0.6 i810-20000214-beta2:1.1.1.1 dispatch-0-0-2-20000212:1.1.1.2 dispatch-0-0-2-branch:1.1.1.2.0.4 i810-20000201-beta1:1.1.1.1 dispatch-0-0-1-20000129-merge:1.1.1.2 dispatch-0-0-1-20000128:1.1.1.1 smt-0-0-1-20000112-base:1.1.1.2 smt-0-0-1-branch:1.1.1.2.0.2 dispatch-0-0-1-branch:1.1.1.1.0.10 tdfx-1-1:1.1.1.1.0.4 X_3_9_17:1.1.1.2 ati-4-0-0-branch:1.1.1.1.0.8 mga-0-0-1-branch:1.1.1.1.0.2 X_3_9_16:1.1.1.1 XFree:1.1.1; locks; strict; comment @ * @; 1.4 date 2003.09.12.18.38.12; author alanh; state Exp; branches; next 1.3; 1.3 date 2002.10.30.10.08.51; author alanh; state Exp; branches 1.3.4.1 1.3.6.1; next 1.2; 1.2 date 2001.08.23.21.35.17; author dawes; state dead; branches; next 1.1; 1.1 date 99.12.05.00.59.38; author daryll; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.12.05.00.59.38; author daryll; state Exp; branches 1.1.1.1.4.1; next 1.1.1.2; 1.1.1.2 date 2000.01.06.12.41.33; author faith; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2000.02.22.15.40.17; author kem; state Exp; branches 1.1.1.3.4.1; next 1.1.1.4; 1.1.1.4 date 2000.03.15.21.32.03; author jhartmann; state Exp; branches 1.1.1.4.26.1; next 1.1.1.5; 1.1.1.5 date 2000.07.10.21.00.51; author alanh; state Exp; branches; next 1.1.1.6; 1.1.1.6 date 2000.09.22.17.24.57; author alanh; state Exp; branches; next 1.1.1.7; 1.1.1.7 date 2000.09.23.20.56.44; author alanh; state Exp; branches 1.1.1.7.20.1 1.1.1.7.32.1 1.1.1.7.34.1; next 1.1.1.8; 1.1.1.8 date 2001.06.14.21.52.44; author dawes; state Exp; branches; next 1.1.1.9; 1.1.1.9 date 2003.03.25.00.09.31; author alanh; state Exp; branches; next ; 1.1.1.7.20.1 date 2001.06.26.02.07.57; author brianp; state Exp; branches; next ; 1.1.1.7.32.1 date 2001.06.24.22.19.38; author alanh; state Exp; branches; next 1.1.1.7.32.2; 1.1.1.7.32.2 date 2001.08.29.17.24.57; author alanh; state dead; branches; next ; 1.1.1.7.34.1 date 2001.07.30.14.29.32; author dawes; state Exp; branches; next ; 1.1.1.4.26.1 date 2000.07.11.19.36.24; author daryll; state Exp; branches; next ; 1.1.1.3.4.1 date 2000.03.22.00.10.50; author jhartmann; state Exp; branches; next ; 1.1.1.1.4.1 date 2000.01.21.02.02.16; author daryll; state Exp; branches; next ; 1.3.4.1 date 2002.11.11.23.32.02; author idr; state Exp; branches; next ; 1.3.6.1 date 2002.11.15.01.58.23; author brianp; state Exp; branches; next ; desc @@ 1.4 log @third round. @ text @/*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/lib/Xv/Xv.c,v 1.17 2003/04/28 16:56:27 dawes Exp $ */ /* ** File: ** ** Xv.c --- Xv library extension module. ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 26.06.91 Carver ** - changed XvFreeAdaptors to XvFreeAdaptorInfo ** - changed XvFreeEncodings to XvFreeEncodingInfo ** ** 11.06.91 Carver ** - changed SetPortControl to SetPortAttribute ** - changed GetPortControl to GetPortAttribute ** - changed QueryBestSize ** ** 15.05.91 Carver ** - version 2.0 upgrade ** ** 240.01.91 Carver ** - version 1.4 upgrade ** */ #include #include "Xvlibint.h" #include #include #include static XExtensionInfo _xv_info_data; static XExtensionInfo *xv_info = &_xv_info_data; static char *xv_extension_name = XvName; #define XvCheckExtension(dpy, i, val) \ XextCheckExtension(dpy, i, xv_extension_name, val) static char *xv_error_string(); static int xv_close_display(); static Bool xv_wire_to_event(); static XExtensionHooks xv_extension_hooks = { NULL, /* create_gc */ NULL, /* copy_gc */ NULL, /* flush_gc */ NULL, /* free_gc */ NULL, /* create_font */ NULL, /* free_font */ xv_close_display, /* close_display */ xv_wire_to_event, /* wire_to_event */ NULL, /* event_to_wire */ NULL, /* error */ xv_error_string /* error_string */ }; static char *xv_error_list[] = { "BadPort", /* XvBadPort */ "BadEncoding", /* XvBadEncoding */ "BadControl" /* XvBadControl */ }; static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, xv_extension_name, &xv_extension_hooks, XvNumEvents, NULL) static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, XvNumErrors, xv_error_list) int XvQueryExtension( Display *dpy, unsigned int *p_version, unsigned int *p_revision, unsigned int *p_requestBase, unsigned int *p_eventBase, unsigned int *p_errorBase ){ XExtDisplayInfo *info = xv_find_display(dpy); xvQueryExtensionReq *req; xvQueryExtensionReply rep; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(QueryExtension, req); if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return XvBadExtension; } *p_version = rep.version; *p_revision = rep.revision; *p_requestBase = info->codes->major_opcode; *p_eventBase = info->codes->first_event; *p_errorBase = info->codes->first_error; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvQueryAdaptors( Display *dpy, Window window, unsigned int *p_nAdaptors, XvAdaptorInfo **p_pAdaptors ){ XExtDisplayInfo *info = xv_find_display(dpy); xvQueryAdaptorsReq *req; xvQueryAdaptorsReply rep; int size,ii,jj; char *name; XvAdaptorInfo *pas, *pa; XvFormat *pfs, *pf; char *buffer; union { char *buffer; char *string; xvAdaptorInfo *pa; xvFormat *pf; } u; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(QueryAdaptors, req); req->window = window; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return(XvBadReply); } size = rep.length << 2; if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } _XRead (dpy, buffer, size); u.buffer = buffer; /* GET INPUT ADAPTORS */ if (rep.num_adaptors == 0) { pas = NULL; } else { size = rep.num_adaptors*sizeof(XvAdaptorInfo); if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } } /* INIT ADAPTOR FIELDS */ pa = pas; for (ii=0; iinum_adaptors = 0; pa->name = (char *)NULL; pa->formats = (XvFormat *)NULL; pa++; } pa = pas; for (ii=0; iitype = u.pa->type; pa->base_id = u.pa->base_id; pa->num_ports = u.pa->num_ports; pa->num_formats = u.pa->num_formats; pa->num_adaptors = rep.num_adaptors - ii; /* GET ADAPTOR NAME */ size = u.pa->name_size; u.buffer += (sz_xvAdaptorInfo + 3) & ~3; if ( (name = (char *)Xmalloc(size+1)) == NULL) { XvFreeAdaptorInfo(pas); Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } (void)strncpy(name, u.string, size); name[size] = '\0'; pa->name = name; u.buffer += (size + 3) & ~3; /* GET FORMATS */ size = pa->num_formats*sizeof(XvFormat); if ((pfs=(XvFormat *)Xmalloc(size))==NULL) { XvFreeAdaptorInfo(pas); Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } pf = pfs; for (jj=0; jjnum_formats; jj++) { pf->depth = u.pf->depth; pf->visual_id = u.pf->visual; pf++; u.buffer += (sz_xvFormat + 3) & ~3; } pa->formats = pfs; pa++; } *p_nAdaptors = rep.num_adaptors; *p_pAdaptors = pas; Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return (Success); } void XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors) { XvAdaptorInfo *pa; int ii; if (!pAdaptors) return; pa = pAdaptors; for (ii=0; iinum_adaptors; ii++, pa++) { if (pa->name) { Xfree(pa->name); } if (pa->formats) { Xfree(pa->formats); } } Xfree(pAdaptors); } int XvQueryEncodings( Display *dpy, XvPortID port, unsigned int *p_nEncodings, XvEncodingInfo **p_pEncodings ){ XExtDisplayInfo *info = xv_find_display(dpy); xvQueryEncodingsReq *req; xvQueryEncodingsReply rep; int size, jj; char *name; XvEncodingInfo *pes, *pe; char *buffer; union { char *buffer; char *string; xvEncodingInfo *pe; } u; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(QueryEncodings, req); req->port = port; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return(XvBadReply); } size = rep.length << 2; if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } _XRead (dpy, buffer, size); u.buffer = buffer; /* GET ENCODINGS */ size = rep.num_encodings*sizeof(XvEncodingInfo); if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } /* INITIALIZE THE ENCODING POINTER */ pe = pes; for (jj=0; jjname = (char *)NULL; pe->num_encodings = 0; pe++; } pe = pes; for (jj=0; jjencoding_id = u.pe->encoding; pe->width = u.pe->width; pe->height = u.pe->height; pe->rate.numerator = u.pe->rate.numerator; pe->rate.denominator = u.pe->rate.denominator; pe->num_encodings = rep.num_encodings - jj; size = u.pe->name_size; u.buffer += (sz_xvEncodingInfo + 3) & ~3; if ( (name = (char *)Xmalloc(size+1)) == NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } strncpy(name, u.string, size); name[size] = '\0'; pe->name = name; pe++; u.buffer += (size + 3) & ~3; } *p_nEncodings = rep.num_encodings; *p_pEncodings = pes; UnlockDisplay(dpy); SyncHandle(); return (Success); } void XvFreeEncodingInfo(XvEncodingInfo *pEncodings) { XvEncodingInfo *pe; int ii; if (!pEncodings) return; pe = pEncodings; for (ii=0; iinum_encodings; ii++, pe++) { if (pe->name) Xfree(pe->name); } Xfree(pEncodings); } int XvPutVideo( Display *dpy, XvPortID port, Drawable d, GC gc, int vx, int vy, unsigned int vw, unsigned int vh, int dx, int dy, unsigned int dw, unsigned int dh ){ XExtDisplayInfo *info = xv_find_display(dpy); xvPutVideoReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); FlushGC(dpy, gc); XvGetReq(PutVideo, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->vid_x = vx; req->vid_y = vy; req->vid_w = vw; req->vid_h = vh; req->drw_x = dx; req->drw_y = dy; req->drw_w = dw; req->drw_h = dh; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvPutStill( Display *dpy, XvPortID port, Drawable d, GC gc, int vx, int vy, unsigned int vw, unsigned int vh, int dx, int dy, unsigned int dw, unsigned int dh ){ XExtDisplayInfo *info = xv_find_display(dpy); xvPutStillReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); FlushGC(dpy, gc); XvGetReq(PutStill, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->vid_x = vx; req->vid_y = vy; req->vid_w = vw; req->vid_h = vh; req->drw_x = dx; req->drw_y = dy; req->drw_w = dw; req->drw_h = dh; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvGetVideo( Display *dpy, XvPortID port, Drawable d, GC gc, int vx, int vy, unsigned int vw, unsigned int vh, int dx, int dy, unsigned int dw, unsigned int dh ){ XExtDisplayInfo *info = xv_find_display(dpy); xvGetVideoReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); FlushGC(dpy, gc); XvGetReq(GetVideo, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->vid_x = vx; req->vid_y = vy; req->vid_w = vw; req->vid_h = vh; req->drw_x = dx; req->drw_y = dy; req->drw_w = dw; req->drw_h = dh; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvGetStill( Display *dpy, XvPortID port, Drawable d, GC gc, int vx, int vy, unsigned int vw, unsigned int vh, int dx, int dy, unsigned int dw, unsigned int dh ){ XExtDisplayInfo *info = xv_find_display(dpy); xvGetStillReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); FlushGC(dpy, gc); XvGetReq(GetStill, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->vid_x = vx; req->vid_y = vy; req->vid_w = vw; req->vid_h = vh; req->drw_x = dx; req->drw_y = dy; req->drw_w = dw; req->drw_h = dh; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvStopVideo( Display *dpy, XvPortID port, Drawable draw ){ XExtDisplayInfo *info = xv_find_display(dpy); xvStopVideoReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(StopVideo, req); req->port = port; req->drawable = draw; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvGrabPort( Display *dpy, XvPortID port, Time time ){ XExtDisplayInfo *info = xv_find_display(dpy); int result; xvGrabPortReply rep; xvGrabPortReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(GrabPort, req); req->port = port; req->time = time; if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) rep.result = GrabSuccess; result = rep.result; UnlockDisplay(dpy); SyncHandle(); return result; } int XvUngrabPort( Display *dpy, XvPortID port, Time time ){ XExtDisplayInfo *info = xv_find_display(dpy); xvUngrabPortReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(UngrabPort, req); req->port = port; req->time = time; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvSelectVideoNotify( Display *dpy, Drawable drawable, Bool onoff ){ XExtDisplayInfo *info = xv_find_display(dpy); xvSelectVideoNotifyReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(SelectVideoNotify, req); req->drawable = drawable; req->onoff = onoff; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvSelectPortNotify( Display *dpy, XvPortID port, Bool onoff ){ XExtDisplayInfo *info = xv_find_display(dpy); xvSelectPortNotifyReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(SelectPortNotify, req); req->port = port; req->onoff = onoff; UnlockDisplay(dpy); SyncHandle(); return Success; } int XvSetPortAttribute ( Display *dpy, XvPortID port, Atom attribute, int value ) { XExtDisplayInfo *info = xv_find_display(dpy); xvSetPortAttributeReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(SetPortAttribute, req); req->port = port; req->attribute = attribute; req->value = value; UnlockDisplay(dpy); SyncHandle(); return (Success); } int XvGetPortAttribute ( Display *dpy, XvPortID port, Atom attribute, int *p_value ) { XExtDisplayInfo *info = xv_find_display(dpy); xvGetPortAttributeReq *req; xvGetPortAttributeReply rep; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(GetPortAttribute, req); req->port = port; req->attribute = attribute; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return(XvBadReply); } *p_value = rep.value; UnlockDisplay(dpy); SyncHandle(); return (Success); } int XvQueryBestSize( Display *dpy, XvPortID port, Bool motion, unsigned int vid_w, unsigned int vid_h, unsigned int drw_w, unsigned int drw_h, unsigned int *p_actual_width, unsigned int *p_actual_height ) { XExtDisplayInfo *info = xv_find_display(dpy); xvQueryBestSizeReq *req; xvQueryBestSizeReply rep; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(QueryBestSize, req); req->port = port; req->motion = motion; req->vid_w = vid_w; req->vid_h = vid_h; req->drw_w = drw_w; req->drw_h = drw_h; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return(XvBadReply); } *p_actual_width = rep.actual_width; *p_actual_height = rep.actual_height; UnlockDisplay(dpy); SyncHandle(); return (Success); } XvAttribute* XvQueryPortAttributes(Display *dpy, XvPortID port, int *num) { XExtDisplayInfo *info = xv_find_display(dpy); xvQueryPortAttributesReq *req; xvQueryPortAttributesReply rep; XvAttribute *ret = NULL; *num = 0; XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); XvGetReq(QueryPortAttributes, req); req->port = port; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return ret; } if(rep.num_attributes) { int size = (rep.num_attributes * sizeof(XvAttribute)) + rep.text_size; if((ret = Xmalloc(size))) { char* marker = (char*)(&ret[rep.num_attributes]); xvAttributeInfo Info; int i; for(i = 0; i < rep.num_attributes; i++) { _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo); ret[i].flags = (int)Info.flags; ret[i].min_value = Info.min; ret[i].max_value = Info.max; ret[i].name = marker; _XRead(dpy, marker, Info.size); marker += Info.size; (*num)++; } } else _XEatData(dpy, rep.length << 2); } UnlockDisplay(dpy); SyncHandle(); return ret; } XvImageFormatValues * XvListImageFormats ( Display *dpy, XvPortID port, int *num ){ XExtDisplayInfo *info = xv_find_display(dpy); xvListImageFormatsReq *req; xvListImageFormatsReply rep; XvImageFormatValues *ret = NULL; *num = 0; XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); XvGetReq(ListImageFormats, req); req->port = port; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return NULL; } if(rep.num_formats) { int size = (rep.num_formats * sizeof(XvImageFormatValues)); if((ret = Xmalloc(size))) { xvImageFormatInfo Info; int i; for(i = 0; i < rep.num_formats; i++) { _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); ret[i].id = Info.id; ret[i].type = Info.type; ret[i].byte_order = Info.byte_order; memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); ret[i].bits_per_pixel = Info.bpp; ret[i].format = Info.format; ret[i].num_planes = Info.num_planes; ret[i].depth = Info.depth; ret[i].red_mask = Info.red_mask; ret[i].green_mask = Info.green_mask; ret[i].blue_mask = Info.blue_mask; ret[i].y_sample_bits = Info.y_sample_bits; ret[i].u_sample_bits = Info.u_sample_bits; ret[i].v_sample_bits = Info.v_sample_bits; ret[i].horz_y_period = Info.horz_y_period; ret[i].horz_u_period = Info.horz_u_period; ret[i].horz_v_period = Info.horz_v_period; ret[i].vert_y_period = Info.vert_y_period; ret[i].vert_u_period = Info.vert_u_period; ret[i].vert_v_period = Info.vert_v_period; memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); ret[i].scanline_order = Info.scanline_order; (*num)++; } } else _XEatData(dpy, rep.length << 2); } UnlockDisplay(dpy); SyncHandle(); return ret; } XvImage * XvCreateImage ( Display *dpy, XvPortID port, int id, char *data, int width, int height ) { XExtDisplayInfo *info = xv_find_display(dpy); xvQueryImageAttributesReq *req; xvQueryImageAttributesReply rep; XvImage *ret = NULL; XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); XvGetReq(QueryImageAttributes, req); req->id = id; req->port = port; req->width = width; req->height = height; /* READ THE REPLY */ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return NULL; } if((ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3)))) { ret->id = id; ret->width = rep.width; ret->height = rep.height; ret->data_size = rep.data_size; ret->num_planes = rep.num_planes; ret->pitches = (int*)(&ret[1]); ret->offsets = ret->pitches + rep.num_planes; ret->data = data; ret->obdata = NULL; _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); } else _XEatData(dpy, rep.length << 2); UnlockDisplay(dpy); SyncHandle(); return ret; } XvImage * XvShmCreateImage ( Display *dpy, XvPortID port, int id, char *data, int width, int height, XShmSegmentInfo *shminfo ){ XvImage *ret; ret = XvCreateImage(dpy, port, id, data, width, height); if(ret) ret->obdata = (XPointer)shminfo; return ret; } int XvPutImage ( Display *dpy, XvPortID port, Drawable d, GC gc, XvImage *image, int src_x, int src_y, unsigned int src_w, unsigned int src_h, int dest_x, int dest_y, unsigned int dest_w, unsigned int dest_h ){ XExtDisplayInfo *info = xv_find_display(dpy); xvPutImageReq *req; int len; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); FlushGC(dpy, gc); XvGetReq(PutImage, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->id = image->id; req->src_x = src_x; req->src_y = src_y; req->src_w = src_w; req->src_h = src_h; req->drw_x = dest_x; req->drw_y = dest_y; req->drw_w = dest_w; req->drw_h = dest_h; req->width = image->width; req->height = image->height; len = (image->data_size + 3) >> 2; SetReqLen(req, len, len); /* Yes it's kindof lame that we are sending the whole thing, but for video all of it may be needed even if displaying only a subsection, and I don't want to go through the trouble of creating subregions to send */ Data(dpy, (char *)image->data, image->data_size); UnlockDisplay(dpy); SyncHandle(); return Success; } int XvShmPutImage ( Display *dpy, XvPortID port, Drawable d, GC gc, XvImage *image, int src_x, int src_y, unsigned int src_w, unsigned int src_h, int dest_x, int dest_y, unsigned int dest_w, unsigned int dest_h, Bool send_event ){ XExtDisplayInfo *info = xv_find_display(dpy); XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata; xvShmPutImageReq *req; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); FlushGC(dpy, gc); XvGetReq(ShmPutImage, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->shmseg = shminfo->shmseg; req->id = image->id; req->src_x = src_x; req->src_y = src_y; req->src_w = src_w; req->src_h = src_h; req->drw_x = dest_x; req->drw_y = dest_y; req->drw_w = dest_w; req->drw_h = dest_h; req->offset = image->data - shminfo->shmaddr; req->width = image->width; req->height = image->height; req->send_event = send_event; UnlockDisplay(dpy); SyncHandle(); return Success; } static Bool xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) { XExtDisplayInfo *info = xv_find_display(dpy); XvEvent *re = (XvEvent *)host; xvEvent *event = (xvEvent *)wire; XvCheckExtension(dpy, info, False); switch((event->u.u.type & 0x7F) - info->codes->first_event) { case XvVideoNotify: re->xvvideo.type = event->u.u.type & 0x7f; re->xvvideo.serial = _XSetLastRequestRead(dpy, (xGenericReply *)event); re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); re->xvvideo.display = dpy; re->xvvideo.time = event->u.videoNotify.time; re->xvvideo.reason = event->u.videoNotify.reason; re->xvvideo.drawable = event->u.videoNotify.drawable; re->xvvideo.port_id = event->u.videoNotify.port; break; case XvPortNotify: re->xvport.type = event->u.u.type & 0x7f; re->xvport.serial = _XSetLastRequestRead(dpy, (xGenericReply *)event); re->xvport.send_event = ((event->u.u.type & 0x80) != 0); re->xvport.display = dpy; re->xvport.time = event->u.portNotify.time; re->xvport.port_id = event->u.portNotify.port; re->xvport.attribute = event->u.portNotify.attribute; re->xvport.value = event->u.portNotify.value; break; default: return False; } return (True); } @ 1.3 log @re-import the XvMC libraries from 4.2.0 build the XvMC library by default as it uses the DRM (for build testing) Fix up XvMC to use the drmCommand interface @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.16 2002/10/16 00:37:33 dawes Exp $ */ d270 1 @ 1.3.6.1 log @merge from trunk @ text @@ 1.3.4.1 log @Massive merge from trunk. @ text @@ 1.2 log @Remove client-side libraries not needed for the DRI components. @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.8 1999/05/23 06:33:31 dawes Exp $ */ d53 1 d55 48 a102 1 #include "extutil.h" a103 18 static XExtCodes *_XvCodes; static Bool (* _XvOldWireToEventVideo)(); static Bool (* _XvOldWireToEventPort)(); static char *(* _XvOldErrorString)(); static Bool _XvWireToEvent(); static char *_XvErrorString(); #define PREAMBLE(stat) \ LockDisplay(dpy); \ if ((!_XvCodes) && (!_XvInitExtension(dpy))) \ { \ UnlockDisplay(dpy); SyncHandle(); return (stat); \ } #define POSTAMBLE \ UnlockDisplay(dpy); \ SyncHandle() d114 1 d118 3 a120 1 PREAMBLE(XvBadExtension); d124 5 a128 8 /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return(XvBadExtension); } d132 6 a137 3 *p_requestBase = _XvCodes->major_opcode; *p_eventBase = _XvCodes->first_event; *p_errorBase = _XvCodes->first_error; d149 1 d165 3 a167 1 PREAMBLE(XvBadExtension); d174 1 a174 2 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { d178 1 a178 1 } d181 1 a181 2 if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { d185 1 a185 1 } d192 11 a202 8 size = rep.num_adaptors*sizeof(XvAdaptorInfo); if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } d207 1 a207 2 for (ii=0; iinum_formats; jj++) { d259 1 a259 1 } d265 1 a265 1 } d270 2 a271 1 POSTAMBLE; d310 1 d324 3 a326 1 PREAMBLE(XvBadExtension); d333 1 a333 2 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { d337 1 a337 1 } d340 1 a340 2 if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { d344 1 a344 1 } d352 1 a352 2 if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) { d357 1 a357 1 } d362 1 a362 2 for (jj=0; jjnum_encodings; ii++, pe++) { d416 1 a416 1 } a418 1 d432 1 d435 3 a437 1 PREAMBLE(XvBadExtension); d455 2 a456 1 POSTAMBLE; d472 1 d475 3 a477 1 PREAMBLE(XvBadExtension); d494 2 a495 1 POSTAMBLE; d511 1 d514 3 a516 1 PREAMBLE(XvBadExtension); d533 2 a534 1 POSTAMBLE; d550 1 d553 3 a555 1 PREAMBLE(XvBadExtension); d572 2 a573 1 POSTAMBLE; d584 1 d587 3 a589 1 PREAMBLE(XvBadExtension); d595 2 a596 1 POSTAMBLE; d607 1 d612 3 a614 1 PREAMBLE(XvBadExtension); d625 2 a626 1 POSTAMBLE; d637 1 d640 3 a642 1 PREAMBLE(XvBadExtension); d648 2 a649 1 POSTAMBLE; d660 4 a663 1 register xvSelectVideoNotifyReq *req; d665 1 a665 1 PREAMBLE(XvBadExtension); d671 2 a672 1 POSTAMBLE; d683 1 d686 3 a688 1 PREAMBLE(XvBadExtension); d694 2 a695 1 POSTAMBLE; d701 6 a706 5 XvSetPortAttribute (dpy, port, attribute, value) register Display *dpy; XvPortID port; Atom attribute; int value; d708 4 a711 1 register xvSetPortAttributeReq *req; d713 1 a713 1 PREAMBLE(XvBadExtension); d720 2 a721 1 POSTAMBLE; d727 6 a732 5 XvGetPortAttribute (dpy, port, attribute, p_value) register Display *dpy; XvPortID port; Atom attribute; int *p_value; d734 2 a735 1 register xvGetPortAttributeReq *req; d738 3 a740 1 PREAMBLE(XvBadExtension); d748 1 a748 2 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { d752 1 a752 1 } d756 2 a757 1 POSTAMBLE; d763 11 a773 8 XvQueryBestSize(dpy, port, motion, vid_w, vid_h, drw_w, drw_h, p_actual_width, p_actual_height) register Display *dpy; XvPortID port; Bool motion; unsigned int vid_w, vid_h; unsigned int drw_w, drw_h; unsigned int *p_actual_width, *p_actual_height; d775 2 a776 1 register xvQueryBestSizeReq *req; d779 3 a781 1 PREAMBLE(XvBadExtension); d793 1 a793 2 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { d797 1 a797 1 } d802 2 a803 1 POSTAMBLE; d812 1 d819 3 a821 1 PREAMBLE(NULL); d845 3 a847 1 ret[i].name = marker; d856 72 a927 1 POSTAMBLE; d932 180 d1113 1 a1113 1 _XvWireToEvent(Display *dpy, XvEvent *re, xvEvent *event) d1115 9 a1123 3 if (event->u.u.type == _XvCodes->first_event+XvVideoNotify) { d1133 2 a1134 7 if (_XvOldWireToEventVideo) { (void)(* _XvOldWireToEventVideo)(dpy, re, event); } } else if (event->u.u.type == _XvCodes->first_event+XvPortNotify) { d1144 4 a1147 9 if (_XvOldWireToEventPort) { (void)(* _XvOldWireToEventPort)(dpy, re, event); } } else { return (False); } a1151 23 Bool _XvInitExtension(Display *dpy) { if (!(_XvCodes = XInitExtension (dpy, XvName))) { return False; } _XvOldWireToEventVideo = XESetWireToEvent(dpy, _XvCodes->first_event + XvVideoNotify, _XvWireToEvent); _XvOldWireToEventPort = XESetWireToEvent(dpy, _XvCodes->first_event + XvPortNotify, _XvWireToEvent); _XvOldErrorString = XESetErrorString(dpy, _XvCodes->extension, _XvErrorString); return True; } a1152 31 static char * _XvErrorString( Display *dpy, int code, XExtCodes *ecodes, char *buffer, int size ){ if (size < strlen("Encoding") + 1) { if (_XvOldErrorString) return (* _XvOldErrorString)(dpy, code, ecodes, buffer, size); } if (code - ecodes->first_error == XvBadPort) { strcpy(buffer, "Port"); } else if (code - ecodes->first_error == XvBadEncoding) { strcpy(buffer, "Encoding"); } else { if (_XvOldErrorString) return (* _XvOldErrorString)(dpy, code, ecodes, buffer, size); } return (char *)NULL; } @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @Import XFree 3.9.16 @ text @@ 1.1.1.1.4.1 log @ All the changes to get the trunk (which includes 3.9.17) onto the tdfx-1-1 branch. @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.10 1999/12/27 00:39:25 robin Exp $ */ a54 1 #include "XShm.h" d761 1 a761 3 ret[i].min_value = Info.min; ret[i].max_value = Info.max; ret[i].name = marker; a774 237 XvImageFormatValues * XvListImageFormats ( Display *dpy, XvPortID port, int *num ){ xvListImageFormatsReq *req; xvListImageFormatsReply rep; XvImageFormatValues *ret = NULL; *num = 0; PREAMBLE(NULL); XvGetReq(ListImageFormats, req); req->port = port; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return NULL; } if(rep.num_formats) { int size = (rep.num_formats * sizeof(XvImageFormatValues)); if((ret = Xmalloc(size))) { xvImageFormatInfo Info; int i; for(i = 0; i < rep.num_formats; i++) { _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); ret[i].id = Info.id; ret[i].type = Info.type; ret[i].byte_order = Info.byte_order; memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); ret[i].bits_per_pixel = Info.bpp; ret[i].format = Info.format; ret[i].num_planes = Info.num_planes; ret[i].depth = Info.depth; ret[i].red_mask = Info.red_mask; ret[i].green_mask = Info.green_mask; ret[i].blue_mask = Info.blue_mask; ret[i].y_sample_bits = Info.y_sample_bits; ret[i].u_sample_bits = Info.u_sample_bits; ret[i].v_sample_bits = Info.v_sample_bits; ret[i].horz_y_period = Info.horz_y_period; ret[i].horz_u_period = Info.horz_u_period; ret[i].horz_v_period = Info.horz_v_period; ret[i].vert_y_period = Info.vert_y_period; ret[i].vert_u_period = Info.vert_u_period; ret[i].vert_v_period = Info.vert_v_period; memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); ret[i].scanline_order = Info.scanline_order; (*num)++; } } else _XEatData(dpy, rep.length << 2); } POSTAMBLE; return ret; } XvImage * XvCreateImage ( Display *dpy, XvPortID port, int id, char *data, int width, int height ) { xvQueryImageAttributesReq *req; xvQueryImageAttributesReply rep; XvImage *ret = NULL; PREAMBLE(NULL); XvGetReq(QueryImageAttributes, req); req->id = id; req->port = port; req->width = width; req->height = height; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return NULL; } if(ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3))) { ret->id = id; ret->width = rep.width; ret->height = rep.height; ret->data_size = rep.data_size; ret->num_planes = rep.num_planes; ret->pitches = (int*)(&ret[1]); ret->offsets = ret->pitches + rep.num_planes; ret->data = data; ret->obdata = NULL; _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); } else _XEatData(dpy, rep.length << 2); POSTAMBLE; return ret; } XvImage * XvShmCreateImage ( Display *dpy, XvPortID port, int id, char *data, int width, int height, XShmSegmentInfo *shminfo ){ XvImage *ret; ret = XvCreateImage(dpy, port, id, data, width, height); if(ret) ret->obdata = (XPointer)shminfo; return ret; } int XvPutImage ( Display *dpy, XvPortID port, Drawable d, GC gc, XvImage *image, int src_x, int src_y, unsigned int src_w, unsigned int src_h, int dest_x, int dest_y, unsigned int dest_w, unsigned int dest_h ){ xvPutImageReq *req; PREAMBLE(XvBadExtension); if(image->data_size > (dpy->max_request_size << 2)) /* FixMe */ return BadAlloc; FlushGC(dpy, gc); XvGetReq(PutImage, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->id = image->id; req->src_x = src_x; req->src_y = src_y; req->src_w = src_w; req->src_h = src_h; req->drw_x = dest_x; req->drw_y = dest_y; req->drw_w = dest_w; req->drw_h = dest_h; req->width = image->width; req->height = image->height; req->length += (image->data_size + 3) >> 2; /* Yes it's kindof lame that we are sending the whole thing, but for video all of it may be needed even if displaying only a subsection, and I don't want to go through the trouble of creating subregions to send */ _XSend(dpy, (char *)image->data, image->data_size); POSTAMBLE; return Success; } int XvShmPutImage ( Display *dpy, XvPortID port, Drawable d, GC gc, XvImage *image, int src_x, int src_y, unsigned int src_w, unsigned int src_h, int dest_x, int dest_y, unsigned int dest_w, unsigned int dest_h, Bool send_event ){ XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata; xvShmPutImageReq *req; PREAMBLE(XvBadExtension); FlushGC(dpy, gc); XvGetReq(ShmPutImage, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->shmseg = shminfo->shmseg; req->id = image->id; req->src_x = src_x; req->src_y = src_y; req->src_w = src_w; req->src_h = src_h; req->drw_x = dest_x; req->drw_y = dest_y; req->drw_w = dest_w; req->drw_h = dest_h; req->offset = image->data - shminfo->shmaddr; req->width = image->width; req->height = image->height; req->send_event = send_event; POSTAMBLE; return Success; } d830 1 a830 1 (int) _XvWireToEvent); d835 1 a835 1 (int) _XvWireToEvent); @ 1.1.1.2 log @Import of XFree86 3.9.17 @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.10 1999/12/27 00:39:25 robin Exp $ */ a54 1 #include "XShm.h" d761 1 a761 3 ret[i].min_value = Info.min; ret[i].max_value = Info.max; ret[i].name = marker; a774 237 XvImageFormatValues * XvListImageFormats ( Display *dpy, XvPortID port, int *num ){ xvListImageFormatsReq *req; xvListImageFormatsReply rep; XvImageFormatValues *ret = NULL; *num = 0; PREAMBLE(NULL); XvGetReq(ListImageFormats, req); req->port = port; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return NULL; } if(rep.num_formats) { int size = (rep.num_formats * sizeof(XvImageFormatValues)); if((ret = Xmalloc(size))) { xvImageFormatInfo Info; int i; for(i = 0; i < rep.num_formats; i++) { _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); ret[i].id = Info.id; ret[i].type = Info.type; ret[i].byte_order = Info.byte_order; memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); ret[i].bits_per_pixel = Info.bpp; ret[i].format = Info.format; ret[i].num_planes = Info.num_planes; ret[i].depth = Info.depth; ret[i].red_mask = Info.red_mask; ret[i].green_mask = Info.green_mask; ret[i].blue_mask = Info.blue_mask; ret[i].y_sample_bits = Info.y_sample_bits; ret[i].u_sample_bits = Info.u_sample_bits; ret[i].v_sample_bits = Info.v_sample_bits; ret[i].horz_y_period = Info.horz_y_period; ret[i].horz_u_period = Info.horz_u_period; ret[i].horz_v_period = Info.horz_v_period; ret[i].vert_y_period = Info.vert_y_period; ret[i].vert_u_period = Info.vert_u_period; ret[i].vert_v_period = Info.vert_v_period; memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); ret[i].scanline_order = Info.scanline_order; (*num)++; } } else _XEatData(dpy, rep.length << 2); } POSTAMBLE; return ret; } XvImage * XvCreateImage ( Display *dpy, XvPortID port, int id, char *data, int width, int height ) { xvQueryImageAttributesReq *req; xvQueryImageAttributesReply rep; XvImage *ret = NULL; PREAMBLE(NULL); XvGetReq(QueryImageAttributes, req); req->id = id; req->port = port; req->width = width; req->height = height; /* READ THE REPLY */ if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return NULL; } if(ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3))) { ret->id = id; ret->width = rep.width; ret->height = rep.height; ret->data_size = rep.data_size; ret->num_planes = rep.num_planes; ret->pitches = (int*)(&ret[1]); ret->offsets = ret->pitches + rep.num_planes; ret->data = data; ret->obdata = NULL; _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); } else _XEatData(dpy, rep.length << 2); POSTAMBLE; return ret; } XvImage * XvShmCreateImage ( Display *dpy, XvPortID port, int id, char *data, int width, int height, XShmSegmentInfo *shminfo ){ XvImage *ret; ret = XvCreateImage(dpy, port, id, data, width, height); if(ret) ret->obdata = (XPointer)shminfo; return ret; } int XvPutImage ( Display *dpy, XvPortID port, Drawable d, GC gc, XvImage *image, int src_x, int src_y, unsigned int src_w, unsigned int src_h, int dest_x, int dest_y, unsigned int dest_w, unsigned int dest_h ){ xvPutImageReq *req; PREAMBLE(XvBadExtension); if(image->data_size > (dpy->max_request_size << 2)) /* FixMe */ return BadAlloc; FlushGC(dpy, gc); XvGetReq(PutImage, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->id = image->id; req->src_x = src_x; req->src_y = src_y; req->src_w = src_w; req->src_h = src_h; req->drw_x = dest_x; req->drw_y = dest_y; req->drw_w = dest_w; req->drw_h = dest_h; req->width = image->width; req->height = image->height; req->length += (image->data_size + 3) >> 2; /* Yes it's kindof lame that we are sending the whole thing, but for video all of it may be needed even if displaying only a subsection, and I don't want to go through the trouble of creating subregions to send */ _XSend(dpy, (char *)image->data, image->data_size); POSTAMBLE; return Success; } int XvShmPutImage ( Display *dpy, XvPortID port, Drawable d, GC gc, XvImage *image, int src_x, int src_y, unsigned int src_w, unsigned int src_h, int dest_x, int dest_y, unsigned int dest_w, unsigned int dest_h, Bool send_event ){ XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata; xvShmPutImageReq *req; PREAMBLE(XvBadExtension); FlushGC(dpy, gc); XvGetReq(ShmPutImage, req); req->port = port; req->drawable = d; req->gc = gc->gid; req->shmseg = shminfo->shmseg; req->id = image->id; req->src_x = src_x; req->src_y = src_y; req->src_w = src_w; req->src_h = src_h; req->drw_x = dest_x; req->drw_y = dest_y; req->drw_w = dest_w; req->drw_h = dest_h; req->offset = image->data - shminfo->shmaddr; req->width = image->width; req->height = image->height; req->send_event = send_event; POSTAMBLE; return Success; } d830 1 a830 1 (int) _XvWireToEvent); d835 1 a835 1 (int) _XvWireToEvent); @ 1.1.1.3 log @Import of XFree86 3.9.18 @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.11 2000/01/26 22:05:46 tsi Exp $ */ d1016 1 a1016 1 _XvWireToEvent(Display *dpy, XEvent *host, xEvent *wire) a1017 2 XvEvent *re = (XvEvent *)host; xvEvent *event = (xvEvent *)wire; d1068 1 a1068 1 XESetWireToEvent(dpy, d1070 1 a1070 1 _XvWireToEvent); d1075 1 a1075 1 _XvWireToEvent); @ 1.1.1.3.4.1 log @Merge w/ 4.0 to mga-0-0-2-branch @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.12 2000/03/03 20:51:09 mvojkovi Exp $ */ d94 1 a94 1 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) d96 2 a97 1 POSTAMBLE; a106 2 POSTAMBLE; d141 2 a142 1 POSTAMBLE; d149 2 a150 1 POSTAMBLE; d163 2 a164 1 POSTAMBLE; d196 2 a197 1 POSTAMBLE; d213 2 a214 1 POSTAMBLE; d298 2 a299 1 POSTAMBLE; d306 2 a307 1 POSTAMBLE; d320 2 a321 1 POSTAMBLE; d351 2 a352 1 POSTAMBLE; d676 2 a677 1 POSTAMBLE; d715 2 a716 1 POSTAMBLE; d746 2 a747 1 POSTAMBLE; d797 2 a798 1 POSTAMBLE; d866 3 a868 2 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { POSTAMBLE; @ 1.1.1.4 log @Import of XFree86 4.0 @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.12 2000/03/03 20:51:09 mvojkovi Exp $ */ d94 1 a94 1 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) d96 2 a97 1 POSTAMBLE; a106 2 POSTAMBLE; d141 2 a142 1 POSTAMBLE; d149 2 a150 1 POSTAMBLE; d163 2 a164 1 POSTAMBLE; d196 2 a197 1 POSTAMBLE; d213 2 a214 1 POSTAMBLE; d298 2 a299 1 POSTAMBLE; d306 2 a307 1 POSTAMBLE; d320 2 a321 1 POSTAMBLE; d351 2 a352 1 POSTAMBLE; d676 2 a677 1 POSTAMBLE; d715 2 a716 1 POSTAMBLE; d746 2 a747 1 POSTAMBLE; d797 2 a798 1 POSTAMBLE; d866 3 a868 2 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { POSTAMBLE; @ 1.1.1.4.26.1 log @ Merge the trunk onto the tdfx-2-1 branch. Now up to date with 4.0.1. @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.14 2000/05/25 20:47:39 mvojkovi Exp $ */ a52 1 #include a53 1 #include "Xext.h" d57 18 a74 45 static XExtensionInfo _xv_info_data; static XExtensionInfo *xv_info = &_xv_info_data; static char *xv_extension_name = XvName; #define XvCheckExtension(dpy, i, val) \ XextCheckExtension(dpy, i, xv_extension_name, val) static char *xv_error_string(); static int xv_close_display(); static Bool xv_wire_to_event(); static XExtensionHooks xv_extension_hooks = { NULL, /* create_gc */ NULL, /* copy_gc */ NULL, /* flush_gc */ NULL, /* free_gc */ NULL, /* create_font */ NULL, /* free_font */ xv_close_display, /* close_display */ xv_wire_to_event, /* wire_to_event */ NULL, /* event_to_wire */ NULL, /* error */ xv_error_string /* error_string */ }; static char *xv_error_list[] = { "BadPort", /* XvBadPort */ "BadEncoding", /* XvBadEncoding */ "BadControl" /* XvBadControl */ }; static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, xv_extension_name, &xv_extension_hooks, XvNumEvents, NULL) static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, XvNumErrors, xv_error_list) a84 1 XExtDisplayInfo *info = xv_find_display(dpy); d88 1 a88 1 XvCheckExtension(dpy, info, XvBadExtension); d90 1 a90 1 LockDisplay(dpy); d92 1 a92 1 XvGetReq(QueryExtension, req); d94 5 a98 5 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return XvBadExtension; } d102 3 a104 3 *p_requestBase = info->codes->major_opcode; *p_eventBase = info->codes->first_event; *p_errorBase = info->codes->first_error; d106 1 a106 2 UnlockDisplay(dpy); SyncHandle(); a117 1 XExtDisplayInfo *info = xv_find_display(dpy); d133 1 a133 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d140 3 a142 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d144 1 a144 1 } d147 3 a149 3 if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { UnlockDisplay(dpy); SyncHandle(); d151 1 a151 1 } d159 2 a160 1 if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { d162 1 a162 2 UnlockDisplay(dpy); SyncHandle(); d164 1 a164 1 } d169 2 a170 1 for (ii=0; iinum_formats; jj++) { d222 1 a222 1 } d228 1 a228 1 } d233 1 a233 2 UnlockDisplay(dpy); SyncHandle(); a271 1 XExtDisplayInfo *info = xv_find_display(dpy); d285 1 a285 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d292 3 a294 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d296 1 a296 1 } d299 3 a301 3 if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { UnlockDisplay(dpy); SyncHandle(); d303 1 a303 1 } d311 2 a312 1 if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) { d314 1 a314 2 UnlockDisplay(dpy); SyncHandle(); d316 1 a316 1 } d321 2 a322 1 for (jj=0; jjnum_encodings; ii++, pe++) { d378 1 a378 1 } d381 1 a394 1 XExtDisplayInfo *info = xv_find_display(dpy); d397 1 a397 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d415 1 a415 2 UnlockDisplay(dpy); SyncHandle(); a430 1 XExtDisplayInfo *info = xv_find_display(dpy); d433 1 a433 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d450 1 a450 2 UnlockDisplay(dpy); SyncHandle(); a465 1 XExtDisplayInfo *info = xv_find_display(dpy); d468 1 a468 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d485 1 a485 2 UnlockDisplay(dpy); SyncHandle(); a500 1 XExtDisplayInfo *info = xv_find_display(dpy); d503 1 a503 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d520 1 a520 2 UnlockDisplay(dpy); SyncHandle(); a530 1 XExtDisplayInfo *info = xv_find_display(dpy); d533 1 a533 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d539 1 a539 2 UnlockDisplay(dpy); SyncHandle(); a549 1 XExtDisplayInfo *info = xv_find_display(dpy); d554 1 a554 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d565 1 a565 2 UnlockDisplay(dpy); SyncHandle(); a575 1 XExtDisplayInfo *info = xv_find_display(dpy); d578 1 a578 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d584 1 a584 2 UnlockDisplay(dpy); SyncHandle(); d595 1 a595 4 XExtDisplayInfo *info = xv_find_display(dpy); xvSelectVideoNotifyReq *req; XvCheckExtension(dpy, info, XvBadExtension); d597 1 a597 1 LockDisplay(dpy); d603 1 a603 2 UnlockDisplay(dpy); SyncHandle(); a613 1 XExtDisplayInfo *info = xv_find_display(dpy); d616 1 a616 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d622 1 a622 2 UnlockDisplay(dpy); SyncHandle(); d628 5 a632 6 XvSetPortAttribute ( Display *dpy, XvPortID port, Atom attribute, int value ) d634 1 a634 4 XExtDisplayInfo *info = xv_find_display(dpy); xvSetPortAttributeReq *req; XvCheckExtension(dpy, info, XvBadExtension); d636 1 a636 1 LockDisplay(dpy); d643 1 a643 2 UnlockDisplay(dpy); SyncHandle(); d649 5 a653 6 XvGetPortAttribute ( Display *dpy, XvPortID port, Atom attribute, int *p_value ) d655 1 a655 2 XExtDisplayInfo *info = xv_find_display(dpy); xvGetPortAttributeReq *req; d658 1 a658 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d666 3 a668 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d670 1 a670 1 } d674 1 a674 2 UnlockDisplay(dpy); SyncHandle(); d680 8 a687 11 XvQueryBestSize( Display *dpy, XvPortID port, Bool motion, unsigned int vid_w, unsigned int vid_h, unsigned int drw_w, unsigned int drw_h, unsigned int *p_actual_width, unsigned int *p_actual_height ) d689 1 a689 2 XExtDisplayInfo *info = xv_find_display(dpy); xvQueryBestSizeReq *req; d692 1 a692 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d704 3 a706 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d708 1 a708 1 } d713 1 a713 2 UnlockDisplay(dpy); SyncHandle(); a721 1 XExtDisplayInfo *info = xv_find_display(dpy); d728 1 a728 3 XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); d736 1 a736 2 UnlockDisplay(dpy); SyncHandle(); d762 1 a762 2 UnlockDisplay(dpy); SyncHandle(); a771 1 XExtDisplayInfo *info = xv_find_display(dpy); d778 1 a778 3 XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); d786 1 a786 2 UnlockDisplay(dpy); SyncHandle(); d827 1 a827 2 UnlockDisplay(dpy); SyncHandle(); a839 1 XExtDisplayInfo *info = xv_find_display(dpy); d844 1 a844 3 XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); d855 1 a855 2 UnlockDisplay(dpy); SyncHandle(); d859 1 a859 1 if((ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3)))) { d874 1 a874 2 UnlockDisplay(dpy); SyncHandle(); a911 1 XExtDisplayInfo *info = xv_find_display(dpy); a912 1 int len; d914 1 a914 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d916 3 d937 1 a937 3 len = (image->data_size + 3) >> 2; SetReqLen(req, len, len); d943 1 a943 1 Data(dpy, (char *)image->data, image->data_size); d945 1 a945 2 UnlockDisplay(dpy); SyncHandle(); a965 1 XExtDisplayInfo *info = xv_find_display(dpy); d969 1 a969 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d993 1 a993 2 UnlockDisplay(dpy); SyncHandle(); d999 3 d1003 1 a1003 1 xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) a1004 1 XExtDisplayInfo *info = xv_find_display(dpy); d1008 2 a1009 5 XvCheckExtension(dpy, info, False); switch((event->u.u.type & 0x7F) - info->codes->first_event) { case XvVideoNotify: d1019 7 a1025 2 break; case XvPortNotify: d1035 9 a1043 4 break; default: return False; } d1048 32 d1081 22 @ 1.1.1.5 log @Import of XFree86 4.0.1 @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.14 2000/05/25 20:47:39 mvojkovi Exp $ */ a52 1 #include a53 1 #include "Xext.h" d57 18 a74 45 static XExtensionInfo _xv_info_data; static XExtensionInfo *xv_info = &_xv_info_data; static char *xv_extension_name = XvName; #define XvCheckExtension(dpy, i, val) \ XextCheckExtension(dpy, i, xv_extension_name, val) static char *xv_error_string(); static int xv_close_display(); static Bool xv_wire_to_event(); static XExtensionHooks xv_extension_hooks = { NULL, /* create_gc */ NULL, /* copy_gc */ NULL, /* flush_gc */ NULL, /* free_gc */ NULL, /* create_font */ NULL, /* free_font */ xv_close_display, /* close_display */ xv_wire_to_event, /* wire_to_event */ NULL, /* event_to_wire */ NULL, /* error */ xv_error_string /* error_string */ }; static char *xv_error_list[] = { "BadPort", /* XvBadPort */ "BadEncoding", /* XvBadEncoding */ "BadControl" /* XvBadControl */ }; static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, xv_extension_name, &xv_extension_hooks, XvNumEvents, NULL) static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, XvNumErrors, xv_error_list) a84 1 XExtDisplayInfo *info = xv_find_display(dpy); d88 1 a88 1 XvCheckExtension(dpy, info, XvBadExtension); d90 1 a90 1 LockDisplay(dpy); d92 1 a92 1 XvGetReq(QueryExtension, req); d94 5 a98 5 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return XvBadExtension; } d102 3 a104 3 *p_requestBase = info->codes->major_opcode; *p_eventBase = info->codes->first_event; *p_errorBase = info->codes->first_error; d106 1 a106 2 UnlockDisplay(dpy); SyncHandle(); a117 1 XExtDisplayInfo *info = xv_find_display(dpy); d133 1 a133 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d140 3 a142 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d144 1 a144 1 } d147 3 a149 3 if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { UnlockDisplay(dpy); SyncHandle(); d151 1 a151 1 } d159 2 a160 1 if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { d162 1 a162 2 UnlockDisplay(dpy); SyncHandle(); d164 1 a164 1 } d169 2 a170 1 for (ii=0; iinum_formats; jj++) { d222 1 a222 1 } d228 1 a228 1 } d233 1 a233 2 UnlockDisplay(dpy); SyncHandle(); a271 1 XExtDisplayInfo *info = xv_find_display(dpy); d285 1 a285 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d292 3 a294 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d296 1 a296 1 } d299 3 a301 3 if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { UnlockDisplay(dpy); SyncHandle(); d303 1 a303 1 } d311 2 a312 1 if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) { d314 1 a314 2 UnlockDisplay(dpy); SyncHandle(); d316 1 a316 1 } d321 2 a322 1 for (jj=0; jjnum_encodings; ii++, pe++) { d378 1 a378 1 } d381 1 a394 1 XExtDisplayInfo *info = xv_find_display(dpy); d397 1 a397 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d415 1 a415 2 UnlockDisplay(dpy); SyncHandle(); a430 1 XExtDisplayInfo *info = xv_find_display(dpy); d433 1 a433 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d450 1 a450 2 UnlockDisplay(dpy); SyncHandle(); a465 1 XExtDisplayInfo *info = xv_find_display(dpy); d468 1 a468 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d485 1 a485 2 UnlockDisplay(dpy); SyncHandle(); a500 1 XExtDisplayInfo *info = xv_find_display(dpy); d503 1 a503 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d520 1 a520 2 UnlockDisplay(dpy); SyncHandle(); a530 1 XExtDisplayInfo *info = xv_find_display(dpy); d533 1 a533 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d539 1 a539 2 UnlockDisplay(dpy); SyncHandle(); a549 1 XExtDisplayInfo *info = xv_find_display(dpy); d554 1 a554 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d565 1 a565 2 UnlockDisplay(dpy); SyncHandle(); a575 1 XExtDisplayInfo *info = xv_find_display(dpy); d578 1 a578 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d584 1 a584 2 UnlockDisplay(dpy); SyncHandle(); d595 1 a595 4 XExtDisplayInfo *info = xv_find_display(dpy); xvSelectVideoNotifyReq *req; XvCheckExtension(dpy, info, XvBadExtension); d597 1 a597 1 LockDisplay(dpy); d603 1 a603 2 UnlockDisplay(dpy); SyncHandle(); a613 1 XExtDisplayInfo *info = xv_find_display(dpy); d616 1 a616 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d622 1 a622 2 UnlockDisplay(dpy); SyncHandle(); d628 5 a632 6 XvSetPortAttribute ( Display *dpy, XvPortID port, Atom attribute, int value ) d634 1 a634 4 XExtDisplayInfo *info = xv_find_display(dpy); xvSetPortAttributeReq *req; XvCheckExtension(dpy, info, XvBadExtension); d636 1 a636 1 LockDisplay(dpy); d643 1 a643 2 UnlockDisplay(dpy); SyncHandle(); d649 5 a653 6 XvGetPortAttribute ( Display *dpy, XvPortID port, Atom attribute, int *p_value ) d655 1 a655 2 XExtDisplayInfo *info = xv_find_display(dpy); xvGetPortAttributeReq *req; d658 1 a658 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d666 3 a668 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d670 1 a670 1 } d674 1 a674 2 UnlockDisplay(dpy); SyncHandle(); d680 8 a687 11 XvQueryBestSize( Display *dpy, XvPortID port, Bool motion, unsigned int vid_w, unsigned int vid_h, unsigned int drw_w, unsigned int drw_h, unsigned int *p_actual_width, unsigned int *p_actual_height ) d689 1 a689 2 XExtDisplayInfo *info = xv_find_display(dpy); xvQueryBestSizeReq *req; d692 1 a692 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d704 3 a706 3 if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); d708 1 a708 1 } d713 1 a713 2 UnlockDisplay(dpy); SyncHandle(); a721 1 XExtDisplayInfo *info = xv_find_display(dpy); d728 1 a728 3 XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); d736 1 a736 2 UnlockDisplay(dpy); SyncHandle(); d762 1 a762 2 UnlockDisplay(dpy); SyncHandle(); a771 1 XExtDisplayInfo *info = xv_find_display(dpy); d778 1 a778 3 XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); d786 1 a786 2 UnlockDisplay(dpy); SyncHandle(); d827 1 a827 2 UnlockDisplay(dpy); SyncHandle(); a839 1 XExtDisplayInfo *info = xv_find_display(dpy); d844 1 a844 3 XvCheckExtension(dpy, info, NULL); LockDisplay(dpy); d855 1 a855 2 UnlockDisplay(dpy); SyncHandle(); d859 1 a859 1 if((ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3)))) { d874 1 a874 2 UnlockDisplay(dpy); SyncHandle(); a911 1 XExtDisplayInfo *info = xv_find_display(dpy); a912 1 int len; d914 1 a914 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d916 3 d937 1 a937 3 len = (image->data_size + 3) >> 2; SetReqLen(req, len, len); d943 1 a943 1 Data(dpy, (char *)image->data, image->data_size); d945 1 a945 2 UnlockDisplay(dpy); SyncHandle(); a965 1 XExtDisplayInfo *info = xv_find_display(dpy); d969 1 a969 3 XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); d993 1 a993 2 UnlockDisplay(dpy); SyncHandle(); d999 3 d1003 1 a1003 1 xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) a1004 1 XExtDisplayInfo *info = xv_find_display(dpy); d1008 2 a1009 5 XvCheckExtension(dpy, info, False); switch((event->u.u.type & 0x7F) - info->codes->first_event) { case XvVideoNotify: d1019 7 a1025 2 break; case XvPortNotify: d1035 9 a1043 4 break; default: return False; } d1048 32 d1081 22 @ 1.1.1.6 log @Import of XFree86 4.0.1d-pre @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.10 1999/12/27 00:39:25 robin Exp $ */ @ 1.1.1.7 log @Import of XFree86 4.0.1d-pre (2) @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.14 2000/05/25 20:47:39 mvojkovi Exp $ */ @ 1.1.1.7.34.1 log @Merge from trunk. @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.15 2001/05/11 08:23:22 alanh Exp $ */ d192 6 a197 10 if (rep.num_adaptors == 0) { pas = NULL; } else { size = rep.num_adaptors*sizeof(XvAdaptorInfo); if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } a206 1 pa++; @ 1.1.1.7.20.1 log @merge from DRI trunk (first pass) @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.15 2001/05/11 08:23:22 alanh Exp $ */ d192 6 a197 10 if (rep.num_adaptors == 0) { pas = NULL; } else { size = rep.num_adaptors*sizeof(XvAdaptorInfo); if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } a206 1 pa++; @ 1.1.1.7.32.1 log @merge from trunk into bsd-2-0-0 branch (4.1.0) @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.15 2001/05/11 08:23:22 alanh Exp $ */ d192 6 a197 10 if (rep.num_adaptors == 0) { pas = NULL; } else { size = rep.num_adaptors*sizeof(XvAdaptorInfo); if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } a206 1 pa++; @ 1.1.1.7.32.2 log @merge from trunk. @ text @@ 1.1.1.8 log @Import of XFree86 4.1.0 @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.15 2001/05/11 08:23:22 alanh Exp $ */ d192 6 a197 10 if (rep.num_adaptors == 0) { pas = NULL; } else { size = rep.num_adaptors*sizeof(XvAdaptorInfo); if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); return(XvBadAlloc); } a206 1 pa++; @ 1.1.1.9 log @XFree86 4.3.0 merge @ text @d24 1 a24 1 /* $XFree86: xc/lib/Xv/Xv.c,v 1.16 2002/10/16 00:37:33 dawes Exp $ */ d55 3 a57 3 #include #include #include @