Escolar Documentos
Profissional Documentos
Cultura Documentos
/* history */
/* acknowledgements */
/********************************************************************/
OVERVIEW
/********************************************************************/
XvMC extends the X-Video extension (Xv) and makes use of the
familar concept of the XvPort. Ports have attributes that can be set
and queried through Xv. In XvMC ports can also have hardware motion
compensation contexts created for use with them. Ports which support
XvImages (ie. they have an "XV_IMAGE" port encoding as described in
the Xv version 2.2 API addendum) can be queried for the list of XvMCSurface
types they support. If they support any XvMCSurface types an
XvMCContext can be created for that port.
/********************************************************************/
/********************************************************************/
/* Errors */
#define XvMCBadContext 0
#define XvMCBadSurface 1
#define XvMCBadSubpicture 2
eventBase -
errBase - The returned event and error bases. Currently there
are no events defined.
major -
minor - The returned major and minor version numbers.
/********************************************************************/
/********************************************************************/
/* Chroma formats */
#define XVMC_CHROMA_FORMAT_420 0x00000001
#define XVMC_CHROMA_FORMAT_422 0x00000002
#define XVMC_CHROMA_FORMAT_444 0x00000003
/* XvMCSurfaceInfo Flags */
#define XVMC_OVERLAID_SURFACE 0x00000001
#define XVMC_BACKEND_SUBPICTURE 0x00000002
#define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004
#define XVMC_INTRA_UNSIGNED 0x00000008
typedef struct {
int surface_type_id;
int chroma_format;
unsigned short max_width;
unsigned short max_height;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;
int mc_type;
int flags;
} XvMCSurfaceInfo;
max_width -
max_height - Maximum dimensions of the luma data in pixels.
subpicture_max_width -
subpicture_max_height - The Maximum dimensions of the subpicture
that can be created for use with this surface
Both fields are zero if subpictures are not
supported.
Returns the number of surface types supported by the XvPort and an array
of XvMCSurfaceInfo describing each surface type. The returned array
should be freed with XFree().
Errors:
/********************************************************************/
CREATING A CONTEXT
/********************************************************************/
/* XvMCContext flags */
#define XVMC_DIRECT 0x00000001
typedef struct {
XID context_id;
int surface_type_id;
unsigned short width;
unsigned short height;
XVPortID port;
int flags;
void * privData; /* private to the library */
} XvMCContext;
width -
height - The dimensions (of the luma data) this context supports.
Status XvMCCreateContext (
Display display,
XVPortID port,
int surface_type_id,
int width,
int height,
int flags,
XvMCContext * context
);
surface_type_id -
width -
height - Specifies the surface type and dimensions that this
context will be used for. The surface_type_id corresponds
to the surface_type_id referenced by the XvMCSurfaceInfo.
The surface returned may be larger than the surface requested
(usually the next larger multiple of 16x16 pixels).
Errors:
Errors:
/*********************************************************************/
SURFACE CREATION
/*********************************************************************/
typedef struct {
XID surface_id;
XID context_id;
int surface_type_id;
unsigned short width;
unsigned short height;
void *privData; /* private to the library */
} XvMCSurface;
context_id - The XID of the context for which the surface was created.
width -
height - The width and height of the luma data.
Status
XvMCCreateSurface(
Display *display,
XvMCContext * context;
XvMCSurface * surface;
);
Errors:
XvMCBadContext - the context is not valid.
Errors:
/*********************************************************************/
RENDERING A FRAME
/*********************************************************************/
typedef struct {
XID context_id;
unsigned int num_blocks;
short *blocks;
void *privData; /* private to the library */
} XvMCBlockArray;
Status XvMCCreateBlocks (
Display *display,
XvMCContext *context,
unsigned int num_blocks,
XvMCBlockArray * block
);
Errors:
XvMCBadContext - the context is invalid.
----------------------------------------------------------
typedef struct {
unsigned short x;
unsigned short y;
unsigned char macroblock_type;
unsigned char motion_type;
unsigned char motion_vertical_field_select;
unsigned char dct_type;
short PMV[2][2][2];
unsigned int index;
unsigned short coded_block_pattern;
unsigned short pad0;
} XvMCMacroBlock;
XVMC_SELECT_FIRST_FORWARD
XVMC_SELECT_FIRST_BACKWARD
XVMC_SELECT_SECOND_FORWARD
XVMC_SELECT_SECOND_BACKWARD
X X X X D C B A
------- | | | |_ First vector forward
| | | |___ First vector backward
unused | |_____ Second vector forward
|_______ Second vector backward
PMV[c][b][a]
Field structure:
Frame structure:
dct_type - This field indicates whether frame pictures are frame DCT
coded or field DCT coded. ie XVMC_DCT_TYPE_FIELD or
XVMC_DCT_TYPE_FRAME.
typedef struct {
unsigned int num_blocks;
XID context_id;
XvMCMacroBlock *macro_blocks;
void *privData; /* private to the library */
} XvMCMacroBlockArray;
Status XvMCCreateMacroBlocks (
Display *display,
XvMCContext *context,
unsigned int num_blocks,
XvMCMacroBlockArray * blocks
);
Errors:
------------------------------------------------------------
Status XvMCRenderSurface(
Display *display,
XvMCContext *context,
unsigned int picture_structure,
Surface *target_surface,
Surface *past_surface,
Surface *future_surface,
unsigned int flags,
unsigned int num_macroblocks,
unsigned int first_macroblock,
XvMCMacroBlockArray *macroblock_array,
XvMCBlockArray *blocks
);
target_surface -
past_surface -
furture_surface -
Errors:
/***********************************************************************/
/***********************************************************************/
Status
XvMCPutSurface(
Display *display,
XvMCSurface *surface,
Drawable draw,
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
int flags
);
srcx -
srcy -
srcw -
srch - The rectangle in the source area from the surface that is
to be displayed.
destx -
desty -
destw -
desth - The rectangle in the destination drawable where the scaled
source rectangle should be displayed.
Errors:
Errors:
XvMCBadSurface - The surface is not valid.
/***********************************************************************/
/***********************************************************************/
XvImageFormatValues * XvMCListSubpictureTypes (
Display * display,
XvPortID port,
int surface_type_id,
int *count_return
)
Errors:
typedef struct {
XID subpicture_id;
XID context_id;
int xvimage_id;
unsigned short width;
unsigned short height;
int num_palette_entries;
int entry_bytes;
char component_order[4];
void *privData; /* private to the library */
} XvMCSubpicture;
context_id - The XID of the context this subpicture was created for.
Status
XvMCCreateSubpicture (
Display *display,
XvMCContext *context,
XvMCSubpicture *subpicture,
unsigned short width,
unsigned short height,
int xvimage_id
)
width -
height - The dimensions of the subpicture.
Errors:
BadValue - If the size requested is larger than the max size reported
in the XvMCSurfaceInfo.
Status
XvMCClearSubpicture (
Display *display,
XvMCSubpicture *subpicture,
short x,
short y,
unsigned short width,
unsigned short height,
unsigned int color
)
x -
y -
width -
height - The rectangle in the subpicture to be cleared.
Errors:
Status
XvMCCompositeSubpicture (
Display *display,
XvMCSubpicture *subpicture,
XvImage *image,
short srcx,
short srcy,
unsigned short width,
unsigned short height,
short dstx,
short dsty
)
srcx -
srcy -
width -
height - The rectangle from the image to be composited.
dstx -
dsty - The location in the subpicture where the source rectangle
should be composited.
Errors:
Status
XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture)
Errors:
Status
XvMCSetSubpicturePalette (
Display *display,
XvMCSubpicture *subpicture,
unsigned char *palette
)
num_palette_entries * entry_bytes
Errors:
Status
XvMCBlendSubpicture (
Display *display,
XvMCSurface *target_surface,
XvMCSubpicture *subpicture,
short subx,
short suby,
unsigned short subw,
unsigned short subh,
short surfx,
short surfy,
unsigned short surfw,
unsigned short surfh
)
Status
XvMCBlendSubpicture2 (
Display *display,
XvMCSurface *source_surface,
XvMCSurface *target_surface,
XvMCSubpicture *subpicture,
short subx,
short suby,
unsigned short subw,
unsigned short subh,
short surfx,
short surfy,
unsigned short surfw,
unsigned short surfh
)
XVMC_BACKEND_SUBPICTURE set:
subx -
suby -
subw -
subh - The rectangle from the subpicture to be blended.
surfx -
surfy -
surfw -
surfh - The rectangle in the XvMCSurface to blend the subpicture rectangle
into. If XVMC_SUBPICTURE_INDEPENDENT_SCALING is not set in the
XvMCSurfaceInfo subw must be equal to surfw and subh must be
equal to surfh height or else a BadValue error occurs.
Errors:
/***********************************************************************/
SURFACE SYNCHRONIZATION
/***********************************************************************/
Status
XvMCSyncSurface (Display *display, XvMCSurface *surface)
Errors:
Status
XvMCFlushSurface (Display *display, XvMCSurface *surface)
Errors:
Status
XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat)
Errors:
/***********************************************************************/
SUBPICTURE SYNCHRONIZATION
/***********************************************************************/
Status
XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture)
Errors:
Status
XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture)
Errors:
Status
XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat)
Errors:
/********************************************************************/
ATTRIBUTES
/********************************************************************/
XvAttribute *
XvMCQueryAttributes (
Display *display,
XvMCContext *context,
int *number
)
Errors:
XvMCBadContext - The context is invalid.
Status
XvMCSetAttribute (
Display *display,
XvMCContext *context,
Atom attribute,
int value
)
context - The context for which the attribute change is to go into effect.
Errors:
Status
XvMCGetAttribute (
Display *display,
XvMCContext *context,
Atom attribute,
int *value
)
Errors: