diff options
-rw-r--r-- | include/X11/extensions/Xvlib.h | 432 | ||||
-rw-r--r-- | man/Xv.man | 69 | ||||
-rw-r--r-- | man/XvFreeAdaptorInfo.man | 24 | ||||
-rw-r--r-- | man/XvFreeEncodingInfo.man | 24 | ||||
-rw-r--r-- | man/XvGetPortAttribute.man | 99 | ||||
-rw-r--r-- | man/XvGetStill.man | 128 | ||||
-rw-r--r-- | man/XvGetVideo.man | 133 | ||||
-rw-r--r-- | man/XvGrabPort.man | 70 | ||||
-rw-r--r-- | man/XvPortNotify.man | 58 | ||||
-rw-r--r-- | man/XvPutStill.man | 108 | ||||
-rw-r--r-- | man/XvPutVideo.man | 119 | ||||
-rw-r--r-- | man/XvQueryAdaptors.man | 100 | ||||
-rw-r--r-- | man/XvQueryBestSize.man | 68 | ||||
-rw-r--r-- | man/XvQueryEncodings.man | 94 | ||||
-rw-r--r-- | man/XvQueryExtension.man | 51 | ||||
-rw-r--r-- | man/XvSelectPortNotify.man | 53 | ||||
-rw-r--r-- | man/XvSelectVideoNotify.man | 49 | ||||
-rw-r--r-- | man/XvSetPortAttribute.man | 100 | ||||
-rw-r--r-- | man/XvStopVideo.man | 56 | ||||
-rw-r--r-- | man/XvUngrabPort.man | 51 | ||||
-rw-r--r-- | man/XvVideoNotify.man | 58 | ||||
-rw-r--r-- | src/Xv.c | 1152 | ||||
-rw-r--r-- | src/Xvlibint.h | 76 |
23 files changed, 3172 insertions, 0 deletions
diff --git a/include/X11/extensions/Xvlib.h b/include/X11/extensions/Xvlib.h new file mode 100644 index 0000000..28e7ce4 --- /dev/null +++ b/include/X11/extensions/Xvlib.h @@ -0,0 +1,432 @@ +/*********************************************************** +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/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $ */ + +#ifndef XVLIB_H +#define XVLIB_H +/* +** File: +** +** Xvlib.h --- Xv library public header file +** +** 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 +** +** 05.15.91 Carver +** - version 2.0 upgrade +** +** 01.24.91 Carver +** - version 1.4 upgrade +** +*/ + +#include <X11/Xfuncproto.h> +#include <X11/extensions/Xv.h> + +typedef struct { + int numerator; + int denominator; +} XvRational; + +typedef struct { + int flags; /* XvGettable, XvSettable */ + int min_value; + int max_value; + char *name; +} XvAttribute; + +typedef struct { + XvEncodingID encoding_id; + char *name; + unsigned long width; + unsigned long height; + XvRational rate; + unsigned long num_encodings; +} XvEncodingInfo; + +typedef struct { + char depth; + unsigned long visual_id; +} XvFormat; + +typedef struct { + XvPortID base_id; + unsigned long num_ports; + char type; + char *name; + unsigned long num_formats; + XvFormat *formats; + unsigned long num_adaptors; +} XvAdaptorInfo; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Drawable drawable; /* drawable */ + unsigned long reason; /* what generated this event */ + XvPortID port_id; /* what port */ + Time time; /* milliseconds */ +} XvVideoNotifyEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + XvPortID port_id; /* what port */ + Time time; /* milliseconds */ + Atom attribute; /* atom that identifies attribute */ + long value; /* value of attribute */ +} XvPortNotifyEvent; + +typedef union { + int type; + XvVideoNotifyEvent xvvideo; + XvPortNotifyEvent xvport; + long pad[24]; +} XvEvent; + +typedef struct { + int id; /* Unique descriptor for the format */ + int type; /* XvRGB, XvYUV */ + int byte_order; /* LSBFirst, MSBFirst */ + char guid[16]; /* Globally Unique IDentifier */ + int bits_per_pixel; + int format; /* XvPacked, XvPlanar */ + int num_planes; + + /* for RGB formats only */ + int depth; + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; + + /* for YUV formats only */ + unsigned int y_sample_bits; + unsigned int u_sample_bits; + unsigned int v_sample_bits; + unsigned int horz_y_period; + unsigned int horz_u_period; + unsigned int horz_v_period; + unsigned int vert_y_period; + unsigned int vert_u_period; + unsigned int vert_v_period; + char component_order[32]; /* eg. UYVY */ + int scanline_order; /* XvTopToBottom, XvBottomToTop */ +} XvImageFormatValues; + +typedef struct { + int id; + int width, height; + int data_size; /* bytes */ + int num_planes; + int *pitches; /* bytes */ + int *offsets; /* bytes */ + char *data; + XPointer obdata; +} XvImage; + +_XFUNCPROTOBEGIN + +extern int XvQueryExtension( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int* /* p_version */, + unsigned int* /* p_revision */, + unsigned int* /* p_requestBase */, + unsigned int* /* p_eventBase */, + unsigned int* /* p_errorBase */ +#endif +); + +extern int XvQueryAdaptors( +#if NeedFunctionPrototypes + Display* /* display */, + Window /* window */, + unsigned int* /* p_nAdaptors */, + XvAdaptorInfo** /* p_pAdaptors */ +#endif +); + +extern int XvQueryEncodings( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + unsigned int* /* p_nEncoding */, + XvEncodingInfo** /* p_pEncoding */ +#endif +); + +extern int XvPutVideo( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Drawable /* d */, + GC /* gc */, + int /* vx */, + int /* vy */, + unsigned int /* vw */, + unsigned int /* vh */, + int /* dx */, + int /* dy */, + unsigned int /* dw */, + unsigned int /* dh */ +#endif +); + +extern int XvPutStill( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Drawable /* d */, + GC /* gc */, + int /* vx */, + int /* vy */, + unsigned int /* vw */, + unsigned int /* vh */, + int /* dx */, + int /* dy */, + unsigned int /* dw */, + unsigned int /* dh */ +#endif +); + +extern int XvGetVideo( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Drawable /* d */, + GC /* gc */, + int /* vx */, + int /* vy */, + unsigned int /* vw */, + unsigned int /* vh */, + int /* dx */, + int /* dy */, + unsigned int /* dw */, + unsigned int /* dh */ +#endif +); + +extern int XvGetStill( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Drawable /* d */, + GC /* gc */, + int /* vx */, + int /* vy */, + unsigned int /* vw */, + unsigned int /* vh */, + int /* dx */, + int /* dy */, + unsigned int /* dw */, + unsigned int /* dh */ +#endif +); + +extern int XvStopVideo( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Drawable /* drawable */ +#endif +); + +extern int XvGrabPort( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Time /* time */ +#endif +); + +extern int XvUngrabPort( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Time /* time */ +#endif +); + +extern int XvSelectVideoNotify( +#if NeedFunctionPrototypes + Display* /* display */, + Drawable /* drawable */, + Bool /* onoff */ +#endif +); + +extern int XvSelectPortNotify( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Bool /* onoff */ +#endif +); + +extern int XvSetPortAttribute( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Atom /* attribute */, + int /* value */ +#endif +); + +extern int XvGetPortAttribute( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Atom /* attribute */, + int* /* p_value */ +#endif +); + +extern int XvQueryBestSize( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + Bool /* motion */, + unsigned int /* vid_w */, + unsigned int /* vid_h */, + unsigned int /* drw_w */, + unsigned int /* drw_h */, + unsigned int* /* p_actual_width */, + unsigned int* /* p_actual_width */ +#endif +); + +extern XvAttribute* XvQueryPortAttributes( +#if NeedFunctionPrototypes + Display* /* display */, + XvPortID /* port */, + int* /* number */ +#endif +); + + +extern void XvFreeAdaptorInfo( +#if NeedFunctionPrototypes + XvAdaptorInfo* /* adaptors */ +#endif +); + +extern void XvFreeEncodingInfo( +#if NeedFunctionPrototypes + XvEncodingInfo* /* encodings */ +#endif +); + + +extern XvImageFormatValues * XvListImageFormats ( +#if NeedFunctionPrototypes + Display *display, + XvPortID port_id, + int *count_return +#endif +); + +extern XvImage * XvCreateImage ( +#if NeedFunctionPrototypes + Display *display, + XvPortID port, + int id, + char *data, + int width, + int height +#endif +); + +extern int XvPutImage ( +#if NeedFunctionPrototypes + Display *display, + XvPortID id, + Drawable d, + GC gc, + XvImage *image, + int src_x, + int src_y, + unsigned int src_w, + unsigned int src_h, + int dest_x, + int dest_y, + unsigned int dest_w, + unsigned int dest_h +#endif +); + +extern int XvShmPutImage ( +#if NeedFunctionPrototypes + Display *display, + XvPortID id, + Drawable d, + GC gc, + XvImage *image, + int src_x, + int src_y, + unsigned int src_w, + unsigned int src_h, + int dest_x, + int dest_y, + unsigned int dest_w, + unsigned int dest_h, + Bool send_event +#endif +); + +#ifdef _XSHM_H_ + +extern XvImage * XvShmCreateImage ( +#if NeedFunctionPrototypes + Display *display, + XvPortID port, + int id, + char* data, + int width, + int height, + XShmSegmentInfo *shminfo +#endif +); + +#endif + + +_XFUNCPROTOEND + +#endif /* XVLIB_H */ diff --git a/man/Xv.man b/man/Xv.man new file mode 100644 index 0000000..eaf5861 --- /dev/null +++ b/man/Xv.man @@ -0,0 +1,69 @@ +.TH Xv 3X __vendorversion__ +.\" +.\" $XFree86: xc/doc/man/Xv/Xv.man,v 1.6 2001/01/27 18:20:35 dawes Exp $ +.SH Name +Xv \- X Window System video extension +.SH Description +The Xv extension provides support for video adaptors attached to an X +display. It takes the approach that a display may have one or more +video adaptors, each of which has one or more ports through which +independent video streams pass. +.PP +An adaptor may be able to display video in a drawable, capture video +from a drawable, or both. It translates between video encoding (NTSC, +PAL, SECAM, etc...) and drawable format (depth and visual-id pair). An +adaptor may support multiple video encodings and/or multiple drawable +formats. +.PP +Clients use Xv(3X) to gain access and manage sharing of a display's +video resources. Typically, a client will use XvQueryExtension(3X) to +determine the status of the extension, XvQueryAdaptors(3X) to get a +description of what video adaptors exist, and XvQueryEncodings(3X) to +get a description of what video encodings an adaptor supports. +.PP +Once a client has determined what video resources are available, it is +free to put video into a drawable or get video from a drawable, +according the capabilities supported. Clients can select to receive +events when video activity changes in a drawable and when port +attributes have changed. +.SH Summary of Library Functions +The following is a summary of Xv library functions: +.sp 1l +XvGetPortAttribute(3X) \- return current port attribute value +.sp 1l +XvGetStill(3X) \- capture a single frame of video from a drawable +.sp 1l +XvGetVideo(3X) \- capture video from a drawable +.sp 1l +XvGrabPort(3X) \- lock port for exclusive use by client +.sp 1l +XvPortNotify(3X) \- event generated when port attributes change +.sp 1l +XvPutStill(3X) \- write a single frame of video to a drawable +.sp 1l +XvPutVideo(3X) \- write video into a drawable +.sp 1l +XvQueryAdaptors(3X) \- return adaptor information for a screen +.sp 1l +XvQueryBestSize(3X) \- determine the optimum drawable region size +.sp 1l +XvQueryEncodings(3X) \- return list of encodings for an adaptor +.sp 1l +XvQueryExtension(3X) \- return version and revision of extension +.sp 1l +XvSelectPortNotify(3X) \- enable or disable XvPortNotify events +.sp 1l +XvSelectVideoNotify(3X) \- enable or disable XvVideoNotify events +.sp 1l +XvSetPortAttribute(3X) \- set an attribute for a port +.sp 1l +XvStopVideo(3X) \- stop active video +.sp 1l +XvUngrabPort(3X) \- release a grabbed port +.sp 1l +XvVideoNotify(3X) \- event generated for video processing +.sp 1l +.PP +Each of these functions is described in its own Xv man page. +.br + diff --git a/man/XvFreeAdaptorInfo.man b/man/XvFreeAdaptorInfo.man new file mode 100644 index 0000000..8a557c5 --- /dev/null +++ b/man/XvFreeAdaptorInfo.man @@ -0,0 +1,24 @@ +.TH XvFreeAdaptorInfo 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvFreeAdaptorInfo.man,v 1.5 2001/01/27 18:20:35 dawes Exp $ +.SH Name +XvFreeAdaptorInfo \- free adaptor information +.\" +.SH Syntax +\fBXvFreeAdaptorInfo(\fIp_adaptor_info\fR) +.sp 1l +\fBXvAdaptorInfo \fI*p_adaptor_info\fR; +.SH Arguments +.\" +.IP \fIp_adaptor_info\fR 8 +Pointer to where the adaptor information is located. +.\" +.SH Description +.\" +XvFreeAdaptorInfo(3X) frees adaptor information that +was returned by XvQueryAdaptors(3X). The data structure +used for adaptor information is defined in the +reference page for XvQueryAdaptors(3X). +.SH See Also +.\" +XvQueryAdaptors(3X), XvFreeEncodingInfo(3X) +.br diff --git a/man/XvFreeEncodingInfo.man b/man/XvFreeEncodingInfo.man new file mode 100644 index 0000000..d7f609c --- /dev/null +++ b/man/XvFreeEncodingInfo.man @@ -0,0 +1,24 @@ +.TH XvFreeEncodingInfo 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvFreeEncodingInfo.man,v 1.5 2001/01/27 18:20:35 dawes Exp $ +.SH Name +XvFreeEncodingInfo \- free encoding information +.\" +.SH Syntax +\fBXvFreeEncodingInfo(\fIp_encoding_info\fR) +.sp 1l +\fBXvEncodingInfo \fI*p_encoding_info\fR; +.SH Arguments +.\" +.IP \fIp_encoding_info\fR 8 +Pointer to where the encoding information is located. +.\" +.SH Description +.\" +XvFreeEncodingInfo(3X) frees encoding information that +was returned by XvQueryEncodings(3X). The data structure +used for encoding information is defined in the +reference page for XvQueryEncodings(3X). +.SH See Also +.\" +XvQueryEncodings(3X) +.br diff --git a/man/XvGetPortAttribute.man b/man/XvGetPortAttribute.man new file mode 100644 index 0000000..de1c21f --- /dev/null +++ b/man/XvGetPortAttribute.man @@ -0,0 +1,99 @@ +.TH XvGetPortAttribute 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvGetPortAttribute.man,v 1.6 2001/01/27 18:20:35 dawes Exp $ +.SH Name +XvGetPortAttribute \- return current port attribute value +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +.B XvGetPortAttribute(\fIdpy, port, attribute, p_value\fR) +.sp 1l +\fBDisplay \fI*dpy\fR; +.br +\fBXvPortID \fIport\fR; +.br +\fBAtom \fIattribute\fR; +.br +\fBint \fI*p_vlaue\fR; +.sp 1l +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 8 +Specifies the display screen on which the +X Server is to accept requests from X clients. If the +display option is not specified, X uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 8 +Specifies the port, associated with the given display, for +which the attribute values are to be returned. +.IP \fIattribute\fR 8 +An atom that identifies the attribute to be queried by this +request. Control atoms are obtained using the XInternAtom +request with a string from the following table. +.IP \fIp_value\fR 8 +Pointer to the location where the attribute value is written on +return. +.\" +.SH Description +.\" +.PP +XvGetPortAttribute(3X) returns the current value of the requested +port attribute in the integer pointed to by \fIp_value\fR. +The attribute is identified using an Atom that equates to the attribute name. +The XInternAtom request can be used with one of the strings +below to return a matching Atom. +.bp +.PP +.\" .TS +.\" tab(@); +.\" lfHB lfHB lfHB +.\" lfR lfR lfR . +.\" _ +.\" .PP +.\" .sp 4p +.\" Attribute String@Type@Default +.\" .sp 6p +.\" _ +.\" .sp 6p +.\" "XV_ENCODING"@XvEncodingID@Server dependent +.\" "XV_HUE"@[-1000...1000]@0 +.\" "XV_SATURATION"@[-1000...1000]@0 +.\" "XV_BRIGHTNESS"@[-1000...1000]@0 +.\" "XV_CONTRAST"@[-1000...1000]@0 +.\" .sp 6p +.\" .TE +.nf +Attribute String Type Default + +"XV_ENCODING" XvEncodingID Server dependent +"XV_HUE" [-1000...1000] 0 +"XV_SATURATION" [-1000...1000] 0 +"XV_BRIGHTNESS" [-1000...1000] 0 +"XV_CONTRAST" [-1000...1000] 0 +.fi +.SH Returned Values +.IP [Success] 8 +Returned if XvGetPortAttribute(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvGetPortAttribute(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [BadMatch] 8 +Generated if the requested attribute atom does not specify an attribute +supported by the adaptor. +.SH See Also +.\" +XvSetPortAttribute(3X), XvPortNotify(3X) +.br + + + + diff --git a/man/XvGetStill.man b/man/XvGetStill.man new file mode 100644 index 0000000..af3ec6d --- /dev/null +++ b/man/XvGetStill.man @@ -0,0 +1,128 @@ +.TH XvGetStill 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvGetStill.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvGetStill \- capture a single frame of video from a drawable +.\" +.SH Syntax +.B include "Xvlib.h" +.sp 1l +.B XvGetStill(\fIdpy, port, d, gc, vx, vy, vw, vh, dx, dy, dw, dh\fP) +.sp 1l +.B register +.I Display +.I *dpy; +.br +.B XvPortID +.I port; +.br +.B Drawable +.I d; +.br +.B GC +.I gc; +.br +.B int +.I vx, +.I vy, +.I dx, +.I dy; +.br +.B unsigned int +.I vw, +.I vh; +.br +.B unsigned int +.I dw, +.I dh; +.sp 1l +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Defines the port to which the still is outputed. +.IP \fId\fR 15 +Defines the drawable from which the still is to be captured. +Pixmaps are currently not supported. +.IP \fIgc\fR 15 +Defines the graphical context. GC components are: +.I subwindow-mode, +.I clip-x-origin, +.I clip-y-origin, +and +.I clip-mask. +.IP \fIvx,vy,vw,vh\fR 15 +Define the location and size of the destination video region +into which the still is to be written. \fIvx\fP and \fIvy\fP define the +.I x and +.I y +coordinates of the upper-left corner of the video region; +.I vw and +.I vh +define the width and height, in pixels, of the video region. +.IP \fIdx,dy,dw,dh\fR 15 +Define the location and size of the source drawable from which the +still image is to be captured. +.I dx and +.I dy +define the +.I x and +.I y +coordinates of the upper-left corner of the drawable region; +.I dw and +.I dh +define the width and height, in pixels, of the drawable region. +.\" +.SH Description +.\" +.PN XvGetStill +captures a single frame of video from a drawable. The +position and size of the destination (video) rectangle is specified by \fIvx, +vy, vw\fR, and \fIvh\fR. The position and size of the +source (drawable) rectangle is +specified by \fIdx, dy, dw\fR, and \fIdh\fR. +.PP +Drawable data is clipped to the bounds of the drawable, scaled to the +requested video region size (or the closest size supported) and +clipped to the bounds of the video encoding. The contents of any region +not updated with drawable data is undefined. +.PP +./" If the still is successfully captured an XvVideoNotify event with +./" detail XvStill is generated for the drawable. +./" [mhs]: Not in this universe +If the port is grabbed +by another client, this request is ignored, and an XvVideoNotify event +with detail XvBusy is generated for the drawable. +.SH Returned Values +.IP [Success] 8 +Returned if XvGetStill(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvGetStill(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [BadDrawable] 8 +Generated if the requested drawable does not exist. +.IP [BadGC] 8 +Generated if the requested graphics context does not exist. +.IP [BadAlloc] 8 +Generated if there were insufficient resources to process the request. +.\" +.SH See Also +.\" +XvPutStill(3X), XvGetVideo(3X), XvPutVideo(3X), XvVideoNotify(3X) +.br + + + + diff --git a/man/XvGetVideo.man b/man/XvGetVideo.man new file mode 100644 index 0000000..1b64710 --- /dev/null +++ b/man/XvGetVideo.man @@ -0,0 +1,133 @@ +.TH XvGetVideo 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvGetVideo.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvGetVideo \- capture video from a drawable +.\" +.SH Syntax +.B include "Xvlib.h" +.sp 1l +.B XvGetVideo(dpy, port, d, gc, vx, vy, vw, vh, dx, dy, dw, dh) +.sp 1l +.B register +.I Display +.I *dpy; +.br +.B XvPortID +.I port; +.br +.B Drawable +.I d; +.br +.B GC +.I gc; +.br +.B int +.I vx, +.I vy, +.I dx, +.I dy; +.br +unsigned int +.I vw, +.I vh; +.br +unsigned int +.I dw, +.I dh; +.sp 1l +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Defines the port to which video output is sent. +.IP \fId\fR 15 +Defines the drawable (window) from which video output is to be obtained. +.IP \fIgc\fR 15 +Defines the graphical context. GC components are: +.I subwindow-mode, +.I clip-x-origin, +.I clip-y-origin, +and +.I clip-mask. +.IP \fIvx,vy,vw,vh\fR 15 +Define the location and size of the video region is to be written. \fIvx\fP +and \fIvy\fP define the +.I x and +.I y +coordinates of the upper-left corner of the video region; +.I vw and +.I vh +define the width and height, in pixels, of the video region. +.IP \fIdx,dy,dw,dh\fR 15 +Define the location of the source drawable from which the +video image is to be taken. +.I dx and +.I dy +define the +.I x and +.I y +coordinates of the upper-left corner of the drawable region; +.I dw and +.I dh +define the width and height, in pixels, of the drawable region. +.br +.SH Description +.PN XvGetVideo +outputs video from a drawable. The position +and size of the destination rectangle is specified by +.I vx, +.I vy, +.I vw, +and +.I vh. +The position and size of the source rectangle is specified by +.I dx, +.I dy, +.I dw, +and +.I dh. +.PP +Drawable data is clipped to the bounds of the drawable, scaled to the +requested video region size (or the closest size supported) and +clipped to the bounds of the video encoding. The contents of any region +not updated with drawable data is undefined. +.PP +If video is successfully initiated, an XvVideoNotify event with +detail XvStarted is generated for the drawable. If the port is +already in use, its video is preempted, and if the new drawable is +different than the old, an XvVideoNotify event with detail XvPreempted +is generated for the old drawable. If the port is grabbed by another +client, this request is ignored, and an XvVideoNotify event with detail +XvBusy is generated for the drawable. +.\" +.br +.SH Returned Values +.IP [Success] 8 +Returned if XvGetVideo(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvGetVideo(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [BadGC] 8 +Generated if the requested graphics context does not exist. +.IP [BadDrawable] 8 +Generated if the requested drawable does not exist. +.IP [BadAlloc] 8 +Generated if there were insufficient resources to process the request. +.SH See Also +.br +.\" +XvGetStill(3X), XvPutVideo(3X), XvVideoNotify(3X) +.br diff --git a/man/XvGrabPort.man b/man/XvGrabPort.man new file mode 100644 index 0000000..8f5cb19 --- /dev/null +++ b/man/XvGrabPort.man @@ -0,0 +1,70 @@ +.TH XvGrabPort 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvGrabPort.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvGrabPort \- lock port for exclusive use by client +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +.B XvGrabPort(\fIdpy, port, time)\fR +.sp 1l +.B Display \fI*dpy;\fR +.br +.B XvPortID +.I port; +.br +.B Time +.I time; +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 8 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 8 +Defines the port to be grabbed. +.IP \fItime\fR 8 +Specifies the request timestamp. +.\" +.SH Description +.\" +XvGrabPort(3X) grabs a port. Once a client grabs a port, +only that client can make video requests +to that port. +.PP +If the time is before the current port time, the XvGrabPort request is +ignored and XvInvalidTime is returned. If the port is already grabbed by +another client, XvAlreadyGrabbed is returned. Otherwise it returns a +status of \fISuccess\fR. The port time is updated when the following +requests are processed: XvGrabPort(3X), XvUngrabPort(3X), +XvPutVideo(3X), XvPutStill(3X), XvGetVideo(3X), XvGetStill(3X). +.PP +If the port is actively processing video for another client, the +video is preempted, and an XvVideoNotify event with detail XvPreempted +is generated for its drawable. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvGrabPort(3X) completed successfully. +.IP [XvInvalidTime] 8 +Returned if requested time is older than the current port time. +.IP [XvAlreadyGrabbed] 8 +Returned if the port is already grabbed by another client. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvGrabPort(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 15 +Generated if the requested port does not exist. +.\" +.SH See Also +.\" +XvUngrabPort(3X) XvVideoNotify(3X) +.br diff --git a/man/XvPortNotify.man b/man/XvPortNotify.man new file mode 100644 index 0000000..acccf85 --- /dev/null +++ b/man/XvPortNotify.man @@ -0,0 +1,58 @@ +.TH XvPortNotify 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvPortNotify.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvPortNotify \- event generated when port attributes change +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.br +.sp 1l +.EX + + typedef union { + int type; + XvVideoNotifyEvent xvvideo; + XvPortNotifyEvent xvport; + long pad[24]; + } XvEvent; + + typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + XvPortID port_id; + Time time; + Atom attribute; + long value; + } XvPortNotifyEvent; + +.EE +.\" +.IP \fItype\fR 8 +Specifies the type of event: XvPortNotify. +.IP \fIserial\fR 8 +Number of the last request processed by the server. +.IP \fIsend_event\fR 8 +True if the event was generated by a SendEvent request. +.IP \fIdisplay\fR 8 +A pointer to the display the event was read from. +.IP \fIport_id\fR 8 +The port whose attribute has changed. +.IP \fIattribute\fR 8 +An atom specifying the attribute that changed. +.IP \fIvalue\fR 8 +The new value of the attribute. +.\" +.SH Description +.\" +XvPortNotify events are generated when a port attribute is set using +the XvSetPortAttribute(3X) function. +.\" +.SH See Also +XvSetPortAttribute(3X), XvGetPortAttribute(3X), XvSelectPortNotify(3X) +.\" + + + + diff --git a/man/XvPutStill.man b/man/XvPutStill.man new file mode 100644 index 0000000..0d8c7c6 --- /dev/null +++ b/man/XvPutStill.man @@ -0,0 +1,108 @@ +.TH XvPutStill 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvPutStill.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvPutStill \- write a single frame of video to a drawable +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvPutStill(\fIdpy, port, d, gc, vx, vy, vw, vh, dx, dy, dw, dh\fR) +.sp 1l +.B Display +.I *dpy; +.br +.B XvPortID +.I port; +.br +.B Drawable +.I d; +.br +.B GC +.I gc; +.br +.B int +.I vx, +.I vy, +.I dx, +.I dy; +.br +.B unsigned int +.I vw, +.I vh; +.br +.B unsigned int +.I dw, +.I dh; +.sp 1l +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Defines the port from which to get the still. +.IP \fId\fR 15 +Defines the drawable into which the still is to be written. +Pixmaps are currently not supported. +.IP \fIgc\fR 15 +Defines the graphical context. +GC components are: +.I subwindow-mode, +.I clip-x-origin, +.I clip-y-origin, +and +.I clip-mask. +.IP \fIvx,vy,vw,vh\fR 15 +Define the location and size of the video region +to be written. \fIvx\fP and \fIvy\fP define the +upper-left pixel of the region. \fIvw\fP and \fIvh\fP +define the width and height, in pixels, of the region. +.IP \fIdx,dy,dw,dh\fR 15 +Define the location and size of the destination region into which the +still image is written. \fIdx\fP and \fIdy\fP define the upper-left +corner of the region. \fIdw\fP and \fIdh\fP +define the width and height, in pixels, of the region. +.\" +.SH Description +.\" +XvPutStill(3X) writes a single frame of video to a drawable. +The position and size of the source (video) rectangle is specified by \fIvx, +vy, vw\fR, and \fIvh\fR. The position and size of the destination (drawable) +rectangle is specified by \fIdx, dy, dw\fR, and \fIdh\fR. +.PP +Video data is clipped to the bounds of the video encoding, scaled to the +requested drawable region size (or the closest size supported) and +clipped to the bounds of the drawable. +.PP +If the port is grabbed by another client, this request is ignored, and +an XvVideoNotify event with detail XvBusy is generated for the +drawable. If the port is not receiving a valid video signal a +VideoNotify event with detail XvHardError is generated for the drawable. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvPutStill(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvGetStill(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [BadDrawable] 8 +Generated if the requested drawable does not exist. +.IP [BadGC] 8 +Generated if the requested graphics context does not exist. +.IP [BadAlloc] 8 +Generated if there were insufficient resources to process the request. +.SH See Also +.\" +XvPutVideo(3X), XvGetStill(3X), XvVideoNotify(3X) +.br diff --git a/man/XvPutVideo.man b/man/XvPutVideo.man new file mode 100644 index 0000000..22e09ad --- /dev/null +++ b/man/XvPutVideo.man @@ -0,0 +1,119 @@ +.TH XvPutVideo 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvPutVideo.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvPutVideo \- write video into a drawable +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvPutVideo(\fIdpy, port, d, gc, vx, vy, vw, vh, dx, dy, dw, dh\fR) +.sp 1l +.B Display +.I *dpy; +.br +.B XvPortID +.I port; +.br +.B Drawable +.I d; +.br +.B GC +.I gc; +.br +.B int +.I vx, +.I vy, +.I dx, +.I dy; +.br +.B unsigned int +.I vw, +.I vh; +.br +.B unsigned int +.I dw, +.I dh; +.sp 1l +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Defines the port from which to get video. +.IP \fId\fR 15 +Defines the drawable (window) into which video is to be written. +.IP \fIgc\fR 15 +Defines the graphical context. +GC components are: +.I subwindow-mode, +.I clip-x-origin, +.I clip-y-origin, +and +.I clip-mask. +.IP \fIvx,vy,vw,vh\fR 15 +Define the size and location of the source (video) region +to be written. \fIvx\fP and \fIvy\fP define the +upper-left pixel of the region. \fIvw\fP and \fIvh\fP +define the width and height, in pixels, of the region. +.IP \fIdx,dy,dw,dh\fR 15 +Define the location and size of the destination (drawable) region +into which the video image is written. +.I dx +and +.I dy +define the upper-left pixel of the region. +.I dw +and +.I dh +define the width and height, in pixels, of the region. +.\" +.SH Description +.\" +XvPutVideo writes video into a drawable. +The position and size of the source (video) +rectangle is specified by \fIvx, vy, vw\fR, and \fIvh\fR. +The position and size of the destination (drawable) +rectangle is specified by \fIdx, dy, dw\fR, and \fIdh\fR. +.PP +Video data is clipped to the bounds of the video encoding, scaled to the +requested drawable region size (or the closest size supported) and +clipped to the bounds of the drawable. +.PP +If video is successfully initiated, an XvVideoNotify event with detail +XvStarted is generated for the drawable. If the port is already in +use, its video is preempted, and if the new drawable is different than +the old, an XvVideoNotify event with detail XvPreempted is generated +for the old drawable. If the port is grabbed by another client, this +request is ignored, and an XvVideoNotify event with detail XvBusy is +generated for the drawable. If the port is not receiving a valid video +signal or if the video signal is interrupted while video is active a +VideoNotify event with detail XvHardError is generated for the drawable. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvPutVideo(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if there were insufficient resources to process the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [BadDrawable] 8 +Generated if the requested drawable does not exist. +.IP [BadGC] 8 +Generated if the requested graphics context does not exist. +.IP [BadAlloc] 8 +Generated if there were insufficient resources to process the request. +.\" +.SH See Also +.\" +XvPutStill(3X), XvGetVideo(3X), XvVideoNotify(3X) +.br diff --git a/man/XvQueryAdaptors.man b/man/XvQueryAdaptors.man new file mode 100644 index 0000000..5f060df --- /dev/null +++ b/man/XvQueryAdaptors.man @@ -0,0 +1,100 @@ +.TH XvQueryAdaptors 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvQueryAdaptors.man,v 1.6 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvQueryAdaptors \- return adaptor information for a screen +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.br +.sp 1l +.B XvQueryAdaptors(\fIdpy, win, p_num_adaptors, pp_adaptor_info\fR) +.sp 1l +\fBDisplay \fI*dpy;\fR +.br +\fBDrawable \fI draw;\fR +.br +\fBint \fI*p_num_adaptors\fR; +.br +\fBXvAdaptorInfo \fI**pp_adaptor_info\fR; +.br +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 8 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIdraw\fR 8 +Specifies a drawable of the screen for which the adaptor +information is desired. +.IP \fIp_num_adaptors\fR 8 +A pointer to where the numer of adaptors for the specified screen +is returned. +.IP \fIpp_adaptor_info\fR 8 +A pointer to where the list of returned adaptor information is +returned. +.\" +.SH Description +.\" +XvQueryAdaptors(3X) returns an video adaptor information for +the screen of the specified drawable. The XvAdaptorInfo structure +has the following organization: +.EX + + typedef struct { + XvPortID base_id; + unsigned long num_ports; + char type; + char *name; + unsigned long num_formats; + XvFormat *formats; + unsigned long num_adaptors; + } XvAdaptorInfo; + +.EE +.IP \fIbase_id\fR 8 +The resource ID of the first adaptor port. +.IP \fInum_ports\fR 8 +The number of ports supported by the adaptor. +.IP \fItype\fR 8 +A bit mask with the value XvInputMask asserted if the adaptor supports video +input, and value XvOutputMask asserted if the adaptor supports video output. +.IP \fIname\fR 8 +A vendor specific name that identifies the adaptor. +.IP \fInum_formats\fR 8 +The number of depth/visual id formats supported by the adaptor. +.IP \fIformats\fR 8 +A pointer to an array of XvFormat structures. +.PP +The XvFormat structure has the following organization: +.EX + + typedef struct { + char depth; + unsigned long visual_id; + } XvFormat; + +.EE +.IP \fIdepth\fR 8 +A drawable depth supported by the adaptor. +.IP \fIvisual_id\fR 8 +A visual-id supported for the given depth by the adaptor. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvQueryAdaptors(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvQueryAdaptors(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [Drawable] 8 +Returned if the requested drawable does not exist. +.SH See Also +XvFreeAdaptorInfo(3X) +.\" diff --git a/man/XvQueryBestSize.man b/man/XvQueryBestSize.man new file mode 100644 index 0000000..031c094 --- /dev/null +++ b/man/XvQueryBestSize.man @@ -0,0 +1,68 @@ +.TH XvQueryBestSize 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvQueryBestSize.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvQueryBestSize \- determine the optimum drawable region size +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvQueryBestSize\fP(\fIdpy, port, motion, vw, vh, dw, dh, p_dw, p_dh\fR) +.sp 1l +.B Display \fI*dpy\fR; +.br +.B XvPortID \fIport\fR; +.br +.B Bool \fImotion\fR; +.br +.B unsigned +.B int \fIvw, vh\fR; +.br +\fBunsigned int \fIdw, dh;\fR +.br +\fBunsigned int \fI*p_dw, *p_dh;\fR +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Defines the port associated with the display and adaptor for which +the optimum size is to be calculated. +.IP \fImotion\fR 15 +Specifies \fITrue\fP if the destination size needs to support +full motion, and \fIFalse\fP if the destination size need only +support still images. +.IP \fIvw,vh\fR 15 +Specifies the size of the source video region desired. +.IP \fIdw,dh\fR 15 +Specifies the size of the destination drawable region desired. +.IP \fIp_dw,p_dh\fR 15 +Pointers to where the closest destination sizes supported by the server are +returned. +.\" +.SH Description +.\" +Some ports may be able to scale incoming or outgoing video. +XvQueryBestSize(3X) returns the size of the closest destination +region that is supported by the adaptor. The returned size is +guaranteed to be smaller than the requested size if a smaller +size is supported. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvQueryBestSize(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvQueryBestSize(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.br diff --git a/man/XvQueryEncodings.man b/man/XvQueryEncodings.man new file mode 100644 index 0000000..42af2c6 --- /dev/null +++ b/man/XvQueryEncodings.man @@ -0,0 +1,94 @@ +.TH XvQueryEncodings 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvQueryEncodings.man,v 1.6 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvQueryEncodings \- return list of encodings for an adaptor +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvQueryEncodings(\fIdpy, port, p_num_encodings, pp_encoding_info)\fR +.sp 1l +\fBregister Display \fI*dpy\fR; +.br +\fBXvPortID \fIport\fR; +.br +\fBunsigned long \fI*p_num_encodings\fR; +.br +\fBXvEncodingInfo \fI**pp_encoding_info\fR; +.\" +.SH Arguments +.IP \fI*dpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Specifies the port whose adaptor is to be queried for its +list of encodings. +.IP \fIp_num_encodings\fR 15 +A pointer to where the number of encodings supported +by the adaptor is written. +.IP \fIpp_encoding_info\fR 15 +A pointer to where the list of returned +encoding information is returned. +XvEncodingInfo has the following structure: +.EX + + typedef struct { + XvEncodingID encoding_id; + char *name; + unsigned long width; + unsigned long height; + XvRational rate; + unsigned long num_encodings; + } XvEncodingInfo; + +.EE +.IP \fIencoding_id\fR 15 +Specifies the encoding-id of the encoding. The encoding-id is used to +identify an encoding when a port's encoding attribute is changed. +.IP \fIname\fR 15 +A pointer to a formatted string that identifies the encoding. The string +has the format "\fItiming-signaltype\fR". For example "ntsc-composite". +.IP \fIwidth,height\fR 15 +The width and height, in pixels, of the decoded video image. +.IP \fIrate\fR 15 +The field rate of the decoded video. +.PP +The XvRational structure is used to specify a fractional number. +It has the following structure: +.EX + + typedef struct { + int numerator; + int denominator; + } XvRational; + +.EE +The \fInumerator\fP and \fIdenominator\fP fields specify the +appropriate parts of a fractional number. +.\" +.SH Description +XvQueryEncodings(3X) returns encoding information about an adaptor. Each +encoding is described by the XvEncodingInfo structure described above. The +encodings are identified by an encoding-id, which can be used to set or get +the encoding attribute of a port. +.SH Returned Values +.IP [Success] 8 +Returned if XvQueryEncodings(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvQueryEncodings(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.\" +.SH See Also +.\" +XvFreeEncodingInfo(3X) +.br diff --git a/man/XvQueryExtension.man b/man/XvQueryExtension.man new file mode 100644 index 0000000..3549f96 --- /dev/null +++ b/man/XvQueryExtension.man @@ -0,0 +1,51 @@ +.TH XvQueryExtension 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvQueryExtension.man,v 1.6 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvQueryExtension \- return version and release of extension +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvQueryExtension(\fIdpy, p_version, p_release, +.br + p_request_base, p_event_base, p_error_base\fR) +.sp 1l +\fBDisplay \fI*dpy\fR; +.br +\fBunsigned int \fI*p_version, *p_release\fR; +.br +\fBunsigned int \fI*p_request_base, *p_event_base, *p_error_base\fR; +.\" +.SH Arguments +.\" +.IP \fIp_version\fR 15 +Pointer to where the current version number of the \fIXv\fP video extension +is written. +.IP \fIp_release\fR 15 +Pointer to where the release number of the \fIXv\fP video extension +is written. +.IP \fIp_request_base\fR 15 +Pointer to where the extension major request number is returned +.IP \fIp_event_base\fR 15 +Pointer to where the extension event base is returned +.IP \fIp_error_base\fR 15 +Pointer to where the extension error base is returned +.\" +.SH Description +.\" +.PP +XvQueryExtension(3X) returns the version and release +numbers for the Xv video extension currently loaded +on the system. The extension major request number, event base, and error +base are also returned. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvQueryExtension(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv video extension is not available for +the named display. +.IP [XvBadAlloc] 8 +Returned if XvQueryExtension(3X) failed to allocate memory to process +the request. +.br diff --git a/man/XvSelectPortNotify.man b/man/XvSelectPortNotify.man new file mode 100644 index 0000000..8e0eb89 --- /dev/null +++ b/man/XvSelectPortNotify.man @@ -0,0 +1,53 @@ +.TH XvSelectPortNotify 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvSelectPortNotify.man,v 1.6 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvSelectPortNotify \- enable or disable XvPortNotify(3X) events +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvSelectPortNotify(\fIdpy, port, onoff\fR) +.sp 1l +\fBDisplay \fI*dpy\fR; +.br +\fBXvPortID \fIport\fR; +.br +\fBBool \fIonoff\fR; +.\" +.SH Arguments +.\" +.IP \fIdpy\fR 8 +Specifies the display screen on which the +X Server is to accept requests from X clients. If the +display option is not specified, X uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 8 +Specifies the port for which PortNotify events are to be generated +when its attributes are changed using XvSetPortAttribute(3X). +.IP \fIonoff\fR 8 +Specifies whether notification is to be enabled or disabled. +.\" +.SH Description +.\" +XvSelectPortNotify(3X) enables or disables PortNotify event +delivery to the requesting client. XvPortNotify(3X) events are +generated when port attributes are changed using XvSetPortAttribute(3X). +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvSelectPortNotify(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvSelectPortNotify(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.SH See Also +.\" +XvSetPortNotify(3X), XvSetPortAttribute(3X), XvPortNotify(3X) +.br diff --git a/man/XvSelectVideoNotify.man b/man/XvSelectVideoNotify.man new file mode 100644 index 0000000..26645bf --- /dev/null +++ b/man/XvSelectVideoNotify.man @@ -0,0 +1,49 @@ +.TH XvSelectVideoNotify 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvSelectVideoNotify.man,v 1.6 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvSelectVideoNotify \- enable or disable VideoNotify events +.\" +.SH Syntax +\fB#include\fI <X11/extensions/Xvlib.h>\fR +.sp 1l +\fBXvSelectVideoNotify(\fIdpy, drawable, onoff\fR) +.sp 1l +\fBregister Display \fI*dpy\fR; +.br +\fBDrawable \fIdrawable\fR; +.br +\fBBool \fIonoff\fR; +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIdrawable\fR 15 +Defines the drawable in which video activity is to be reported. +.IP \fIonoff\fR 15 +Selects whether video notification is enabled or disabled. +.\" +.SH Description +XvSelectVideoNotify(3X) enables or disables events to be reported for +video activity in a drawable. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvSelectVideoNotify(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvSelectVideoNotify(3X) failed to allocate memory to process +the request. +.Diagnostics +.IP [BadDrawable] 8 +Generated if the requested drawable does not exist. +.SH See Also +.\" +XvVideoNotify +.br diff --git a/man/XvSetPortAttribute.man b/man/XvSetPortAttribute.man new file mode 100644 index 0000000..f61d682 --- /dev/null +++ b/man/XvSetPortAttribute.man @@ -0,0 +1,100 @@ +.TH XvSetPortAttribute 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvSetPortAttribute.man,v 1.7 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvSetPortAttribute \- sets an attribute of a video port +.\" +.SH Syntax +\fB#include <X11/extensions/Xvlib.h>\fR +.sp 1l +\fBXvSetPortAttribute(\fIdpy, port, attribute, value\fR) +.sp 1l +\fBDisplay \fI*dpy\fR; +.br +\fBXvPortID \fIport\fR; +.br +\fBAtom \fIattribute\fR; +.br +\fBint \fIvalue\fR; +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Specifies the port for which the attribute is to be used. +.IP \fIattribute\fR 15 +Identifies the port attribute to be set by this request. +Can be one of the table entries under the column "String," below. +.IP \fIvalue\fR 15 +Identifies the value to which \fIattribute\fP is to be set. +Can be one of the table entries under the column "Type," below. +.\" +.SH Description +XvSetPortAttribute(3X) permits a client to set the port attribute +to specified values. This request supports the following values: +.bp +.PP +.\" .TS +.\" tab(@); +.\" lfHB lfHB lfHB +.\" lfR lfR lfR . +.\" _ +.\" .PP +.\" .sp 4p +.\" Attribute String@Type@Default +.\" .sp 6p +.\" _ +.\" .sp 6p +.\" "XV_ENCODING"@XvEncodingID@Server dependent +.\" "XV_HUE"@[-1000...1000]@0 +.\" "XV_SATURATION"@[-1000...1000]@0 +.\" "XV_BRIGHTNESS"@[-1000...1000]@0 +.\" "XV_CONTRAST"@[-1000...1000]@0 +.\" .sp 6p +.\" .TE +.nf +Attribute String Type Default + +"XV_ENCODING" XvEncodingID Server dependent +"XV_HUE" [-1000...1000] 0 +"XV_SATURATION" [-1000...1000] 0 +"XV_BRIGHTNESS" [-1000...1000] 0 +"XV_CONTRAST" [-1000...1000] 0 +.fi +.PP +The supplied encoding must be one of the encodings listed for the +adaptor, otherwise an Encoding error results. +.PP +If the adaptor does not support the exact hue, saturation, +brightness, and contrast levels supplied, the closest levels +supported are assumed. Use XvGetPortAttribute(3X) +to query the resulting levels. +.PP +When an XvSetPortAttribute(3X) request is processed, a +PortControlNotify(3X) event is generated for all clients +that have requested for port changes using XvSelectPortNotify(3X). +.SH Returned Values +.IP [Success] 8 +Returned if XvSetPortAttribute(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvSelectVideoNotify(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [XvBadEncoding] 8 +Generated if an encoding is specified that does not exist. +.IP [BadMatch] 8 +Generated if the requested attribute atom does not specify an attribute +supported by the adaptor. +.SH See Also +.\" +XvGetPortAttribute(3X), XvSelectPortNotify(3X), XvPortNotify(3X) +.br diff --git a/man/XvStopVideo.man b/man/XvStopVideo.man new file mode 100644 index 0000000..c5e188b --- /dev/null +++ b/man/XvStopVideo.man @@ -0,0 +1,56 @@ +.TH XvStopVideo 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvStopVideo.man,v 1.6 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvStopVideo \- stop active video +.\" +.SH Syntax +\fB#include <X11/extensions/Xvlib.h> +.sp 1l +\fBXvStopVideo(\fIdpy, port, draw\fR) +.sp 1l +\fBDisplay \fI*dpy\fR; +.br +\fBXvPortID \fIport\fR; +.br +\fBDrawable \fIdraw\fR; +.\" +.SH Arguments +.\" +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Specifies the port for which video is to be stopped. +.IP \fIdraw\fR 15 +Specifies the drawable associated with the named port. +.SH Description +.\" +XvStopVideo(3X) stops active video for the specified port and +drawable. If the port is not processing video, or if it is processing +video in a different drawable, the request is ignored. When video is +stopped a XvVideoNotify(3X) event with detail XvStopped is generated +for the associated drawable. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvStopVideo(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvStopVideo(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.IP [BadDrawable] 8 +Generated if the requested drawable does not exist. +.\" +.SH See Also +XvGetVideo(3X), XvPutVideo(3X), XvVideoNotifyEvent(3X) +.br diff --git a/man/XvUngrabPort.man b/man/XvUngrabPort.man new file mode 100644 index 0000000..3e6cdb1 --- /dev/null +++ b/man/XvUngrabPort.man @@ -0,0 +1,51 @@ +.TH XvUngrabPort 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvUngrabPort.man,v 1.6 2001/08/17 13:27:50 dawes Exp $ +.SH Name +XvUngrabPort \- release port grabbed for video operation +.\" +.SH Syntax +\fB#include <X11/extensions/Xvlib.h> +.sp 1l +XvUngrabPort(\fIdpy, port, time\fR) +.sp 1l +\fBDisplay \fI*dpy\fR; +.br +\fBXvPortID \fIport\fR; +.br +\fBTime \fItime\fR; +.SH Arguments +.\" +.IP \fIdpy\fR 15 +Specifies the display screen on which the +Xv Server is to accept requests from Xv clients. If the +display option is not specified, Xv uses the display screen +specified by your DISPLAY environment variable. The display +option has the format hostname:number. Using two colons +(::) instead of one (:) indicates that DECnet is to be used +for transport. +.IP \fIport\fR 15 +Specifies the port to be released. If the port had not been +previously grabbed, the request is ignored. +.IP \fItime\fR 15 +Specifies the request timestamp. +.\" +.SH Description +XvUngrabPort(3X) releases a grabbed port. If \fItime\fR specifies a +time before the last XvGrabPort(3X) was executed, the +request is ignored. +.\" +.SH Returned Values +.IP [Success] 8 +Returned if XvUngrabPort(3X) completed successfully. +.IP [XvBadExtension] 8 +Returned if the Xv extension is unavailable. +.IP [XvBadAlloc] 8 +Returned if XvUngrabPort(3X) failed to allocate memory to process +the request. +.SH Diagnostics +.IP [XvBadPort] 8 +Generated if the requested port does not exist. +.SH See Also +.\" +XvGrabPort(3X) +.br diff --git a/man/XvVideoNotify.man b/man/XvVideoNotify.man new file mode 100644 index 0000000..8a50b08 --- /dev/null +++ b/man/XvVideoNotify.man @@ -0,0 +1,58 @@ +.TH XvVideoNotify 3X __vendorversion__ +.\" $XFree86: xc/doc/man/Xv/XvVideoNotify.man,v 1.5 2001/01/27 18:20:36 dawes Exp $ +.SH Name +XvVideoNotify \- event generated for video processing +.\" +.SH Syntax +.B #include <X11/extensions/Xvlib.h> +.br +.sp 1l +.EX + + typedef union { + int type; + XvVideoNotifyEvent xvvideo; + XvPortNotifyEvent xvport; + long pad[24]; + } XvEvent; + + typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + Drawable drawable; + unsigned long reason; + XvPortID port_id; + Time time; + } XvVideoNotifyEvent; + +.EE +.\" +.IP \fItype\fR 8 +Specifies the type of event: XvVideoNotify(3X). +.IP \fIserial\fR 8 +Number of the last request processed by the server. +.IP \fIsend_event\fR 8 +True if the event was generated by a SendEvent request. +.IP \fIdisplay\fR 8 +A pointer to the display the event was read from. +.IP \fIdrawable\fR 8 +The drawable for which the event was generated. +.IP \fIreason\fR 8 +The reason the event was generated: \fBXvStarted\fR, \fBXvStopped\fR, +\fBXvPreempted\fR, \fBXvBusy\fR, \fBXvHardError\fR. +.IP \fIport_id\fR 8 +The port processing the video for which the event was generated. +.\" +.SH Description +.\" +XvVideoNotify(3X) events are generated when video +is started, stopped, preempted by another video +request, ignored because the port is grabbed by another client, or interruped +because of a hard transmission or reception error. +.\" +.SH See Also +XvPutVideo(3X), XvPutStill(3X), XvGetVideo(3X), XvGetStill(3X), +XvStopVideo(3X), XvSelectVideoNotify(3X) +.\" diff --git a/src/Xv.c b/src/Xv.c new file mode 100644 index 0000000..767ecc6 --- /dev/null +++ b/src/Xv.c @@ -0,0 +1,1152 @@ +/*********************************************************** +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.16 2002/10/16 00:37:33 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 <stdio.h> +#include "Xvlibint.h" +#include <X11/extensions/Xext.h> +#include <X11/extensions/extutil.h> +#include <X11/extensions/XShm.h> + +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; ii<rep.num_adaptors; ii++) { + pa->num_adaptors = 0; + pa->name = (char *)NULL; + pa->formats = (XvFormat *)NULL; + pa++; + } + + pa = pas; + for (ii=0; ii<rep.num_adaptors; ii++) { + pa->type = u.pa->type; + pa->base_id = u.pa->base_id; + pa->num_ports = u.pa->num_ports; + pa->num_formats = u.pa->num_formats; + pa->num_adaptors = rep.num_adaptors - ii; + + /* GET ADAPTOR NAME */ + + size = u.pa->name_size; + u.buffer += (sz_xvAdaptorInfo + 3) & ~3; + + if ( (name = (char *)Xmalloc(size+1)) == NULL) + { + XvFreeAdaptorInfo(pas); + Xfree(buffer); + UnlockDisplay(dpy); + SyncHandle(); + return(XvBadAlloc); + } + (void)strncpy(name, u.string, size); + name[size] = '\0'; + pa->name = name; + + u.buffer += (size + 3) & ~3; + + /* GET FORMATS */ + + size = pa->num_formats*sizeof(XvFormat); + if ((pfs=(XvFormat *)Xmalloc(size))==NULL) { + XvFreeAdaptorInfo(pas); + Xfree(buffer); + UnlockDisplay(dpy); + SyncHandle(); + return(XvBadAlloc); + } + + pf = pfs; + for (jj=0; jj<pa->num_formats; jj++) { + pf->depth = u.pf->depth; + pf->visual_id = u.pf->visual; + pf++; + + u.buffer += (sz_xvFormat + 3) & ~3; + } + + pa->formats = pfs; + + pa++; + + } + + *p_nAdaptors = rep.num_adaptors; + *p_pAdaptors = pas; + + UnlockDisplay(dpy); + SyncHandle(); + + return (Success); +} + + +void +XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors) +{ + + XvAdaptorInfo *pa; + int ii; + + if (!pAdaptors) return; + + pa = pAdaptors; + + for (ii=0; ii<pAdaptors->num_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; jj<rep.num_encodings; jj++) { + pe->name = (char *)NULL; + pe->num_encodings = 0; + pe++; + } + + pe = pes; + for (jj=0; jj<rep.num_encodings; jj++) { + pe->encoding_id = u.pe->encoding; + pe->width = u.pe->width; + pe->height = u.pe->height; + pe->rate.numerator = u.pe->rate.numerator; + pe->rate.denominator = u.pe->rate.denominator; + pe->num_encodings = rep.num_encodings - jj; + + size = u.pe->name_size; + u.buffer += (sz_xvEncodingInfo + 3) & ~3; + + if ( (name = (char *)Xmalloc(size+1)) == NULL) { + 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; ii<pEncodings->num_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); +} + + diff --git a/src/Xvlibint.h b/src/Xvlibint.h new file mode 100644 index 0000000..2cec968 --- /dev/null +++ b/src/Xvlibint.h @@ -0,0 +1,76 @@ +/*********************************************************** +Copyright 1987 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/Xvlibint.h,v 1.6 2002/10/16 00:37:33 dawes Exp $ */ + +#ifndef XVLIBINT_H +#define XVLIBINT_H +/* +** File: +** +** Xvlibint.h --- Xv library internal header file +** +** Author: +** +** David Carver (Digital Workstation Engineering/Project Athena) +** +** Revisions: +** +** 01.24.91 Carver +** - version 1.4 upgrade +** +*/ + +#define NEED_REPLIES + +#include <X11/Xlibint.h> +#include <X11/extensions/Xvproto.h> +#include <X11/extensions/Xvlib.h> + +#if !defined(UNIXCPP) +#define XvGetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = info->codes->major_opcode;\ + req->xvReqType = xv_##name; \ + req->length = (SIZEOF(xv##name##Req))>>2;\ + dpy->bufptr += SIZEOF(xv##name##Req);\ + dpy->request++ + +#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ +#define XvGetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = info->codes->major_opcode;\ + req->xvReqType = xv_/**/name;\ + req->length = (SIZEOF(xv/**/name/**/Req))>>2;\ + dpy->bufptr += SIZEOF(xv/**/name/**/Req);\ + dpy->request++ +#endif + + +#endif /* XVLIBINT_H */ |