Blame XvMC_API.txt

Packit 5efe5e
Packit 5efe5e
   X-Video Motion Compensation - API specification v. 1.0
Packit 5efe5e
Packit 5efe5e
   Mark Vojkovich <markv@xfree86.org>
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/* history */
Packit 5efe5e
Packit 5efe5e
   first draft (9/6/00)
Packit 5efe5e
   second draft (10/31/00) - Changed to allow acceleration at both
Packit 5efe5e
      the motion compensation and IDCT level.
Packit 5efe5e
   third draft (1/21/01) - Some refinements and subpicture support.
Packit 5efe5e
   fourth draft (5/2/01) - Dual Prime clarification, add
Packit 5efe5e
      XvMCSetAttribute.
Packit 5efe5e
   fifth draft (6/26/01) - Change definition of XvMCCompositeSubpicture
Packit 5efe5e
      plus some clarifications and fixed typographical errors.
Packit 5efe5e
   sixth draft (9/24/01) - Added XVMC_SECOND_FIELD and removed
Packit 5efe5e
      XVMC_PROGRESSIVE_FRAME and XVMC_TOP_FIELD_FIRST flags.
Packit 5efe5e
   seventh draft (10/26/01) - Added XVMC_INTRA_UNSIGNED option.
Packit 5efe5e
   eighth draft (11/13/02) - Removed IQ level acceleration and
Packit 5efe5e
      changed some structures to remove unused fields.
Packit 5efe5e
Packit 5efe5e
/* acknowledgements */
Packit 5efe5e
Packit 5efe5e
   Thanks to Matthew J. Sottek from Intel for lots of input.
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
      OVERVIEW
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
     XvMC extends the X-Video extension (Xv) and makes use of the
Packit 5efe5e
  familar concept of the XvPort.  Ports have attributes that can be set
Packit 5efe5e
  and queried through Xv.  In XvMC ports can also have hardware motion
Packit 5efe5e
  compensation contexts created for use with them.  Ports which support
Packit 5efe5e
  XvImages (ie. they have an "XV_IMAGE" port encoding as described in
Packit 5efe5e
  the Xv version 2.2 API addendum) can be queried for the list of XvMCSurface
Packit 5efe5e
  types they support.  If they support any XvMCSurface types an
Packit 5efe5e
  XvMCContext can be created for that port.
Packit 5efe5e
Packit 5efe5e
     An XvMCContext describes the state of the motion compensation
Packit 5efe5e
  pipeline.  An individual XvMCContext can be created for use with
Packit 5efe5e
  a single port, surface type, motion compensation type, width and
Packit 5efe5e
  height combination.  For example, a context might be created for a
Packit 5efe5e
  particular port that does MPEG-2 motion compensation on 720 x 480
Packit 5efe5e
  4:2:0 surfaces.  Once the context is created, referencing it implies
Packit 5efe5e
  the port, surface type, size and the motion compensation type.  Contexts
Packit 5efe5e
  may be "direct" or "indirect".  For indirect contexts the X server
Packit 5efe5e
  renders all video using the data passed to it by the client.  For
Packit 5efe5e
  direct contexts the client libraries render the video with little
Packit 5efe5e
  or no interaction with the X server.
Packit 5efe5e
Packit 5efe5e
     XvMCSurfaces are buffers into which the motion compensation
Packit 5efe5e
  hardware can render.  The data in the buffers themselves are not client
Packit 5efe5e
  accessible and may be stored in a hardware-specific format.  Any
Packit 5efe5e
  number of buffers can be created for use with a particular context
Packit 5efe5e
  (resources permitting).
Packit 5efe5e
Packit 5efe5e
     XvMC provides video acceleration starting at one of two places
Packit 5efe5e
  in the video pipeline.  Acceleration starting at the first point,
Packit 5efe5e
  which we shall call the "Motion Compensation" level, begins after the
Packit 5efe5e
  the inverse quantization and IDCT at the place where motion compensation
Packit 5efe5e
  is to be applied.  The second point, which we shall call the "IDCT"
Packit 5efe5e
  level, begins before the IDCT just after the inverse quantization.
Packit 5efe5e
Packit 5efe5e
     Rendering is done by presenting the library with a target XvMCSurface
Packit 5efe5e
  and up to two reference XvMCSurfaces for the motion compensation, a
Packit 5efe5e
  buffer of 8x8 blocks and a command buffer which describes how to
Packit 5efe5e
  use the 8x8 blocks along with motion compensation vectors to construct
Packit 5efe5e
  the data in the target XvMCSurface.  When the pipeline starts at the
Packit 5efe5e
  IDCT level, Xv will perform the IDCT on the blocks before performing
Packit 5efe5e
  the motion compensation. A function is provided to copy/overlay a
Packit 5efe5e
  portion of the XvMCSurface to a drawable with arbitrary scaling.
Packit 5efe5e
Packit 5efe5e
    XvMCSubpictures are separate surfaces that may be blended with the
Packit 5efe5e
  target surface.  Any number of XvMCSubpictures may be created for use
Packit 5efe5e
  with a context (resources permitting).  Both "backend" and "frontend"
Packit 5efe5e
  subpicture behavior are supported.
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
          QUERYING THE EXTENSION
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
/* Errors */
Packit 5efe5e
#define XvMCBadContext		0
Packit 5efe5e
#define XvMCBadSurface		1
Packit 5efe5e
#define XvMCBadSubpicture	2
Packit 5efe5e
Packit 5efe5e
Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase)
Packit 5efe5e
Packit 5efe5e
   Returns True if the extension exists, False otherwise.  Also returns
Packit 5efe5e
 the error and event bases.
Packit 5efe5e
Packit 5efe5e
   display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
   eventBase -
Packit 5efe5e
   errBase -  The returned event and error bases.  Currently there
Packit 5efe5e
              are no events defined.
Packit 5efe5e
Packit 5efe5e
Status XvMCQueryVersion (Display *display, int *major, int *minor)
Packit 5efe5e
Packit 5efe5e
   Query the major and minor version numbers of the extension.
Packit 5efe5e
Packit 5efe5e
   display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
   major -
Packit 5efe5e
   minor -  The returned major and minor version numbers.
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
          QUERYING SURFACE TYPES
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
/* Chroma formats */
Packit 5efe5e
#define XVMC_CHROMA_FORMAT_420		0x00000001
Packit 5efe5e
#define XVMC_CHROMA_FORMAT_422		0x00000002
Packit 5efe5e
#define XVMC_CHROMA_FORMAT_444		0x00000003
Packit 5efe5e
Packit 5efe5e
/* XvMCSurfaceInfo Flags */
Packit 5efe5e
#define XVMC_OVERLAID_SURFACE			0x00000001
Packit 5efe5e
#define XVMC_BACKEND_SUBPICTURE			0x00000002
Packit 5efe5e
#define XVMC_SUBPICTURE_INDEPENDENT_SCALING	0x00000004
Packit 5efe5e
#define XVMC_INTRA_UNSIGNED                     0x00000008
Packit 5efe5e
Packit 5efe5e
/* Motion Compensation types */
Packit 5efe5e
#define XVMC_MOCOMP			0x00000000
Packit 5efe5e
#define XVMC_IDCT			0x00010000
Packit 5efe5e
Packit 5efe5e
#define	XVMC_MPEG_1			0x00000001
Packit 5efe5e
#define XVMC_MPEG_2			0x00000002
Packit 5efe5e
#define XVMC_H263			0x00000003
Packit 5efe5e
#define XVMC_MPEG_4			0x00000004
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
   int surface_type_id;
Packit 5efe5e
   int chroma_format;
Packit 5efe5e
   unsigned short max_width;
Packit 5efe5e
   unsigned short max_height;
Packit 5efe5e
   unsigned short subpicture_max_width;
Packit 5efe5e
   unsigned short subpicture_max_height;
Packit 5efe5e
   int mc_type;
Packit 5efe5e
   int flags;
Packit 5efe5e
} XvMCSurfaceInfo;
Packit 5efe5e
Packit 5efe5e
   surface_type_id - Unique descriptor for this surface type.
Packit 5efe5e
Packit 5efe5e
   chroma_format - Chroma format of this surface (eg. XVMC_CHROMA_FORMAT_420,
Packit 5efe5e
		XVMC_CHROMA_FORMAT_422, XVMC_CHROMA_FORMAT_444).
Packit 5efe5e
Packit 5efe5e
   max_width -
Packit 5efe5e
   max_height -  Maximum dimensions of the luma data in pixels.
Packit 5efe5e
Packit 5efe5e
   subpicture_max_width -
Packit 5efe5e
   subpicture_max_height -  The Maximum dimensions of the subpicture
Packit 5efe5e
                            that can be created for use with this surface
Packit 5efe5e
                            Both fields are zero if subpictures are not
Packit 5efe5e
                            supported.
Packit 5efe5e
Packit 5efe5e
   mc_type -  The type of motion compensation available for this
Packit 5efe5e
              surface.  This consists of XVMC_MPEG_1, XVMC_MPEG_2, XVMC_H263
Packit 5efe5e
              or XVMC_MPEG_4 OR'd together with any of the following:
Packit 5efe5e
Packit 5efe5e
                 XVMC_MOCOMP - Acceleration starts at the motion compensation
Packit 5efe5e
                               level;
Packit 5efe5e
Packit 5efe5e
                 XVMC_IDCT - Acceleration starts at the IDCT level.
Packit 5efe5e
Packit 5efe5e
   flags -  Any combination of the following may be OR'd together.
Packit 5efe5e
Packit 5efe5e
	XVMC_OVERLAID_SURFACE - Displayed data is overlaid and not
Packit 5efe5e
	                        physically in the visible framebuffer.
Packit 5efe5e
                                When this is set the client is responsible
Packit 5efe5e
                                for painting the colorkey.
Packit 5efe5e
Packit 5efe5e
	XVMC_BACKEND_SUBPICTURE - The supicture is of the "backend"
Packit 5efe5e
                                  variety.  It is "frontend" otherwise.
Packit 5efe5e
                                  There is more information on this in the
Packit 5efe5e
                                  section on subpictures below.
Packit 5efe5e
Packit 5efe5e
	XVMC_SUBPICTURE_INDEPENDENT_SCALING - The subpicture can be scaled
Packit 5efe5e
                                              independently of the video
Packit 5efe5e
                                              surface.  See the section on
Packit 5efe5e
                                              subpictures below.
Packit 5efe5e
Packit 5efe5e
        XVMC_INTRA_UNSIGNED - When this flag is set, the motion compenstation
Packit 5efe5e
                              level Intra macroblock data should be in an
Packit 5efe5e
                              unsigned format rather than the signed format
Packit 5efe5e
                              present in the mpeg stream.  This flag applies
Packit 5efe5e
                              only to motion compensation level acceleration.
Packit 5efe5e
Packit 5efe5e
XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num)
Packit 5efe5e
Packit 5efe5e
   Returns the number of surface types supported by the XvPort and an array
Packit 5efe5e
   of XvMCSurfaceInfo describing each surface type.  The returned array
Packit 5efe5e
   should be freed with XFree().
Packit 5efe5e
Packit 5efe5e
   dpy -  The connection to the server.
Packit 5efe5e
Packit 5efe5e
   port - The port we want to get the XvMCSurfaceInfo array for.
Packit 5efe5e
Packit 5efe5e
   num  - The number of elements returned in the array.
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
      XvBadPort -  The requested port does not exist.
Packit 5efe5e
Packit 5efe5e
      BadAlloc - There are insufficient resources to complete this request.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
          CREATING A CONTEXT
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
/* XvMCContext flags */
Packit 5efe5e
#define XVMC_DIRECT			0x00000001
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
   XID context_id;
Packit 5efe5e
   int surface_type_id;
Packit 5efe5e
   unsigned short width;
Packit 5efe5e
   unsigned short height;
Packit 5efe5e
   XVPortID port;
Packit 5efe5e
   int flags;
Packit 5efe5e
   void * privData;  /* private to the library */
Packit 5efe5e
} XvMCContext;
Packit 5efe5e
Packit 5efe5e
   context_id - An XID associated with the context.
Packit 5efe5e
Packit 5efe5e
   surface_type_id - This refers to the XvMCSurfaceInfo that describes
Packit 5efe5e
                     the surface characteristics.
Packit 5efe5e
Packit 5efe5e
   width -
Packit 5efe5e
   height -  The dimensions (of the luma data) this context supports.
Packit 5efe5e
Packit 5efe5e
   port -  The port that this context supports.
Packit 5efe5e
Packit 5efe5e
   flags -  Any combination may be OR'd together.
Packit 5efe5e
Packit 5efe5e
	XVMC_DIRECT -  This context is direct rendered.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status XvMCCreateContext (
Packit 5efe5e
   Display display,
Packit 5efe5e
   XVPortID port,
Packit 5efe5e
   int surface_type_id,
Packit 5efe5e
   int width,
Packit 5efe5e
   int height,
Packit 5efe5e
   int flags,
Packit 5efe5e
   XvMCContext * context
Packit 5efe5e
);
Packit 5efe5e
Packit 5efe5e
   This creates a context by filling out the XvMCContext structure passed
Packit 5efe5e
   to it and returning Success.
Packit 5efe5e
Packit 5efe5e
   display -  Specifies the connection to the server.
Packit 5efe5e
Packit 5efe5e
   port -  Specifies the port to create the context for.
Packit 5efe5e
Packit 5efe5e
   surface_type_id -
Packit 5efe5e
   width -
Packit 5efe5e
   height -  Specifies the surface type and dimensions that this
Packit 5efe5e
             context will be used for.  The surface_type_id corresponds
Packit 5efe5e
             to the surface_type_id referenced by the XvMCSurfaceInfo.
Packit 5efe5e
	     The surface returned may be larger than the surface requested
Packit 5efe5e
             (usually the next larger multiple of 16x16 pixels).
Packit 5efe5e
Packit 5efe5e
   flags -  Any of the following may by OR'd together:
Packit 5efe5e
Packit 5efe5e
	 XVMC_DIRECT -  A direct context is requested.
Packit 5efe5e
                        If a direct context cannot be created the request
