117ca54c3Smrg
217ca54c3Smrg
317ca54c3Smrg
417ca54c3Smrg
517ca54c3Smrg
617ca54c3Smrg
717ca54c3Smrg
817ca54c3Smrg
917ca54c3Smrg
1017ca54c3Smrg			  X Video Extension
1117ca54c3Smrg			 Protocol Description
1217ca54c3Smrg
1317ca54c3Smrg			      Version 2
1417ca54c3Smrg
1517ca54c3Smrg			      25-JUL-91
1617ca54c3Smrg
1717ca54c3Smrg			     David Carver
1817ca54c3Smrg
1917ca54c3Smrg		    Digital Equipment Corporation
2017ca54c3Smrg		Workstation Engineering/Project Athena
2117ca54c3Smrg
2217ca54c3Smrg
2317ca54c3Smrg
2417ca54c3Smrg
2517ca54c3Smrg
2617ca54c3Smrg
2717ca54c3Smrg
2817ca54c3Smrg
2917ca54c3Smrg
3017ca54c3Smrg
3117ca54c3Smrg
3217ca54c3Smrg
3317ca54c3Smrg
3417ca54c3Smrg
3517ca54c3Smrg
3617ca54c3Smrg
3717ca54c3Smrg
3817ca54c3Smrg
3917ca54c3Smrg
4017ca54c3Smrg
4117ca54c3Smrg
4217ca54c3Smrg
4317ca54c3Smrg
4417ca54c3Smrg  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4517ca54c3Smrg  Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
4617ca54c3Smrg  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
4717ca54c3Smrg
4817ca54c3Smrg                        All Rights Reserved
4917ca54c3Smrg
5017ca54c3Smrg  Permission to use, copy, modify, and distribute this software and its
5117ca54c3Smrg  documentation for any purpose and without fee is hereby granted, provided
5217ca54c3Smrg  that the above copyright notice appear in all copies and that both that
5317ca54c3Smrg  copyright notice and this permission notice appear in supporting
5417ca54c3Smrg  documentation, and that the names of Digital or MIT not be used in
5517ca54c3Smrg  advertising or publicity pertaining to distribution of the software
5617ca54c3Smrg  without specific, written prior permission.
5717ca54c3Smrg
5817ca54c3Smrg  DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
5917ca54c3Smrg  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
6017ca54c3Smrg  DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
6117ca54c3Smrg  ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
6217ca54c3Smrg  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
6317ca54c3Smrg  OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
6417ca54c3Smrg  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6517ca54c3Smrg
6617ca54c3Smrg
6717ca54c3Smrg
6817ca54c3Smrg  Preface
6917ca54c3Smrg  -------
7017ca54c3Smrg
7117ca54c3Smrg    The following is an outline for an X video extension protocol.  It
7217ca54c3Smrg    is preliminary and subject to change.  My goal in writing this was
7317ca54c3Smrg    to fix some the shortcomings of existing overly simplistic
7417ca54c3Smrg    extensions while avoiding pitfalls in an overly complex extension.
7517ca54c3Smrg
7617ca54c3Smrg    Your feedback is desired, and since the major design directions
7717ca54c3Smrg    have been stable for some time, feel free to hammer on the details
7817ca54c3Smrg    of the protocol.
7917ca54c3Smrg
8017ca54c3Smrg    When you receive a revision of the document, refer to the changes
8117ca54c3Smrg    and issues sections to guide your review and analysis.
8217ca54c3Smrg
8317ca54c3Smrg
8417ca54c3Smrg  Acknowledgements
8517ca54c3Smrg  ---------------
8617ca54c3Smrg
8717ca54c3Smrg    The following people have made major contributions to the design of
8817ca54c3Smrg    the Xv protocol:
8917ca54c3Smrg
9017ca54c3Smrg      Branko Gerovac (DEC/Corporate Research)
9117ca54c3Smrg      Russ Sasnett (GTE/Project Athena)
9217ca54c3Smrg      Ralph Swick (DEC/Project Athena)
9317ca54c3Smrg
9417ca54c3Smrg    Many ideas and approaches in Xv were the product of discussions
9517ca54c3Smrg    with several groups, including
9617ca54c3Smrg
9717ca54c3Smrg      Project Athena's Visual Computing Group
9817ca54c3Smrg      The MIT X Consortium
9917ca54c3Smrg      The MIT Media Lab's Interactive Cinema Group
10017ca54c3Smrg
10117ca54c3Smrg
10217ca54c3Smrg  
10317ca54c3Smrg  Changes
10417ca54c3Smrg  -------
10517ca54c3Smrg
10617ca54c3Smrg    From version 1.3 to 2.0
10717ca54c3Smrg
10817ca54c3Smrg    -- Changed SetPortControl and GetPortControl to GetPortAttribute
10917ca54c3Smrg       and SetPortAttribute.
11017ca54c3Smrg
11117ca54c3Smrg    -- Changed QueryBestSize
11217ca54c3Smrg
11317ca54c3Smrg    -- Simplified SelectVideoNotify and SelectPortNotify requests.
11417ca54c3Smrg
11517ca54c3Smrg    -- Changed the way SetPortControl and GetPortControl works.
11617ca54c3Smrg
11717ca54c3Smrg    -- Added a QueryExtension request to return the version and
11817ca54c3Smrg       revision information of the extension.
11917ca54c3Smrg
12017ca54c3Smrg    -- Changed the name of the QueryVideo request to QueryAdaptors;
12117ca54c3Smrg       Removed the list of encodings from QueryVideo and added a
12217ca54c3Smrg       QueryEncodings request.
12317ca54c3Smrg
12417ca54c3Smrg    -- Added a PortNotify event that notifies interested clients that
12517ca54c3Smrg       a port control has been changed.
12617ca54c3Smrg
12717ca54c3Smrg    -- Added SelectPortNotify request to select for PortNotify events.
12817ca54c3Smrg
12917ca54c3Smrg    -- The XvInterruped reason has been replaced by two new reasons:
13017ca54c3Smrg       one for when video is preempted by another video request and
13117ca54c3Smrg       one for when video is terminated because of hard transmission
13217ca54c3Smrg       or reception errors.
13317ca54c3Smrg
13417ca54c3Smrg    -- Changed the wording of the QueryBestSize request.  Added issue
13517ca54c3Smrg       about whether or not returned sizes should maintain the
13617ca54c3Smrg       requested aspect ratio.
13717ca54c3Smrg
13817ca54c3Smrg
13917ca54c3Smrg
14017ca54c3Smrg  Introduction
14117ca54c3Smrg  ------------
14217ca54c3Smrg
14317ca54c3Smrg    Video technology is moving very quickly.  Standards for processing
14417ca54c3Smrg    high resolution video are currently a hot topic of discussion
14517ca54c3Smrg    internationally, and it will soon be possible to process video
14617ca54c3Smrg    entirely within the digital domain.  The Xv extension, however,
14717ca54c3Smrg    does not attempt to address issues of digital video.  Its purpose
14817ca54c3Smrg    is to provide a mechanism for support of current and near term
14917ca54c3Smrg    interactive video technology.
15017ca54c3Smrg
15117ca54c3Smrg    It is somewhat ironic that Xv contains nothing particularly
15217ca54c3Smrg    innovative.  It takes a minimalistic approach, and without a doubt
15317ca54c3Smrg    it could have been defined years ago, and with several revisions.
15417ca54c3Smrg    So, the life expectancy of Xv is not long.  Nevertheless, it may
15517ca54c3Smrg    undergo further revision and experimentation that will help our
15617ca54c3Smrg    progress towards digital video systems.
15717ca54c3Smrg
15817ca54c3Smrg    One premise of the Xv extension is that the X server is not alone.
15917ca54c3Smrg    A separate video server is often used to manage other aspects of
16017ca54c3Smrg    video processing, though the partition between what the X server
16117ca54c3Smrg    does and what a video server does is a matter of great debate.
16217ca54c3Smrg
16317ca54c3Smrg
16417ca54c3Smrg  Model
16517ca54c3Smrg  -----
16617ca54c3Smrg
16717ca54c3Smrg    This extension models video monitor capabilities in the X Window
16817ca54c3Smrg    System.  Some advanced monitors support the simultaneous display
16917ca54c3Smrg    of multiple video signals (into separate windows), and that is
17017ca54c3Smrg    represented here through the ability to display video from
17117ca54c3Smrg    multiple video input adaptors into X drawables.
17217ca54c3Smrg
17317ca54c3Smrg    Some monitors support multiple video encodings (mostly for
17417ca54c3Smrg    internationalization purposes) either through switches or
17517ca54c3Smrg    automatic detection, thus each video adaptor specifies the set of
17617ca54c3Smrg    encodings it supports.
17717ca54c3Smrg
17817ca54c3Smrg    The requests to display video from an adaptor into a drawable are
17917ca54c3Smrg    modeled after the core PutImage request, though extended to
18017ca54c3Smrg    support scaling and source clipping.
18117ca54c3Smrg
18217ca54c3Smrg    Video output is also supported and is symmetric with the video
18317ca54c3Smrg    input function, though fewer GC components are used.
18417ca54c3Smrg
18517ca54c3Smrg
18617ca54c3Smrg  Mechanism
18717ca54c3Smrg  ---------
18817ca54c3Smrg
18917ca54c3Smrg    The Xv extension does the following:
19017ca54c3Smrg
19117ca54c3Smrg      --  lists available video adaptors
19217ca54c3Smrg      --  identifies the number of ports each adaptor supports
19317ca54c3Smrg      --  describes what drawable formats each adaptor supports
19417ca54c3Smrg      --  describes what video encodings each adaptor supports
19517ca54c3Smrg      --  displays video from a port to a drawable
19617ca54c3Smrg      --  captures video from a drawable to a port
19717ca54c3Smrg      --  grabs and ungrabs ports
19817ca54c3Smrg      --  sets and gets port attributes
19917ca54c3Smrg      --  delivers event notification
20017ca54c3Smrg
20117ca54c3Smrg
20217ca54c3Smrg
20317ca54c3Smrg  Adaptors
20417ca54c3Smrg  --------
20517ca54c3Smrg
20617ca54c3Smrg    A display may have multiple video input and output adaptors.  An
20717ca54c3Smrg    adaptor may support multiple simultaneously active ports, and in
20817ca54c3Smrg    some cases the number of ports has no fixed limit.
20917ca54c3Smrg
21017ca54c3Smrg    An input port receives encoded video data and converts it to a
21117ca54c3Smrg    stream of data used to update a drawable.  An output port samples
21217ca54c3Smrg    data from a drawable and produces a stream of encoded video data.
21317ca54c3Smrg
21417ca54c3Smrg    The ADAPTORINFO structure is used to describe a video adaptor.
21517ca54c3Smrg
21617ca54c3Smrg    ADAPTORINFO:
21717ca54c3Smrg  	[base-id: PORT
21817ca54c3Smrg         num-ports: CARD16
21917ca54c3Smrg         type: SETofADAPTORTYPE
22017ca54c3Smrg         formats: LISTofFORMAT
22117ca54c3Smrg         name: STRING]
22217ca54c3Smrg
22317ca54c3Smrg    ADAPTORTYPE: {Input, Output}
22417ca54c3Smrg
22517ca54c3Smrg    FORMAT:
22617ca54c3Smrg  	[depth: CARD8
22717ca54c3Smrg  	 visual: VISUALID]
22817ca54c3Smrg
22917ca54c3Smrg    The base-id field specifies the XID of the first port of the
23017ca54c3Smrg    adaptor.  The `num-ports' field specifies how many ports the
23117ca54c3Smrg    adaptor supports.  The ports of the adaptor have XIDs in the range
23217ca54c3Smrg    [base-id..base-id + num-ports - 1]
23317ca54c3Smrg
23417ca54c3Smrg    The type attribute determines if the adaptor can process video
23517ca54c3Smrg    input, output, or input and output.  The if the adaptor can
23617ca54c3Smrg    process input then Input is asserted, if the adaptor can process
23717ca54c3Smrg    output then Output is asserted.
23817ca54c3Smrg
23917ca54c3Smrg    The drawable depths and visual types supported by the adaptor are
24017ca54c3Smrg    listed in `formats'.  Note: that when video is being processed for
24117ca54c3Smrg    pixmaps the visual format is taken to be the visual of the first
24217ca54c3Smrg    pair that matches the depth of the pixmap.
24317ca54c3Smrg
24417ca54c3Smrg    The name field contains an a vendor specific string that
24517ca54c3Smrg    identifies the adaptor.
24617ca54c3Smrg
24717ca54c3Smrg    It should be noted that the existence of separate adaptors doesn't
24817ca54c3Smrg    necessarily imply that simultaneous operation is supported.
24917ca54c3Smrg
25017ca54c3Smrg
25117ca54c3Smrg
25217ca54c3Smrg  Errors
25317ca54c3Smrg  ------
25417ca54c3Smrg
25517ca54c3Smrg    Port
25617ca54c3Smrg
25717ca54c3Smrg    A Port error is returned if any request names a PORT that does not
25817ca54c3Smrg    exist.
25917ca54c3Smrg
26017ca54c3Smrg
26117ca54c3Smrg    Encoding
26217ca54c3Smrg
26317ca54c3Smrg    An Encoding error is returned if any request names an ENCODINGID
26417ca54c3Smrg    that does not exist.
26517ca54c3Smrg
26617ca54c3Smrg
26717ca54c3Smrg
26817ca54c3Smrg
26917ca54c3Smrg  Query Requests
27017ca54c3Smrg  -------------------
27117ca54c3Smrg
27217ca54c3Smrg    QueryExtension
27317ca54c3Smrg    ==>
27417ca54c3Smrg      version: CARD16
27517ca54c3Smrg      revision: CARD16
27617ca54c3Smrg
27717ca54c3Smrg    The QueryExtension request returns the extension version and
27817ca54c3Smrg    revision numbers.
27917ca54c3Smrg
28017ca54c3Smrg
28117ca54c3Smrg    QueryAdaptors
28217ca54c3Smrg      win: WINDOW
28317ca54c3Smrg    ==>
28417ca54c3Smrg      adaptors: LISTofADAPTORINFO
28517ca54c3Smrg
28617ca54c3Smrg    The QueryAdaptors request returns the video adaptor information for
28717ca54c3Smrg    the screen of the specified window.
28817ca54c3Smrg
28917ca54c3Smrg    Errors: {Window}
29017ca54c3Smrg
29117ca54c3Smrg
29217ca54c3Smrg    QueryEncodings
29317ca54c3Smrg      port: PORT
29417ca54c3Smrg    ==>
29517ca54c3Smrg      encodings: LISTofENCODINGINFO
29617ca54c3Smrg
29717ca54c3Smrg    The QueryEncodings request returns the list of encodings supported
29817ca54c3Smrg    by the port adaptor.  Use the SetPortAttribute request to set
29917ca54c3Smrg    which encoding a port is to process.  The ENCODINGINFO record
30017ca54c3Smrg    describes an encoding:
30117ca54c3Smrg
30217ca54c3Smrg    ENCODINGINFO:
30317ca54c3Smrg  	[encoding: ENCODINGID
30417ca54c3Smrg  	 name: STRING
30517ca54c3Smrg  	 width, height: CARD16
30617ca54c3Smrg  	 rate: FRACTION]
30717ca54c3Smrg
30817ca54c3Smrg    The `encoding' field identifies an encoding supported by a port.
30917ca54c3Smrg    Its value is unique for a screen.  Width and height specify the
31017ca54c3Smrg    size of the video image and rate specifies the rate at which
31117ca54c3Smrg    fields of image information are encoded.
31217ca54c3Smrg
31317ca54c3Smrg    An encoding is identified by a string that names the encoding.
31417ca54c3Smrg    Encoding naming conventions need to be established (i.e.,
31517ca54c3Smrg    something along the lines of font naming, but simpler)
31617ca54c3Smrg
31717ca54c3Smrg    FRACTION
31817ca54c3Smrg          [numerator, denominator: INT32]
31917ca54c3Smrg
32017ca54c3Smrg    The FRACTION structure is used to specify a fractional number.
32117ca54c3Smrg
32217ca54c3Smrg    Errors: {Port}
32317ca54c3Smrg
32417ca54c3Smrg
32517ca54c3Smrg
32617ca54c3Smrg  Put Video Requests
32717ca54c3Smrg  ------------------
32817ca54c3Smrg
32917ca54c3Smrg    PutVideo
33017ca54c3Smrg      port: PORT
33117ca54c3Smrg      drawable: DRAWABLE
33217ca54c3Smrg      gc: GCONTEXT
33317ca54c3Smrg      vid-x, vid-y: INT16
33417ca54c3Smrg      vid-w, vid-h: CARD16
33517ca54c3Smrg      drw-x, drw-y: INT16
33617ca54c3Smrg      drw-w, drw-h: CARD16
33717ca54c3Smrg
33817ca54c3Smrg    The PutVideo request writes video into a drawable.  The position
33917ca54c3Smrg    and size of the source rectangle is specified by vid-x, vid-y,
34017ca54c3Smrg    vid-w, and vid-h.  The position and size of the destination
34117ca54c3Smrg    rectangle is specified by drw-x, drw-y, drw-w, drw-h.
34217ca54c3Smrg
34317ca54c3Smrg    Video data is clipped to the bounds of the video encoding, scaled
34417ca54c3Smrg    to the requested drawable region size (or the closest size
34517ca54c3Smrg    supported), and clipped to the bounds of the drawable.
34617ca54c3Smrg
34717ca54c3Smrg    If video is successfully initiated, a VideoNotify event with
34817ca54c3Smrg    detail Started is generated for the drawable.  If the port is
34917ca54c3Smrg    already in use, its video is preempted, and if the new drawable is
35017ca54c3Smrg    different than the old, a VideoNotify event with detail Preempted
35117ca54c3Smrg    is generated for the old drawable.  If the port is grabbed by
35217ca54c3Smrg    another client, this request is ignored, and a VideoNotify event
35317ca54c3Smrg    with detail Busy is generated for the drawable.  If the port is
35417ca54c3Smrg    not receiving a valid video signal or if the video signal is
35517ca54c3Smrg    interrupted while video is active a VideoNotify event with detail
35617ca54c3Smrg    HardError is generated for the drawable.
35717ca54c3Smrg
35817ca54c3Smrg    GC components: subwindow-mode, clip-x-origin, clip-y-origin, clip-mask.
35917ca54c3Smrg
36017ca54c3Smrg    Errors: {Match, Value, GContext, Port, Alloc}
36117ca54c3Smrg
36217ca54c3Smrg
36317ca54c3Smrg    PutStill
36417ca54c3Smrg      port: PORT
36517ca54c3Smrg      drawable: DRAWABLE
36617ca54c3Smrg      gc: GCONTEXT
36717ca54c3Smrg      vid-x, vid-y: INT16
36817ca54c3Smrg      vid-w, vid-h: CARD16
36917ca54c3Smrg      drw-x, drw-y: INT16
37017ca54c3Smrg      drw-w, drw-h: CARD16
37117ca54c3Smrg
37217ca54c3Smrg    The PutStill request writes a single frame of video into a
37317ca54c3Smrg    drawable.  The position and size of the source rectangle is
37417ca54c3Smrg    specified by vid-x, vid-y, vid-w, and vid-h.  The position and
37517ca54c3Smrg    size of the destination rectangle is specified by drw-x, drw-y,
37617ca54c3Smrg    drw-w, drw-h.
37717ca54c3Smrg
37817ca54c3Smrg    Video data is clipped to the bounds of the video encoding, scaled
37917ca54c3Smrg    to the requested drawable region size (or the closest size
38017ca54c3Smrg    supported) and clipped to the bounds of the drawable.
38117ca54c3Smrg
38217ca54c3Smrg    If the port is grabbed by another client, this request is ignored,
38317ca54c3Smrg    and a VideoNotify event with detail Busy is generated for the
38417ca54c3Smrg    drawable.  If the port is not receiving a valid video signal a
38517ca54c3Smrg    VideoNotify event with detail HardError is generated for the
38617ca54c3Smrg    drawable.
38717ca54c3Smrg
38817ca54c3Smrg    GC components: subwindow-mode, clip-x-origin, clip-y-origin, clip-mask.
38917ca54c3Smrg
39017ca54c3Smrg    Errors: {Match, Value, GContext, Port, Alloc}
39117ca54c3Smrg
39217ca54c3Smrg  
39317ca54c3Smrg
39417ca54c3Smrg  Get Video Requests
39517ca54c3Smrg  ------------------
39617ca54c3Smrg
39717ca54c3Smrg    GetVideo
39817ca54c3Smrg      port: PORT
39917ca54c3Smrg      drawable: DRAWABLE
40017ca54c3Smrg      gc: GCONTEXT
40117ca54c3Smrg      vid-x, vid-y: INT16
40217ca54c3Smrg      vid-w, vid-h: CARD16
40317ca54c3Smrg      drw-x, drw-y: INT16
40417ca54c3Smrg      drw-w, drw-h: CARD16
40517ca54c3Smrg
40617ca54c3Smrg    The GetVideo request outputs video from a drawable.  The position
40717ca54c3Smrg    and size of the destination rectangle is specified by vid-x,
40817ca54c3Smrg    vid-y, vid-w, and vid-h.  The position and size of the source
40917ca54c3Smrg    rectangle is specified by drw-x, drw-y, drw-w, and drw-h.
41017ca54c3Smrg
41117ca54c3Smrg    Drawable data is clipped to the bounds of the drawable, scaled to
41217ca54c3Smrg    the requested video region size (or the closest size supported)
41317ca54c3Smrg    and clipped to the bounds of the video encoding.  The contents of
41417ca54c3Smrg    any region not updated with drawable data is undefined.
41517ca54c3Smrg
41617ca54c3Smrg    If video is successfully initiated, a VideoNotify event with
41717ca54c3Smrg    detail Started is generated for the drawable.  If the port is
41817ca54c3Smrg    already in use, its video is preempted, and if the new drawable is
41917ca54c3Smrg    different than the old, a VideoNotify event with detail Preempted
42017ca54c3Smrg    is generated for the old drawable.  If the port is grabbed by
42117ca54c3Smrg    another client, this request is ignored, and a VideoNotify event
42217ca54c3Smrg    with detail Busy is generated for the drawable.
42317ca54c3Smrg
42417ca54c3Smrg    GC components: subwindow-mode, clip-x-origin, clip-y-origin,
42517ca54c3Smrg    clip-mask.
42617ca54c3Smrg
42717ca54c3Smrg    Errors: {Match, Value, GContext, Port, Alloc}
42817ca54c3Smrg
42917ca54c3Smrg
43017ca54c3Smrg    GetStill
43117ca54c3Smrg      port: PORT
43217ca54c3Smrg      drawable: DRAWABLE
43317ca54c3Smrg      gc: GCONTEXT
43417ca54c3Smrg      vid-x, vid-y: INT16
43517ca54c3Smrg      vid-w, vid-h: CARD16
43617ca54c3Smrg      drw-x, drw-y: INT16
43717ca54c3Smrg      drw-w, drw-h: CARD16
43817ca54c3Smrg
43917ca54c3Smrg    The GetStill request outputs video from a drawable.  The position
44017ca54c3Smrg    and size of the destination rectangle is specified by vid-x,
44117ca54c3Smrg    vid-y, vid-w, and vid-h.  The position and size of the source
44217ca54c3Smrg    rectangle is specified by drw-x, drw-y, drw-w, and drw-h.
44317ca54c3Smrg
44417ca54c3Smrg    Drawable data is clipped to the bounds of the drawable, scaled to
44517ca54c3Smrg    the requested video region size (or the closest size supported)
44617ca54c3Smrg    and clipped to the bounds of the video encoding.  The contents of
44717ca54c3Smrg    any region not updated with drawable data is undefined.
44817ca54c3Smrg
44917ca54c3Smrg    If the still is successfully captured a VideoNotify event with
45017ca54c3Smrg    detail Still is generated for the drawable.  If the port is
45117ca54c3Smrg    grabbed by another client, this request is ignored, and a
45217ca54c3Smrg    VideoNotify event with detail Busy is generated for the drawable.
45317ca54c3Smrg
45417ca54c3Smrg    GC components: subwindow-mode, clip-x-origin, clip-y-origin,
45517ca54c3Smrg    clip-mask.
45617ca54c3Smrg
45717ca54c3Smrg    Errors: {Match, Value, GContext, Port, Alloc}
45817ca54c3Smrg
45917ca54c3Smrg
46017ca54c3Smrg  
46117ca54c3Smrg
46217ca54c3Smrg  Grab Requests
46317ca54c3Smrg  -------------
46417ca54c3Smrg
46517ca54c3Smrg    GrabPort
46617ca54c3Smrg      port: PORT
46717ca54c3Smrg      timestamp: {TIMESTAMP, CurrentTime}
46817ca54c3Smrg    ==>
46917ca54c3Smrg      status: {Success, AlreadyGrabbed, InvalidTime}
47017ca54c3Smrg
47117ca54c3Smrg    The GrabPort request grabs a port.  While a port is grabbed, only
47217ca54c3Smrg    video requests from the grabbing client are permitted.
47317ca54c3Smrg
47417ca54c3Smrg    If timestamp specifies a time older than the current port time, a
47517ca54c3Smrg    status of InvalidTime is returned.  If the port is already grabbed
47617ca54c3Smrg    by another client, a status of AlreadyGrabbed is returned.
47717ca54c3Smrg    Otherwise a status of Success is returned. The port time is
47817ca54c3Smrg    updated when the following requests are processed: GrabPort,
47917ca54c3Smrg    UngrabPort, PutVideo, PutStill, GetVideo, GetStill
48017ca54c3Smrg
48117ca54c3Smrg    If the port is actively processing video for another client, the
48217ca54c3Smrg    video is preempted, and an VideoNotify event with detail Preempted
48317ca54c3Smrg    is generated for its drawable.
48417ca54c3Smrg
48517ca54c3Smrg    Errors: {Port}
48617ca54c3Smrg
48717ca54c3Smrg
48817ca54c3Smrg    UngrabPort
48917ca54c3Smrg      port: PORT
49017ca54c3Smrg      timestamp: {TIMESTAMP, CurrentTime}
49117ca54c3Smrg
49217ca54c3Smrg    The UngrabPort request ungrabs a port.  If timestamp specifies a
49317ca54c3Smrg    time before the last connection request time of this port, the
49417ca54c3Smrg    request is ignored.
49517ca54c3Smrg
49617ca54c3Smrg    Errors: {Port}
49717ca54c3Smrg
49817ca54c3Smrg
49917ca54c3Smrg
50017ca54c3Smrg  Other Requests
50117ca54c3Smrg  --------------
50217ca54c3Smrg
50317ca54c3Smrg    StopVideo
50417ca54c3Smrg      port: PORT
50517ca54c3Smrg      drawable: DRAWABLE
50617ca54c3Smrg
50717ca54c3Smrg    The StopVideo request stops active video for the specified port
50817ca54c3Smrg    and drawable.  If the port isn't processing video, or if it is
50917ca54c3Smrg    processing video in a different drawable, the request is ignored.
51017ca54c3Smrg    When video is stopped a VideoNotify event with detail Stopped is
51117ca54c3Smrg    generated for the associated drawable.
51217ca54c3Smrg
51317ca54c3Smrg    Errors: {Drawable, Port}
51417ca54c3Smrg
51517ca54c3Smrg
51617ca54c3Smrg    SelectVideoNotify
51717ca54c3Smrg      drawable: DRAWABLE
51817ca54c3Smrg      onoff: BOOL
51917ca54c3Smrg
52017ca54c3Smrg    The SelectVideoNotify request enables or disables VideoNotify
52117ca54c3Smrg    event delivery to the requesting client.  VideoNotify events are
52217ca54c3Smrg    generated when video starts and stops.
52317ca54c3Smrg
52417ca54c3Smrg    Errors: {Drawable}
52517ca54c3Smrg
52617ca54c3Smrg
52717ca54c3Smrg    SelectPortNotify
52817ca54c3Smrg      port: PORT
52917ca54c3Smrg      onoff: BOOL
53017ca54c3Smrg
53117ca54c3Smrg    The SelectPortNotify request enables or disables PortNotify event
53217ca54c3Smrg    delivery to the requesting client.  PortNotify events are
53317ca54c3Smrg    generated when port attributes are changed using SetPortAttribute.
53417ca54c3Smrg
53517ca54c3Smrg    Errors: {Port}
53617ca54c3Smrg
53717ca54c3Smrg
53817ca54c3Smrg    QueryBestSize
53917ca54c3Smrg      port: PORT
54017ca54c3Smrg      motion: BOOL
54117ca54c3Smrg      vid-w, vid-h: CARD16
54217ca54c3Smrg      drw-w, drw-h: CARD16
54317ca54c3Smrg    ==>
54417ca54c3Smrg      actual-width, actual-height: CARD16
54517ca54c3Smrg
54617ca54c3Smrg    The QueryBestSize request returns, for the given source size and
54717ca54c3Smrg    desired destination size, the closest destination size that the
54817ca54c3Smrg    port adaptor supports.  The returned size will be equal
54917ca54c3Smrg    or smaller than the requested size if one is supported.  If motion
55017ca54c3Smrg    is True then the requested size is intended for use with full
55117ca54c3Smrg    motion video.  If motion is False, the requested size is intended
55217ca54c3Smrg    for use with stills only.
55317ca54c3Smrg
554d63b911fSmrg    The returned size is also chosen to maintain the requested aspect ratio
55517ca54c3Smrg    if possible.
55617ca54c3Smrg
55717ca54c3Smrg    Errors: {Port}
55817ca54c3Smrg
55917ca54c3Smrg
56017ca54c3Smrg
56117ca54c3Smrg    SetPortAttribute
56217ca54c3Smrg      port: PORT
56317ca54c3Smrg      attribute: ATOM
56417ca54c3Smrg      value: INT32
56517ca54c3Smrg
56617ca54c3Smrg    The SetPortAttribute request sets the value of a port attribute.
56717ca54c3Smrg    The port attribute is identified by the attribute atom.  The
56817ca54c3Smrg    following strings are guaranteed to generate valid atoms using the
56917ca54c3Smrg    InternAtom request.
57017ca54c3Smrg
57117ca54c3Smrg    String                Type
57217ca54c3Smrg    -----------------------------------------------------------------
57317ca54c3Smrg
57417ca54c3Smrg    "XV_ENCODING"         ENCODINGID
57517ca54c3Smrg    "XV_HUE"	          [-1000..1000]
57617ca54c3Smrg    "XV_SATURATION"       [-1000..1000]
57717ca54c3Smrg    "XV_BRIGHTNESS"       [-1000..1000]
57817ca54c3Smrg    "XV_CONTRAST"         [-1000..1000]
57917ca54c3Smrg
58017ca54c3Smrg
58117ca54c3Smrg    If the given attribute doesn't match an attribute supported by the
58217ca54c3Smrg    port adaptor a Match error is generated.  The supplied encoding
58317ca54c3Smrg    must be one of the encodings listed for the adaptor, otherwise an
58417ca54c3Smrg    Encoding error is generated.
58517ca54c3Smrg
58617ca54c3Smrg    If the adaptor doesn't support the exact hue, saturation,
58717ca54c3Smrg    brightness, and contrast levels supplied, the closest levels
58817ca54c3Smrg    supported are assumed.  The GetPortAttribute request can be used
58917ca54c3Smrg    to query the resulting levels.
59017ca54c3Smrg
59117ca54c3Smrg    When a SetPortAttribute request is processed a PortNotify event is
59217ca54c3Smrg    generated for all clients that have requested port change
59317ca54c3Smrg    notification using SelectPortNotify.
59417ca54c3Smrg
59517ca54c3Smrg    Errors: {Port, Match, Value}
59617ca54c3Smrg
59717ca54c3Smrg
59817ca54c3Smrg    GetPortAttribute
59917ca54c3Smrg      port: PORT
60017ca54c3Smrg      attribute: ATOM
60117ca54c3Smrg    ==>
60217ca54c3Smrg      value: INT32
60317ca54c3Smrg
60417ca54c3Smrg
60517ca54c3Smrg    The GetPortAttribute request returns the current value of the
60617ca54c3Smrg    attribute identified by the given atom.  If the given atom
60717ca54c3Smrg    doesn't match an attribute supported by the adaptor a Match
60817ca54c3Smrg    error is generated.
60917ca54c3Smrg
61017ca54c3Smrg    Errors: {Port, Match}
61117ca54c3Smrg
61217ca54c3Smrg
61317ca54c3Smrg
61417ca54c3Smrg  Events
61517ca54c3Smrg  ------
61617ca54c3Smrg
61717ca54c3Smrg    VideoNotify
61817ca54c3Smrg      drawable: DRAWABLE
61917ca54c3Smrg      port: PORT
62017ca54c3Smrg      reason: REASON
62117ca54c3Smrg      time: TIMESTAMP
62217ca54c3Smrg
62317ca54c3Smrg    REASON: {Started, Still, Stopped, Busy, Preempted, HardError}
62417ca54c3Smrg
62517ca54c3Smrg    A VideoNotify event is generated when video activity is started,
62617ca54c3Smrg    stopped, or unable to proceed in a drawable.
62717ca54c3Smrg
62817ca54c3Smrg    A Started reason is generated when video starts in a drawable.
62917ca54c3Smrg
63017ca54c3Smrg    A Stopped reason is generated when video is stopped in a
63117ca54c3Smrg    drawable upon request.
63217ca54c3Smrg
63317ca54c3Smrg    A Busy reason is generated when a put or get request cannot
63417ca54c3Smrg    proceed because the port is grabbed by another client.
63517ca54c3Smrg
63617ca54c3Smrg    A Preempted reason is generated when video is stopped by a
63717ca54c3Smrg    conflicting request.
63817ca54c3Smrg
63917ca54c3Smrg    A HardError reason is generated when the video port cannot
64017ca54c3Smrg    initiate or continue processing a video request because of an
64117ca54c3Smrg    underlying transmission or reception error.
64217ca54c3Smrg
64317ca54c3Smrg
64417ca54c3Smrg    PortNotify
64517ca54c3Smrg      port: PORT
64617ca54c3Smrg      attribute: ATOM
64717ca54c3Smrg      value: INT32
64817ca54c3Smrg      time: TIMESTAMP
64917ca54c3Smrg
65017ca54c3Smrg    The PortNotify event is generated when a SetPortAttribute request
65117ca54c3Smrg    is processed.  The event is delivered to all clients that have
65217ca54c3Smrg    performed a SelectPortNotify request for the port.  The event
65317ca54c3Smrg    contains the atom identifying the attribute that changed, and the
65417ca54c3Smrg    new value of that attribute.
655