Packit 5efe5e
                        will not fail, rather, an indirect context will
Packit 5efe5e
			be created instead.
Packit 5efe5e
Packit 5efe5e
   context - Pointer to the pre-allocated XvMCContext structure.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
      XvBadPort -  The requested port does not exist.
Packit 5efe5e
Packit 5efe5e
      BadValue -  The dimensions requested are not supported by the
Packit 5efe5e
                  surface type.
Packit 5efe5e
Packit 5efe5e
      BadMatch -  The surface_type_id is not supported by the port.
Packit 5efe5e
Packit 5efe5e
      BadAlloc -  There are not sufficient resources to fulfill this
Packit 5efe5e
                  request.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status XvMCDestroyContext (Display display, XvMCContext * context)
Packit 5efe5e
Packit 5efe5e
     Destroys the specified context.
Packit 5efe5e
Packit 5efe5e
      display - Specifies the connection to the server.
Packit 5efe5e
Packit 5efe5e
      context - The context to be destroyed.
Packit 5efe5e
Packit 5efe5e
     Errors:
Packit 5efe5e
Packit 5efe5e
       XvMCBadContext - The XvMCContext is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/*********************************************************************/
Packit 5efe5e
Packit 5efe5e
          SURFACE CREATION
Packit 5efe5e
Packit 5efe5e
/*********************************************************************/
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
  XID surface_id;
Packit 5efe5e
  XID context_id;
Packit 5efe5e
  int surface_type_id;
Packit 5efe5e
  unsigned short width;
Packit 5efe5e
  unsigned short height;
Packit 5efe5e
  void *privData;  /* private to the library */
Packit 5efe5e
} XvMCSurface;
Packit 5efe5e
Packit 5efe5e
  surface_id -  An XID associated with the surface.
Packit 5efe5e
Packit 5efe5e
  context_id -  The XID of the context for which the surface was created.
Packit 5efe5e
Packit 5efe5e
  surface_type_id - Derived from the context_id, it specifies the
Packit 5efe5e
                    XvMCSurfaceInfo describing the surface.
Packit 5efe5e
Packit 5efe5e
  width -
Packit 5efe5e
  height -  The width and height of the luma data.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCCreateSurface(
Packit 5efe5e
  Display *display,
Packit 5efe5e
  XvMCContext * context;
Packit 5efe5e
  XvMCSurface * surface;
Packit 5efe5e
);
Packit 5efe5e
Packit 5efe5e
     Creates a surface (Frame) for use with the specified context.
Packit 5efe5e
   The surface structure is filled out and Success is returned if no
Packit 5efe5e
   error occured.
Packit 5efe5e
Packit 5efe5e
   context - pointer to a valid context.  The context implies
Packit 5efe5e
             the surface type to be created, and its dimensions.
Packit 5efe5e
Packit 5efe5e
   surface - pointer to a pre-allocated XvMCSurface structure.
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
	XvMCBadContext - the context is not valid.
Packit 5efe5e
Packit 5efe5e
        BadAlloc - there are insufficient resources to complete
Packit 5efe5e
                   this operation.
Packit 5efe5e
Packit 5efe5e
Status XvMCDestroySurface(Display *display, XvMCSurface *surface);
Packit 5efe5e
Packit 5efe5e
   Destroys the given surface.
Packit 5efe5e
Packit 5efe5e
    display - Specifies the connection to the server.
Packit 5efe5e
Packit 5efe5e
    surface - The surface to be destroyed.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
       XvMCBadSurface - The XvMCSurface is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/*********************************************************************/
Packit 5efe5e
Packit 5efe5e
    RENDERING A FRAME
Packit 5efe5e
Packit 5efe5e
/*********************************************************************/
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
  XID context_id;
Packit 5efe5e
  unsigned int num_blocks;
Packit 5efe5e
  short *blocks;
Packit 5efe5e
  void *privData;	/* private to the library */
Packit 5efe5e
} XvMCBlockArray;
Packit 5efe5e
Packit 5efe5e
   num_blocks - Number of 64 element blocks in the blocks array.
Packit 5efe5e
Packit 5efe5e
   context_id - XID of the context these blocks were allocated for.
Packit 5efe5e
Packit 5efe5e
   blocks -  Pointer to an array of (64 * num_blocks) shorts.
Packit 5efe5e
Packit 5efe5e
Status XvMCCreateBlocks (
Packit 5efe5e
    Display *display,
Packit 5efe5e
    XvMCContext *context,
Packit 5efe5e
    unsigned int num_blocks,
Packit 5efe5e
    XvMCBlockArray * block
Packit 5efe5e
);
Packit 5efe5e
Packit 5efe5e
   This allocates an array of DCT blocks in the XvMCBlockArray
Packit 5efe5e
   structure passed to it.  Success is returned if no error occured.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    context -  The context the block array is being created for.
Packit 5efe5e
Packit 5efe5e
    num_blocks - The number of 64 element short blocks to be allocated.
Packit 5efe5e
                 This number must be non-zero.
Packit 5efe5e
Packit 5efe5e
    block -  A pointer to a pre-allocated XvMCBlockArray structure.
Packit 5efe5e
Packit 5efe5e
      Errors:
Packit 5efe5e
Packit 5efe5e
	  XvMCBadContext - the context is invalid.
Packit 5efe5e
Packit 5efe5e
          BadAlloc -  There are insufficient resources to complete the
Packit 5efe5e
                      operation.
Packit 5efe5e
Packit 5efe5e
          BadValue -  num_blocks was zero.
Packit 5efe5e
Packit 5efe5e
Status XvMCDestroyBlocks (Display *display, XvMCBlockArray * block)
Packit 5efe5e
Packit 5efe5e
   Frees the given array.
Packit 5efe5e
Packit 5efe5e
     display -  The connection to the server.
Packit 5efe5e
Packit 5efe5e
     block - The block array to be freed.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
   ----------------------------------------------------------
Packit 5efe5e
Packit 5efe5e
#define XVMC_MB_TYPE_MOTION_FORWARD	0x02
Packit 5efe5e
#define XVMC_MB_TYPE_MOTION_BACKWARD	0x04
Packit 5efe5e
#define XVMC_MB_TYPE_PATTERN		0x08
Packit 5efe5e
#define XVMC_MB_TYPE_INTRA		0x10
Packit 5efe5e
Packit 5efe5e
#define XVMC_PREDICTION_FIELD		0x01
Packit 5efe5e
#define XVMC_PREDICTION_FRAME		0x02
Packit 5efe5e
#define XVMC_PREDICTION_DUAL_PRIME	0x03
Packit 5efe5e
#define XVMC_PREDICTION_16x8		0x02
Packit 5efe5e
#define XVMC_PREDICTION_4MV		0x04
Packit 5efe5e
Packit 5efe5e
#define XVMC_SELECT_FIRST_FORWARD	0x01
Packit 5efe5e
#define XVMC_SELECT_FIRST_BACKWARD	0x02
Packit 5efe5e
#define XVMC_SELECT_SECOND_FORWARD	0x04
Packit 5efe5e
#define XVMC_SELECT_SECOND_BACKWARD	0x08
Packit 5efe5e
Packit 5efe5e
#define XVMC_DCT_TYPE_FRAME		0x00
Packit 5efe5e
#define XVMC_DCT_TYPE_FIELD		0x01
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
   unsigned short x;
Packit 5efe5e
   unsigned short y;
Packit 5efe5e
   unsigned char macroblock_type;
Packit 5efe5e
   unsigned char motion_type;
Packit 5efe5e
   unsigned char motion_vertical_field_select;
Packit 5efe5e
   unsigned char dct_type;
Packit 5efe5e
   short PMV[2][2][2];
Packit 5efe5e
   unsigned int index;
Packit 5efe5e
   unsigned short coded_block_pattern;
Packit 5efe5e
   unsigned short pad0;
Packit 5efe5e
} XvMCMacroBlock;
Packit 5efe5e
Packit 5efe5e
    x, y -  location of the macroblock on the surface in units of macroblocks.
Packit 5efe5e
Packit 5efe5e
    macroblock_type - can be any of the following flags OR'd together:
Packit 5efe5e
Packit 5efe5e
	XVMC_MB_TYPE_MOTION_FORWARD - Forward motion prediction should
Packit 5efe5e
                                      be done.  This flag is ignored for
Packit 5efe5e
				      Intra frames.
Packit 5efe5e
Packit 5efe5e
	XVMC_MB_TYPE_MOTION_BACKWARD - Backward motion prediction should
Packit 5efe5e
                                       be done.  This flag is ignored when
Packit 5efe5e
				       the frame is not bidirectionally
Packit 5efe5e
                                       predicted.
Packit 5efe5e
Packit 5efe5e
        XVMC_MB_TYPE_PATTERN -  Blocks are referenced and they contain
Packit 5efe5e
                                differentials.  The coded_block_pattern will
Packit 5efe5e
                                indicate the number of blocks and index will
Packit 5efe5e
                                note their locations in the block array.
Packit 5efe5e
Packit 5efe5e
	XVMC_MB_TYPE_INTRA -  Blocks are referenced and they are intra blocks.
Packit 5efe5e
                              The coded_block_pattern will indicate the number
Packit 5efe5e
                              of blocks and index will note their locations in
Packit 5efe5e
                              the block array.  XVMC_MB_TYPE_PATTERN and
Packit 5efe5e
                              XVMC_MB_TYPE_INTRA are mutually exclusive.  If
Packit 5efe5e
                              both are specified, XVMC_MB_TYPE_INTRA takes
Packit 5efe5e
                              precedence.
Packit 5efe5e
Packit 5efe5e
    motion_type -  If the surface is a field, the following are valid:
Packit 5efe5e
			XVMC_PREDICTION_FIELD
Packit 5efe5e
			XVMC_PREDICTION_16x8
Packit 5efe5e
			XVMC_PREDICTION_DUAL_PRIME
Packit 5efe5e
		   If the surface is a frame, the following are valid:
Packit 5efe5e
			XVMC_PREDICTION_FIELD
Packit 5efe5e
			XVMC_PREDICTION_FRAME
Packit 5efe5e
			XVMC_PREDICTION_DUAL_PRIME
Packit 5efe5e
Packit 5efe5e
    motion_vertical_field_select - The following flags may be OR'd together
Packit 5efe5e
Packit 5efe5e
		XVMC_SELECT_FIRST_FORWARD
Packit 5efe5e
		XVMC_SELECT_FIRST_BACKWARD
Packit 5efe5e
		XVMC_SELECT_SECOND_FORWARD
Packit 5efe5e
		XVMC_SELECT_SECOND_BACKWARD
Packit 5efe5e
Packit 5efe5e
              If the bit is set the bottom field is indicated.
Packit 5efe5e
              If the bit is clear the top field is indicated.
Packit 5efe5e
Packit 5efe5e
              X X X X D C B A
Packit 5efe5e
              ------- | | | |_  First vector forward
Packit 5efe5e
                |     | | |___  First vector backward
Packit 5efe5e
              unused  | |_____ Second vector forward
Packit 5efe5e
                      |_______ Second vector backward
Packit 5efe5e
Packit 5efe5e
    PMV -  The motion vector(s)
Packit 5efe5e
Packit 5efe5e
               PMV[c][b][a]
Packit 5efe5e
Packit 5efe5e
                  a - This holds the vector. 0 = horizontal, 1 = vertical.
Packit 5efe5e
                  b - 0 = forward, 1 = backward.
Packit 5efe5e
                  c - 0 = first vector, 1 = second vector.
Packit 5efe5e
Packit 5efe5e
	    The motion vectors are used only when XVMC_MB_TYPE_MOTION_FORWARD
Packit 5efe5e
            or XVMC_MB_TYPE_MOTION_BACKWARD are set.
Packit 5efe5e
Packit 5efe5e
            DualPrime vectors must be fully decoded and placed in the PMV
Packit 5efe5e
            array as follows.
Packit 5efe5e
Packit 5efe5e
            Field structure:
Packit 5efe5e
Packit 5efe5e
                PMV[0][0][1:0]  from same parity
Packit 5efe5e
                PMV[0][1][1:0]  from opposite parity
Packit 5efe5e
Packit 5efe5e
            Frame structure:
Packit 5efe5e
Packit 5efe5e
                PMV[0][0][1:0]  top from top
Packit 5efe5e
                PMV[0][1][1:0]  bottom from bottom
Packit 5efe5e
                PMV[1][0][1:0]  top from bottom
Packit 5efe5e
                PMV[1][1][1:0]  bottom from top
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
    index -  The offset in units of (64 * sizeof(short)) from the start of
Packit 5efe5e
             the block array where this macroblock's DCT blocks, as indicated
Packit 5efe5e
             by the coded_block_pattern, are stored.
Packit 5efe5e
Packit 5efe5e
    coded_block_pattern - Indicates the blocks to be updated.  The bitplanes
Packit 5efe5e
                          are specific to the mc_type of the surface.  This
Packit 5efe5e
                          field is valid only if XVMC_MB_TYPE_PATTERN or
Packit 5efe5e
                          XVMC_MB_TYPE_INTRA are set.  In that case the blocks
Packit 5efe5e
                          are differential or intra blocks respectively.
Packit 5efe5e
			  The bitplanes are described in ISO/IEC 13818-2
Packit 5efe5e
			  Figures 6.10-12.
Packit 5efe5e
Packit 5efe5e
    dct_type -  This field indicates whether frame pictures are frame DCT
Packit 5efe5e
                coded or field DCT coded. ie XVMC_DCT_TYPE_FIELD or
Packit 5efe5e
                XVMC_DCT_TYPE_FRAME.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
  unsigned int num_blocks;
Packit 5efe5e
  XID context_id;
Packit 5efe5e
  XvMCMacroBlock *macro_blocks;
Packit 5efe5e
  void *privData;	/* private to the library */
Packit 5efe5e
} XvMCMacroBlockArray;
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
   num_blocks - Number of XvMCMacroBlocks in the macro_blocks array.
Packit 5efe5e
Packit 5efe5e
   context_id - XID of the context these macroblocks were allocated for.
Packit 5efe5e
Packit 5efe5e
   macro_blocks -  Pointer to an array of num_blocks XvMCMacroBlocks.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status XvMCCreateMacroBlocks (
Packit 5efe5e
    Display *display,
Packit 5efe5e
    XvMCContext *context,
Packit 5efe5e
    unsigned int num_blocks,
Packit 5efe5e
    XvMCMacroBlockArray * blocks
Packit 5efe5e
);
Packit 5efe5e
Packit 5efe5e
   This allocates an array of XvMCMacroBlocks in the XvMCMacroBlockArray
Packit 5efe5e
   structure passed to it.  Success is returned if no error occured.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    context -  The context the macroblock array is being created for.
Packit 5efe5e
Packit 5efe5e
    num_blocks - The number of XvMCMacroBlocks to be allocated.
Packit 5efe5e
                 This number must be non-zero.
Packit 5efe5e
Packit 5efe5e
    blocks -  A pointer to a pre-allocated XvMCMacroBlockArray structure.
Packit 5efe5e
Packit 5efe5e
      Errors:
Packit 5efe5e
Packit 5efe5e
	  XvMCBadContext - the context is invalid.
Packit 5efe5e
Packit 5efe5e
          BadAlloc -  There are insufficient resources to complete the
Packit 5efe5e
                      operation.
Packit 5efe5e
Packit 5efe5e
          BadValue -  num_blocks was zero.
Packit 5efe5e
Packit 5efe5e
Status XvMCDestroyMacroBlocks (Display *display, XvMCMacroBlockArray * block)
Packit 5efe5e
Packit 5efe5e
   Frees the given array.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    block -  The macro block array to be freed.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
    ------------------------------------------------------------
Packit 5efe5e
Packit 5efe5e
#define XVMC_TOP_FIELD		0x00000001
Packit 5efe5e
#define XVMC_BOTTOM_FIELD	0x00000002
Packit 5efe5e
#define XVMC_FRAME_PICTURE	(XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD)
Packit 5efe5e
Packit 5efe5e
#define XVMC_SECOND_FIELD       0x00000004
Packit 5efe5e
Packit 5efe5e
Status XvMCRenderSurface(
Packit 5efe5e
    Display *display,
Packit 5efe5e
    XvMCContext *context,
Packit 5efe5e
    unsigned int picture_structure,
Packit 5efe5e
    Surface *target_surface,
Packit 5efe5e
    Surface *past_surface,
Packit 5efe5e
    Surface *future_surface,
Packit 5efe5e
    unsigned int flags,
Packit 5efe5e
    unsigned int num_macroblocks,
Packit 5efe5e
    unsigned int first_macroblock,
Packit 5efe5e
    XvMCMacroBlockArray *macroblock_array,
Packit 5efe5e
    XvMCBlockArray *blocks
Packit 5efe5e
);
Packit 5efe5e
Packit 5efe5e
    This function renders the macroblocks passed to it.  It will not
Packit 5efe5e
    return until it has read all of the macroblocks, however, rendering
Packit 5efe5e
    will usually not be completed by that time.  The return of this
Packit 5efe5e
    function means it is safe to touch the blocks and macroblock_array.
Packit 5efe5e
    To synchronize rendering see the section on sychronization below.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    context - The context used to render.
Packit 5efe5e
Packit 5efe5e
    target_surface -
Packit 5efe5e
    past_surface -
Packit 5efe5e
    furture_surface -
Packit 5efe5e
Packit 5efe5e
        The target_surface is required.  If the future and past
Packit 5efe5e
      surfaces are NULL, the target_surface is an "Intra" frame.
Packit 5efe5e
Packit 5efe5e
      	If the past surface is provided but not the future surface,
Packit 5efe5e
      the target_surface is a "Predicted Inter" frame.
Packit 5efe5e
Packit 5efe5e
	If both past and future surfaces are provided, the
Packit 5efe5e
      target_surface is a "Bidirectionally-predicted Inter" frame.
Packit 5efe5e
Packit 5efe5e
        Specifying a future surface without a past surface results
Packit 5efe5e
      in a BadMatch.
Packit 5efe5e
Packit 5efe5e
      All surfaces must belong to the same context.
Packit 5efe5e
Packit 5efe5e
    picture_structure - XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD or
Packit 5efe5e
                        XVMC_FRAME_PICTURE.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
    flags -  Flags may include:
Packit 5efe5e
Packit 5efe5e
            XVMC_SECOND_FIELD - For field pictures this indicates whether
Packit 5efe5e
                                the current field (top or bottom) is first
Packit 5efe5e
                                or second in the sequence.
Packit 5efe5e
Packit 5efe5e
    num_macroblocks -  The number of XvMCMacroBlock structures to execute in
Packit 5efe5e
                       the macroblock_array.
Packit 5efe5e
Packit 5efe5e
    first_macroblock - The index of the first XvMCMacroBlock to process in the
Packit 5efe5e
                       macroblock_array.
Packit 5efe5e
Packit 5efe5e
    blocks - The array of XvMCBlocks to be referenced by the XvMCMacroBlocks.
Packit 5efe5e
             The data in the individual blocks are in raster scan order and
Packit 5efe5e
             should be clamped to the limits specific to the acceleration
Packit 5efe5e
             level.  For motion compensation level acceleration this is 8
Packit 5efe5e
             bits for Intra and 9 bits for non-Intra data.  At the IDCT level
Packit 5efe5e
             this is 12 bits.
Packit 5efe5e
Packit 5efe5e
  Errors:
Packit 5efe5e
Packit 5efe5e
        XvMCBadContext - The context is not valid.
Packit 5efe5e
Packit 5efe5e
        XvMCBadSurface - Any of the surfaces are not valid.
Packit 5efe5e
Packit 5efe5e
	BadMatch - Any of the surfaces do not belong to the specified
Packit 5efe5e
                   context or a future surface was specified without
Packit 5efe5e
                   a past surface.
Packit 5efe5e
Packit 5efe5e
        BadValue - Unrecognized data for the picture_structure.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
     DISPLAYING THE SURFACE
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCPutSurface(
Packit 5efe5e
  Display *display,
Packit 5efe5e
  XvMCSurface *surface,
Packit 5efe5e
  Drawable draw,
Packit 5efe5e
  short srcx,
Packit 5efe5e
  short srcy,
Packit 5efe5e
  unsigned short srcw,
Packit 5efe5e
  unsigned short srch,
Packit 5efe5e
  short destx,
Packit 5efe5e
  short desty,
Packit 5efe5e
  unsigned short destw,
Packit 5efe5e
  unsigned short desth,
Packit 5efe5e
  int flags
Packit 5efe5e
);
Packit 5efe5e
Packit 5efe5e
   Display the rectangle from the source defined by srcx/y/w/h scaled
Packit 5efe5e
 to destw by desth and placed at (destx, desty) on the given drawable.
Packit 5efe5e
 This function is not guaranteed to be pipelined with previous rendering
Packit 5efe5e
 commands and may display the surface immediately.  Therefore, the client
Packit 5efe5e
 must query that the surface has finished rendering before calling this
Packit 5efe5e
 function.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    surface - The surface to copy/overlay from.
Packit 5efe5e
Packit 5efe5e
    draw - The drawable to copy/overlay the video on.
Packit 5efe5e
Packit 5efe5e
    srcx -
Packit 5efe5e
    srcy -
Packit 5efe5e
    srcw -
Packit 5efe5e
    srch -  The rectangle in the source area from the surface that is
Packit 5efe5e
            to be displayed.
Packit 5efe5e
Packit 5efe5e
    destx -
Packit 5efe5e
    desty -
Packit 5efe5e
    destw -
Packit 5efe5e
    desth -  The rectangle in the destination drawable where the scaled
Packit 5efe5e
             source rectangle should be displayed.
Packit 5efe5e
Packit 5efe5e
    flags - this indicates the field to be displayed and can be XVMC_TOP_FIELD,
Packit 5efe5e
            XVMC_BOTTOM_FIELD or XVMC_FRAME_PICTURE.  XVMC_FRAME_PICTURE
Packit 5efe5e
            displays both fields (weave).
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
       XvMCBadSurface - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
       BadDrawable -  The drawable does not exist.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status XvMCHideSurface(Display *display, XvMCSurface *surface)
Packit 5efe5e
Packit 5efe5e
   Stops display of a surface.  This is only needed if the surface is an
Packit 5efe5e
   overlaid surface as indicated in the XvMCSurfaceInfo - it is a no-op
Packit 5efe5e
   otherwise.
Packit 5efe5e
Packit 5efe5e
     display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
     surface - The surface to be hidden.
Packit 5efe5e
Packit 5efe5e
      Errors:
Packit 5efe5e
Packit 5efe5e
	  XvMCBadSurface - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
     COMPOSITING THE SUBPICTURE
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
XvImageFormatValues * XvMCListSubpictureTypes (
Packit 5efe5e
  Display * display,
Packit 5efe5e
  XvPortID port,
Packit 5efe5e
  int surface_type_id,
Packit 5efe5e
  int *count_return
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
  Returns an array of XvImageFormatValues supported by the surface_type_id
Packit 5efe5e
  describing the surface. The surface_type_id is acquired from the
Packit 5efe5e
  XvMCSurfaceInfo.  This list should be freed with XFree().
Packit 5efe5e
Packit 5efe5e
   display - Specifies the connection to the X-server.
Packit 5efe5e
Packit 5efe5e
   port - Specifies the port we are interested in.
Packit 5efe5e
Packit 5efe5e
   surface_type_id - Specifies the surface type for which we want to
Packit 5efe5e
                     query the supported subpicture types.
Packit 5efe5e
Packit 5efe5e
   count_return - the size of the returned array.
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
      BadPort -  The port doesn't exist.
Packit 5efe5e
Packit 5efe5e
      BadAlloc - There are insufficient resources to complete this request.
Packit 5efe5e
Packit 5efe5e
      BadMatch - The surface type is not supported on that port.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
typedef struct {
Packit 5efe5e
  XID subpicture_id;
Packit 5efe5e
  XID context_id;
Packit 5efe5e
  int xvimage_id;
Packit 5efe5e
  unsigned short width;
Packit 5efe5e
  unsigned short height;
Packit 5efe5e
  int num_palette_entries;
Packit 5efe5e
  int entry_bytes;
Packit 5efe5e
  char component_order[4];
Packit 5efe5e
  void *privData;    /* private to the library */
Packit 5efe5e
} XvMCSubpicture;
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
   subpicture_id - An XID associated with this subpicture.
Packit 5efe5e
Packit 5efe5e
   context_id - The XID of the context this subpicture was created for.
Packit 5efe5e
Packit 5efe5e
   xvimage_id - The id descriptor of the XvImage format that may be used
Packit 5efe5e
                with this subpicture.
Packit 5efe5e
Packit 5efe5e
   width -
Packit 5efe5e
   height - The dimensions of the subpicture.
Packit 5efe5e
Packit 5efe5e
   num_palette_entries - For paletted formats only.  This is the number
Packit 5efe5e
                         of palette entries.  It is zero for XvImages
Packit 5efe5e
                         without palettes.
Packit 5efe5e
Packit 5efe5e
   entry_bytes -  Each component is one byte and entry_bytes indicates
Packit 5efe5e
                  the number of components in each entry (eg. 3 for
Packit 5efe5e
                  YUV palette entries).  This field is zero when
Packit 5efe5e
                  palettes are not used.
Packit 5efe5e
Packit 5efe5e
   component_order - Is an array of ascii characters describing the order
Packit 5efe5e
                     of the components within the bytes.  Only entry_bytes
Packit 5efe5e
                     characters of the string are used.
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCCreateSubpicture (
Packit 5efe5e
   Display *display,
Packit 5efe5e
   XvMCContext *context,
Packit 5efe5e
   XvMCSubpicture *subpicture,
Packit 5efe5e
   unsigned short width,
Packit 5efe5e
   unsigned short height,
Packit 5efe5e
   int xvimage_id
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
   This creates a subpicture by filling out the XvMCSubpicture structure
Packit 5efe5e
   passed to it and returning Success.
Packit 5efe5e
Packit 5efe5e
    display -  Specifies the connection to the X-Server.
Packit 5efe5e
Packit 5efe5e
    context -  The context to create the subpicture for.
Packit 5efe5e
Packit 5efe5e
    subpicture - Pre-allocated XvMCSubpicture structure to be filled
Packit 5efe5e
                 out by this function.
Packit 5efe5e
Packit 5efe5e
    width -
Packit 5efe5e
    height -  The dimensions of the subpicture.
Packit 5efe5e
Packit 5efe5e
    xvimage_id - The id describing the XvImage format.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
      BadAlloc - There are insufficient resources to complete this request.
Packit 5efe5e
Packit 5efe5e
      XvMCBadContext - The specified context does not exist.
Packit 5efe5e
Packit 5efe5e
      BadMatch - The XvImage format id specified is not supported by
Packit 5efe5e
                 the context.
Packit 5efe5e
Packit 5efe5e
      BadValue - If the size requested is larger than the max size reported
Packit 5efe5e
                 in the XvMCSurfaceInfo.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCClearSubpicture (
Packit 5efe5e
  Display *display,
Packit 5efe5e
  XvMCSubpicture *subpicture,
Packit 5efe5e
  short x,
Packit 5efe5e
  short y,
Packit 5efe5e
  unsigned short width,
Packit 5efe5e
  unsigned short height,
Packit 5efe5e
  unsigned int color
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
    Clear the area of the given subpicture to "color".
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    subpicture - The subpicture to clear.
Packit 5efe5e
Packit 5efe5e
    x -
Packit 5efe5e
    y -
Packit 5efe5e
    width -
Packit 5efe5e
    height -  The rectangle in the subpicture to be cleared.
Packit 5efe5e
Packit 5efe5e
    color -  The data to fill the rectangle with.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
       XvMCBadSubpicture - The subpicture is invalid.
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCCompositeSubpicture (
Packit 5efe5e
   Display *display,
Packit 5efe5e
   XvMCSubpicture *subpicture,
Packit 5efe5e
   XvImage *image,
Packit 5efe5e
   short srcx,
Packit 5efe5e
   short srcy,
Packit 5efe5e
   unsigned short width,
Packit 5efe5e
   unsigned short height,
Packit 5efe5e
   short dstx,
Packit 5efe5e
   short dsty
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
    Copies the XvImage to the XvMCSubpicture.
Packit 5efe5e
Packit 5efe5e
    display -  The connection to the server.
Packit 5efe5e
Packit 5efe5e
    subpicture -  The subpicture used as the destination of the copy.
Packit 5efe5e
Packit 5efe5e
    image -  The XvImage to be used as the source of the copy.
Packit 5efe5e
             XvImages should be of the shared memory variety for
Packit 5efe5e
             indirect contexts.
Packit 5efe5e
Packit 5efe5e
    srcx -
Packit 5efe5e
    srcy -
Packit 5efe5e
    width -
Packit 5efe5e
    height -  The rectangle from the image to be composited.
Packit 5efe5e
Packit 5efe5e
    dstx -
Packit 5efe5e
    dsty -  The location in the subpicture where the source rectangle
Packit 5efe5e
            should be composited.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
       XvMCBadSubpicture - The subpicture is invalid.
Packit 5efe5e
Packit 5efe5e
       BadMatch -  The subpicture does not support the type of XvImage
Packit 5efe5e
                   passed to this function.
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture)
Packit 5efe5e
Packit 5efe5e
   Destroys the specified subpicture.
Packit 5efe5e
Packit 5efe5e
   display - Specifies the connection to the X-server.
Packit 5efe5e
Packit 5efe5e
   subpicture - The subpicture to be destroyed.
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
      XvMCBadSubpicture -  The subpicture specified does not exist.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCSetSubpicturePalette (
Packit 5efe5e
  Display *display,
Packit 5efe5e
  XvMCSubpicture *subpicture,
Packit 5efe5e
  unsigned char *palette
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
   Set the subpicture's palette.  This applies to paletted subpictures
Packit 5efe5e
   only.
Packit 5efe5e
Packit 5efe5e
    display -  The connection to the server.
Packit 5efe5e
Packit 5efe5e
    subpicture - The subpicture on which to change the palette.
Packit 5efe5e
Packit 5efe5e
    palette -  A pointer to an array holding the palette data.  The
Packit 5efe5e
               size of this array is
Packit 5efe5e
Packit 5efe5e
                   num_palette_entries * entry_bytes
Packit 5efe5e
Packit 5efe5e
               in size.  The order of the components in the palette
Packit 5efe5e
	       is described by the component_order in the XvMCSubpicture
Packit 5efe5e
               structure.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
      XvMCBadSubpicture -  The subpicture specified does not exist.
Packit 5efe5e
Packit 5efe5e
      BadMatch -  The specified subpicture does not use palettes.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCBlendSubpicture (
Packit 5efe5e
   Display *display,
Packit 5efe5e
   XvMCSurface *target_surface,
Packit 5efe5e
   XvMCSubpicture *subpicture,
Packit 5efe5e
   short subx,
Packit 5efe5e
   short suby,
Packit 5efe5e
   unsigned short subw,
Packit 5efe5e
   unsigned short subh,
Packit 5efe5e
   short surfx,
Packit 5efe5e
   short surfy,
Packit 5efe5e
   unsigned short surfw,
Packit 5efe5e
   unsigned short surfh
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCBlendSubpicture2 (
Packit 5efe5e
   Display *display,
Packit 5efe5e
   XvMCSurface *source_surface,
Packit 5efe5e
   XvMCSurface *target_surface,
Packit 5efe5e
   XvMCSubpicture *subpicture,
Packit 5efe5e
   short subx,
Packit 5efe5e
   short suby,
Packit 5efe5e
   unsigned short subw,
Packit 5efe5e
   unsigned short subh,
Packit 5efe5e
   short surfx,
Packit 5efe5e
   short surfy,
Packit 5efe5e
   unsigned short surfw,
Packit 5efe5e
   unsigned short surfh
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
   The behavior of these two functions is different depending on whether
Packit 5efe5e
or not the XVMC_BACKEND_SUBPICTURE flag is set in the XvMCSurfaceInfo.
Packit 5efe5e
Packit 5efe5e
 XVMC_BACKEND_SUBPICTURE set:
Packit 5efe5e
Packit 5efe5e
    XvMCBlendSubpicture associates the subpicture with the target_surface.
Packit 5efe5e
  Both will be displayed at the next call to XvMCPutSurface.  Additional
Packit 5efe5e
  blends before the call to XvMCPutSurface simply overrides the association.
Packit 5efe5e
  Both the target_surface and subpicture will query XVMC_DISPLAYING from
Packit 5efe5e
  the call to XvMCPutSurface until they are no longer displaying.  It is
Packit 5efe5e
  safe to associate the subpicture and target_surface before rendering has
Packit 5efe5e
  completed (while they still query XVMC_RENDERING) but it is not safe to
Packit 5efe5e
  call XvMCPutSurface at that time.
Packit 5efe5e
Packit 5efe5e
    XvMCBlendSubpicture2 copies the source_surface to the target_surface
Packit 5efe5e
  and associates the subpicture with the target_surface.  This essentially
Packit 5efe5e
  calls XvMCBlendSubpicture on the target_surface after the copy.  Both
Packit 5efe5e
  the subpicture and target_surface will query XVMC_DISPLAYING from the
Packit 5efe5e
  call to XvMCPutSurface until they are no longer displaying.  The
Packit 5efe5e
  source_surface will not query XVMC_DISPLAYING as a result of this function.
Packit 5efe5e
  The copy is pipelined with the rendering and will cause XVMC_RENDERING
Packit 5efe5e
  to be queried until the copy is done.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
 XVMC_BACKEND_SUBPICTURE not set ("frontend" behavior):
Packit 5efe5e
Packit 5efe5e
    XvMCBlendSubpicture is a no-op in this case.
Packit 5efe5e
Packit 5efe5e
    XvMCBlendSubpicture2 blends the source_surface and subpicture and
Packit 5efe5e
  puts it in the target_surface.  This does not effect the status of
Packit 5efe5e
  the source surface but will cause the target_surface to query
Packit 5efe5e
  XVMC_RENDERING until the blend is completed.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
  display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
  subpicture - The subpicture to be blended into the video.
Packit 5efe5e
Packit 5efe5e
  target_surface - The surface to be displayed with the blended subpicture.
Packit 5efe5e
Packit 5efe5e
  source_surface - Source surface prior to blending.
Packit 5efe5e
Packit 5efe5e
  subx -
Packit 5efe5e
  suby -
Packit 5efe5e
  subw -
Packit 5efe5e
  subh -  The rectangle from the subpicture to be blended.
Packit 5efe5e
Packit 5efe5e
  surfx -
Packit 5efe5e
  surfy -
Packit 5efe5e
  surfw -
Packit 5efe5e
  surfh - The rectangle in the XvMCSurface to blend the subpicture rectangle
Packit 5efe5e
          into.  If XVMC_SUBPICTURE_INDEPENDENT_SCALING is not set in the
Packit 5efe5e
          XvMCSurfaceInfo subw must be equal to surfw and subh must be
Packit 5efe5e
          equal to surfh height or else a BadValue error occurs.
Packit 5efe5e
Packit 5efe5e
   Errors:
Packit 5efe5e
Packit 5efe5e
    XvMCBadSurface - Any of the surfaces are invalid.
Packit 5efe5e
Packit 5efe5e
    XvMCBadSubpicture - The subpicture is invalid.
Packit 5efe5e
Packit 5efe5e
    BadMatch - The subpicture or any of the surfaces do not belong to the
Packit 5efe5e
               same context.
Packit 5efe5e
Packit 5efe5e
    BadValue - XVMC_SUBPICTURE_INDEPENDENT_SCALING is set and the source
Packit 5efe5e
               and destination rectangles are different sizes.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
     SURFACE SYNCHRONIZATION
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
#define XVMC_RENDERING		0x00000001
Packit 5efe5e
#define XVMC_DISPLAYING		0x00000002
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCSyncSurface (Display *display, XvMCSurface *surface)
Packit 5efe5e
Packit 5efe5e
   This function blocks until all rendering requests on the surface
Packit 5efe5e
  have been completed.
Packit 5efe5e
Packit 5efe5e
     display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
     surface - The surface to synchronize.
Packit 5efe5e
Packit 5efe5e
     Errors:
Packit 5efe5e
Packit 5efe5e
         XvMCBadSurface - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCFlushSurface (Display *display, XvMCSurface *surface)
Packit 5efe5e
Packit 5efe5e
   This function commits pending rendering requests to ensure that
Packit 5efe5e
  they will be completed in a finite amount of time.
Packit 5efe5e
Packit 5efe5e
    display -  The connnection to the server.
Packit 5efe5e
Packit 5efe5e
    surface -  The surface whos rendering requests should be flushed.
Packit 5efe5e
Packit 5efe5e
     Errors:
Packit 5efe5e
Packit 5efe5e
         XvMCBadSurface - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat)
Packit 5efe5e
Packit 5efe5e
   display -  The connection to the server.
Packit 5efe5e
Packit 5efe5e
   surface -  The surface whos status is being queried.
Packit 5efe5e
Packit 5efe5e
   stat -  May be any of the following OR'd together:
Packit 5efe5e
Packit 5efe5e
   XVMC_RENDERING - The last XvMCRenderSurface request has not completed
Packit 5efe5e
                    yet.
Packit 5efe5e
Packit 5efe5e
   XVMC_DISPLAYING - The surface is currently being displayed or a
Packit 5efe5e
                     display is pending (ie. it is not safe to render
Packit 5efe5e
                     to it).
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
         XvMCBadSurface - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
     SUBPICTURE SYNCHRONIZATION
Packit 5efe5e
Packit 5efe5e
/***********************************************************************/
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture)
Packit 5efe5e
Packit 5efe5e
   This function blocks until all composite/clear requests on the supicture
Packit 5efe5e
  have been completed.
Packit 5efe5e
Packit 5efe5e
     display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
     subpicture -  The subpicture to synchronize.
Packit 5efe5e
Packit 5efe5e
     Errors:
Packit 5efe5e
Packit 5efe5e
         XvMCBadSubpicture - The subpicture is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture)
Packit 5efe5e
Packit 5efe5e
   This function commits pending composite/clear requests to ensure that
Packit 5efe5e
  they will be completed in a finite amount of time.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    subpicture - The subpicture whos compositing should be flushed.
Packit 5efe5e
Packit 5efe5e
     Errors:
Packit 5efe5e
Packit 5efe5e
         XvMCBadSubpicture - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat)
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    subpic - The subpicture whos status is being queried.
Packit 5efe5e
Packit 5efe5e
    stat - may be any of the following OR'd together:
Packit 5efe5e
Packit 5efe5e
   XVMC_RENDERING - The last XvMCCompositeSubpicture or XvMCClearSubpicture
Packit 5efe5e
                    request has not completed yet.
Packit 5efe5e
Packit 5efe5e
   XVMC_DISPLAYING - The subpicture is currently being displayed or a
Packit 5efe5e
                     display is pending (ie. it is not safe to render
Packit 5efe5e
                     to it).
Packit 5efe5e
Packit 5efe5e
     Errors:
Packit 5efe5e
Packit 5efe5e
         XvMCBadSubpicture - The surface is not valid.
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
     ATTRIBUTES
Packit 5efe5e
Packit 5efe5e
/********************************************************************/
Packit 5efe5e
Packit 5efe5e
   Context specific attribute functions are provided.  These are
Packit 5efe5e
similar to their Xv Counterparts XvQueryPortAttributes, XvSetPortAttribute
Packit 5efe5e
and XvGetPortAttribute but their state is specific to the context.
Packit 5efe5e
Packit 5efe5e
XvAttribute *
Packit 5efe5e
XvMCQueryAttributes (
Packit 5efe5e
    Display *display,
Packit 5efe5e
    XvMCContext *context,
Packit 5efe5e
    int *number
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
    An array of XvAttributes of size "number" is returned by this function.
Packit 5efe5e
  If there are no attributes, NULL is returned and number is set to 0.
Packit 5efe5e
  The array may be freed with XFree().
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    context - The context whos attributes we are querying.
Packit 5efe5e
Packit 5efe5e
    number - The returned number of recognized atoms.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
	XvMCBadContext - The context is invalid.
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCSetAttribute (
Packit 5efe5e
    Display *display,
Packit 5efe5e
    XvMCContext *context,
Packit 5efe5e
    Atom attribute,
Packit 5efe5e
    int value
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
    This function sets a context-specific attribute and returns Success
Packit 5efe5e
  if no error has occurred.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    context - The context for which the attribute change is to go into effect.
Packit 5efe5e
Packit 5efe5e
    attribute - The X Atom of the attribute to be changed.
Packit 5efe5e
Packit 5efe5e
    value -  The new value of the attribute.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
	XvMCBadContext - The context is not valid.
Packit 5efe5e
Packit 5efe5e
	BadValue - An invalid value was specified.
Packit 5efe5e
Packit 5efe5e
	BadMatch - This attribute is not defined for this context.
Packit 5efe5e
Packit 5efe5e
Status
Packit 5efe5e
XvMCGetAttribute (
Packit 5efe5e
    Display *display,
Packit 5efe5e
    XvMCContext *context,
Packit 5efe5e
    Atom attribute,
Packit 5efe5e
    int *value
Packit 5efe5e
)
Packit 5efe5e
Packit 5efe5e
    This function queries a context-specific attribute and return
Packit 5efe5e
  Success and the value if no error has occurred.
Packit 5efe5e
Packit 5efe5e
    display - The connection to the server.
Packit 5efe5e
Packit 5efe5e
    context - The context whos attribute we are querying.
Packit 5efe5e
Packit 5efe5e
    attribute - The X Atom of the attribute to be retrieved.
Packit 5efe5e
Packit 5efe5e
    value -  The returned attribute value.
Packit 5efe5e
Packit 5efe5e
    Errors:
Packit 5efe5e
Packit 5efe5e
        XvMCBadContext - The context is not valid.
Packit 5efe5e
Packit 5efe5e
        BadMatch - This attribute is not defined for this context.
Packit 5efe5e