summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@mobile-97b8.jf.intel.com>2007-09-07 04:29:54 -0700
committerroot <root@mobile-97b8.jf.intel.com>2007-09-07 04:29:54 -0700
commit16ab532f97d035000e6c7453068c8585a16d21f9 (patch)
tree95c27762338830b9b742fe926979f0f041e4e2a0
parentbb92cdf7690f28e4df1df2a87255f3e830bcd221 (diff)
downloadlibva-16ab532f97d035000e6c7453068c8585a16d21f9.tar.gz
Include sub-picture support (va 0.22)
-rw-r--r--src/va.c281
-rwxr-xr-xsrc/va.h307
-rwxr-xr-xsrc/va_backend.h110
-rwxr-xr-xsrc/va_x11.h2
4 files changed, 687 insertions, 13 deletions
diff --git a/src/va.c b/src/va.c
index a7686c9..d4c83be 100644
--- a/src/va.c
+++ b/src/va.c
@@ -36,7 +36,7 @@
#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
#define DRIVER_EXTENSION "_drv_video.so"
-#define DRIVER_INIT_FUNC "__vaDriverInit_0_20"
+#define DRIVER_INIT_FUNC "__vaDriverInit_0_22"
#define CTX(dpy) ((VADriverContextP) dpy );
#define ASSERT_CONTEXT(dpy) assert( vaDbgContextIsValid(dpy) )
@@ -252,6 +252,8 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name)
CHECK_MAXIMUM(vaStatus, ctx, profiles);
CHECK_MAXIMUM(vaStatus, ctx, entrypoints);
CHECK_MAXIMUM(vaStatus, ctx, attributes);
+ CHECK_MAXIMUM(vaStatus, ctx, image_formats);
+ CHECK_MAXIMUM(vaStatus, ctx, subpic_formats);
CHECK_VTABLE(vaStatus, ctx, Terminate);
CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
@@ -274,6 +276,18 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name)
CHECK_VTABLE(vaStatus, ctx, SyncSurface);
CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
CHECK_VTABLE(vaStatus, ctx, PutSurface);
+ CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
+ CHECK_VTABLE(vaStatus, ctx, CreateImage);
+ CHECK_VTABLE(vaStatus, ctx, DestroyImage);
+ CHECK_VTABLE(vaStatus, ctx, GetImage);
+ CHECK_VTABLE(vaStatus, ctx, PutImage);
+ CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
+ CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
+ CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
+ CHECK_VTABLE(vaStatus, ctx, SetSubpicturePalette);
+ CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
+ CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
+ CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
CHECK_VTABLE(vaStatus, ctx, DbgCopySurfaceToBuffer);
}
if (VA_STATUS_SUCCESS != vaStatus)
@@ -334,7 +348,7 @@ const char *vaErrorStr(VAStatus error_status)
case VA_STATUS_ERROR_UNKNOWN:
return "unknown libva error";
}
- return "unknwon libva error / description missing";
+ return "unknown libva error / description missing";
}
VAStatus vaInitialize (
@@ -431,6 +445,7 @@ int vaMaxNumEntrypoints (
return ctx->max_entrypoints;
}
+
/* Get maximum number of attributs supported by the implementation */
int vaMaxNumConfigAttributes (
VADisplay dpy
@@ -442,7 +457,6 @@ int vaMaxNumConfigAttributes (
return ctx->max_attributes;
}
-
VAStatus vaQueryConfigEntrypoints (
VADisplay dpy,
VAProfile profile,
@@ -734,6 +748,8 @@ VAStatus vaPutSurface (
short desty,
unsigned short destw,
unsigned short desth,
+ VARectangle *cliprects, /* client supplied clip list */
+ unsigned int number_cliprects, /* number of clip rects in the clip list */
int flags /* de-interlacing flags */
)
{
@@ -742,9 +758,266 @@ VAStatus vaPutSurface (
TRACE(vaPutSurface);
return ctx->vtable.vaPutSurface( ctx, surface, draw, srcx, srcy, srcw, srch,
- destx, desty, destw, desth, flags );
+ destx, desty, destw, desth,
+ cliprects, number_cliprects, flags );
+}
+
+/* Get maximum number of image formats supported by the implementation */
+int vaMaxNumImageFormats (
+ VADisplay dpy
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ return ctx->max_image_formats;
+}
+
+VAStatus vaQueryImageFormats (
+ VADisplay dpy,
+ VAImageFormat *format_list, /* out */
+ int *num_formats /* out */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaQueryImageFormats);
+ return ctx->vtable.vaQueryImageFormats ( ctx, format_list, num_formats);
+}
+
+/*
+ * The width and height fields returned in the VAImage structure may get
+ * enlarged for some YUV formats. The size of the data buffer that needs
+ * to be allocated will be given in the "data_size" field in VAImage.
+ * Image data is not allocated by this function. The client should
+ * allocate the memory and fill in the VAImage structure's data field
+ * after looking at "data_size" returned from the library.
+ */
+VAStatus vaCreateImage (
+ VADisplay dpy,
+ VAImageFormat *format,
+ int width,
+ int height,
+ VAImage *image /* out */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaCreateImage);
+ return ctx->vtable.vaCreateImage ( ctx, format, width, height, image);
+}
+
+/*
+ * Should call DestroyImage before destroying the surface it is bound to
+ */
+VAStatus vaDestroyImage (
+ VADisplay dpy,
+ VAImage *image
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaDestroyImage);
+ return ctx->vtable.vaDestroyImage ( ctx, image);
+}
+
+/*
+ * Retrieve surface data into a VAImage
+ * Image must be in a format supported by the implementation
+ */
+VAStatus vaGetImage (
+ VADisplay dpy,
+ VASurface *surface,
+ int x, /* coordinates of the upper left source pixel */
+ int y,
+ unsigned int width, /* width and height of the region */
+ unsigned int height,
+ VAImage *image
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaGetImage);
+ return ctx->vtable.vaGetImage ( ctx, surface, x, y, width, height, image);
+}
+
+/*
+ * Copy data from a VAImage to a surface
+ * Image must be in a format supported by the implementation
+ */
+VAStatus vaPutImage (
+ VADisplay dpy,
+ VASurface *surface,
+ VAImage *image,
+ int src_x,
+ int src_y,
+ unsigned int width,
+ unsigned int height,
+ int dest_x,
+ int dest_y
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaPutImage);
+ return ctx->vtable.vaPutImage ( ctx, surface, image, src_x, src_y, width, height, dest_x, dest_y );
+}
+
+/* Get maximum number of subpicture formats supported by the implementation */
+int vaMaxNumSubpictureFormats (
+ VADisplay dpy
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ return ctx->max_subpic_formats;
+}
+
+/*
+ * Query supported subpicture formats
+ * The caller must provide a "format_list" array that can hold at
+ * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
+ * for each format to indicate additional capabilities for that format. The actual
+ * number of formats returned in "format_list" is returned in "num_formats".
+ */
+VAStatus vaQuerySubpictureFormats (
+ VADisplay dpy,
+ VAImageFormat *format_list, /* out */
+ unsigned int *flags, /* out */
+ unsigned int *num_formats /* out */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaQuerySubpictureFormats);
+ return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
+}
+
+/*
+ * Subpictures are created with an image associated.
+ */
+VAStatus vaCreateSubpicture (
+ VADisplay dpy,
+ VAImage *image,
+ VASubpicture *subpicture /* out */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaCreateSubpicture);
+ return ctx->vtable.vaCreateSubpicture ( ctx, image, subpicture );
+}
+
+/*
+ * Destroy the subpicture before destroying the image it is assocated to
+ */
+VAStatus vaDestroySubpicture (
+ VADisplay dpy,
+ VASubpicture *subpicture
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaDestroySubpicture);
+ return ctx->vtable.vaDestroySubpicture ( ctx, subpicture);
+}
+
+VAStatus vaSetSubpicturePalette (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ /*
+ * pointer to an array holding the palette data. The size of the array is
+ * num_palette_entries * entry_bytes in size. The order of the components
+ * in the palette is described by the component_order in VASubpicture struct
+ */
+ unsigned char *palette
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaSetSubpicturePalette);
+ return ctx->vtable.vaSetSubpicturePalette ( ctx, subpicture, palette);
+}
+
+/*
+ * If chromakey is enabled, then the area where the source value falls within
+ * the chromakey [min, max] range is transparent
+ */
+VAStatus vaSetSubpictureChromakey (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ unsigned int chromakey_min,
+ unsigned int chromakey_max
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaSetSubpictureChromakey);
+ return ctx->vtable.vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max );
+}
+
+
+/*
+ * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
+ * a value of 0 means fully transparent. If per-pixel alpha is also specified then
+ * the overall alpha is per-pixel alpha multiplied by the global alpha
+ */
+VAStatus vaSetSubpictureGlobalAlpha (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ float global_alpha
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaSetSubpictureGlobalAlpha);
+ return ctx->vtable.vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
}
+/*
+ vaAssociateSubpicture associates the subpicture with the target_surface.
+ It defines the region mapping between the subpicture and the target
+ surface through source and destination rectangles (with the same width and height).
+ Both will be displayed at the next call to vaPutSurface. Additional
+ associations before the call to vaPutSurface simply overrides the association.
+*/
+VAStatus vaAssociateSubpicture (
+ VADisplay dpy,
+ VASurface *target_surface,
+ VASubpicture *subpicture,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short width,
+ unsigned short height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaAssociateSubpicture);
+ return ctx->vtable.vaAssociateSubpicture ( ctx, target_surface, subpicture, src_x, src_y, dest_x, dest_y, width, height, flags );
+}
+
+
VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
VASurface *surface,
void **buffer, /* out */
diff --git a/src/va.h b/src/va.h
index c03f555..6bdf5a2 100755
--- a/src/va.h
+++ b/src/va.h
@@ -24,7 +24,7 @@
/*
* Video Decode Acceleration API Specification
*
- * Rev. 0.20
+ * Rev. 0.22
* <jonathan.bian@intel.com>
*
* Revision History:
@@ -40,8 +40,11 @@
* and MPEG-2 motion compensation.
* rev 0.19 (08/06/2007 Jonathan Bian) - Removed extra type for bitplane data.
* rev 0.20 (08/08/2007 Jonathan Bian) - Added missing fields to VC-1 PictureParameter structure.
+ * rev 0.21 (08/20/2007 Jonathan Bian) - Added image and subpicture support.
+ * rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha.
*
* Acknowledgements:
+ * Some concepts borrowed from XvMC and XvImage.
* Thanks to Waldo Bastian for many valuable feedbacks.
*/
#ifndef _VA_H_
@@ -54,7 +57,9 @@ extern "C" {
/*
Overview
-This is a decode only interface currently. The basic steps are:
+This is currently a decode only interface (with some rendering support).
+
+The basic operation steps are:
- Negotiate a mutually acceptable configuration with the server to lock
down profile, entrypoints, and other attributes that will not change on
@@ -139,7 +144,9 @@ typedef enum
VAProfileVC1Advanced = 10,
} VAProfile;
-/* Currently defined entrypoints */
+/*
+ * Currently defined entrypoints
+ */
typedef enum
{
VAEntrypointVLD = 1,
@@ -781,7 +788,6 @@ typedef struct _VAPictureH264
#define VA_PICTURE_H264_BOTTOM_FIELD 0x00000004
#define VA_PICTURE_H264_SHORT_TERM_REFERENCE 0x00000008
#define VA_PICTURE_H264_LONG_TERM_REFERENCE 0x00000010
-#define VA_PICTURE_H264_USED_AS_REFERENCE 0x00000020
/* H.264 Picture Parameter Buffer */
/*
@@ -1007,8 +1013,11 @@ VAStatus vaSyncSurface (
typedef enum
{
- VASurfaceRendering = 0,
- VASurfaceReady = 1,
+ VASurfaceRendering = 0, /* Rendering in progress */
+ VASurfaceDisplaying = 1, /* Displaying in progress (not safe to render into it) */
+ /* this status is useful if surface is used as the source */
+ /* of an overlay */
+ VASurfaceReady = 2 /* not being rendered or displayed */
} VASurfaceStatus;
/*
@@ -1032,6 +1041,274 @@ VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
unsigned int *stride /* out */
);
+/*
+ * Images and Subpictures
+ * VAImage is used to either get the surface data to client memory, or
+ * to copy image data in client memory to a surface.
+ * Both images, subpictures and surfaces follow the same 2D coordinate system where origin
+ * is at the upper left corner with positive X to the right and positive Y down
+ */
+#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
+ ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
+ ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
+
+/* a few common FourCCs */
+#define VA_FOURCC_NV12 0x3231564E
+#define VA_FOURCC_AI44 0x34344149
+#define VA_FOURCC_RGBA 0x41424752
+
+typedef struct _VAImageFormat
+{
+ unsigned int fourcc;
+ unsigned int byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
+ unsigned int bits_per_pixel;
+ /* for RGB formats */
+ unsigned int depth; /* significant bits per pixel */
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+ unsigned int alpha_mask;
+} VAImageFormat;
+
+typedef int VAImageID;
+
+typedef struct _VAImage
+{
+ VAImageID image_id; /* uniquely identify this image */
+ VASurfaceID surface_id; /* which surface will this image be associated with */
+ VAImageFormat format;
+ unsigned char *data; /* image data pointer */
+ /* The following fields are set by the library */
+ unsigned short width;
+ unsigned short height;
+ unsigned int data_size;
+ unsigned int num_planes;
+ /*
+ * An array of size num_planes indicating the scanline pitch in bytes.
+ * Each plane may have a different pitch.
+ */
+ unsigned int *pitches;
+ /*
+ * An array of size num_planes indicating the byte offset from
+ * "data" t the start of each plane.
+ */
+ unsigned int *offsets;
+} VAImage;
+
+/* Get maximum number of image formats supported by the implementation */
+int vaMaxNumImageFormats (
+ VADisplay dpy
+);
+
+/*
+ * Query supported image formats
+ * The caller must provide a "format_list" array that can hold at
+ * least vaMaxNumImageFormats() entries. The actual number of formats
+ * returned in "format_list" is returned in "num_formats".
+ */
+VAStatus vaQueryImageFormats (
+ VADisplay dpy,
+ VAImageFormat *format_list, /* out */
+ int *num_formats /* out */
+);
+
+/*
+ * The width and height fields returned in the VAImage structure may get
+ * enlarged for some YUV formats. The size of the data buffer that needs
+ * to be allocated will be given in the "data_size" field in VAImage.
+ * Image data is not allocated by this function. The client should
+ * allocate the memory and fill in the VAImage structure's data field
+ * after looking at "data_size" returned from the library.
+ */
+VAStatus vaCreateImage (
+ VADisplay dpy,
+ VAImageFormat *format,
+ int width,
+ int height,
+ VAImage *image /* out */
+);
+
+/*
+ * Should call DestroyImage before destroying the surface it is bound to
+ */
+VAStatus vaDestroyImage (
+ VADisplay dpy,
+ VAImage *image
+);
+
+/*
+ * Retrive surface data into a VAImage
+ * Image must be in a format supported by the implementation
+ */
+VAStatus vaGetImage (
+ VADisplay dpy,
+ VASurface *surface,
+ int x, /* coordinates of the upper left source pixel */
+ int y,
+ unsigned int width, /* width and height of the region */
+ unsigned int height,
+ VAImage *image
+);
+
+/*
+ * Copy data from a VAImage to a surface
+ * Image must be in a format supported by the implementation
+ */
+VAStatus vaPutImage (
+ VADisplay dpy,
+ VASurface *surface,
+ VAImage *image,
+ int src_x,
+ int src_y,
+ unsigned int width,
+ unsigned int height,
+ int dest_x,
+ int dest_y
+);
+
+/*
+ * Subpictures
+ * Subpicture is a special type of image that can be blended
+ * with a surface during vaPutSurface(). Subpicture can be used to render
+ * DVD sub-titles or closed captioning text etc.
+ */
+
+typedef int VASubpictureID;
+
+typedef struct _VASubpicture
+{
+ VASubpictureID subpicture_id; /* uniquely identify this subpicture */
+ VASurfaceID surface_id; /* which surface does this subpicture associate with */
+ VAImageID image_id;
+ /* The following fields are set by the library */
+ int num_palette_entries; /* paletted formats only. set to zero for image without palettes */
+ /*
+ * Each component is one byte and entry_bytes indicates the number of components in
+ * each entry (eg. 3 for YUV palette entries). set to zero for image without palettes
+ */
+ int entry_bytes;
+ /*
+ * An array of ascii characters describing teh order of the components within the bytes.
+ * Only entry_bytes characters of the string are used.
+ */
+ char component_order[4];
+
+ /* chromakey range */
+ unsigned int chromakey_min;
+ unsigned int chromakey_max;
+
+ /* global alpha */
+ unsigned int global_alpha;
+
+ /* flags */
+ unsigned int flags; /* see below */
+} VASubpicture;
+
+/* flags for subpictures */
+#define VA_SUBPICTURE_CHROMA_KEYING 0x0001
+#define VA_SUBPICTURE_GLOBAL_ALPHA 0x0002
+
+/* Get maximum number of subpicture formats supported by the implementation */
+int vaMaxNumSubpictureFormats (
+ VADisplay dpy
+);
+
+/*
+ * Query supported subpicture formats
+ * The caller must provide a "format_list" array that can hold at
+ * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
+ * for each format to indicate additional capabilities for that format. The actual
+ * number of formats returned in "format_list" is returned in "num_formats".
+ */
+VAStatus vaQuerySubpictureFormats (
+ VADisplay dpy,
+ VAImageFormat *format_list, /* out */
+ unsigned int *flags, /* out */
+ unsigned int *num_formats /* out */
+);
+
+/*
+ * Subpictures are created with an image associated.
+ */
+VAStatus vaCreateSubpicture (
+ VADisplay dpy,
+ VAImage *image,
+ VASubpicture *subpicture /* out */
+);
+
+/*
+ * Destroy the subpicture before destroying the image it is assocated to
+ */
+VAStatus vaDestroySubpicture (
+ VADisplay dpy,
+ VASubpicture *subpicture
+);
+
+VAStatus vaSetSubpicturePalette (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ /*
+ * pointer to an array holding the palette data. The size of the array is
+ * num_palette_entries * entry_bytes in size. The order of the components
+ * in the palette is described by the component_order in VASubpicture struct
+ */
+ unsigned char *palette
+);
+
+/*
+ * If chromakey is enabled, then the area where the source value falls within
+ * the chromakey [min, max] range is transparent
+ */
+VAStatus vaSetSubpictureChromakey (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ unsigned int chromakey_min,
+ unsigned int chromakey_max
+);
+
+/*
+ * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
+ * a value of 0 means fully transparent. If per-pixel alpha is also specified then
+ * the overall alpha is per-pixel alpha multiplied by the global alpha
+ */
+VAStatus vaSetSubpictureGlobalAlpha (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ float global_alpha
+);
+
+/*
+ vaAssociateSubpicture associates the subpicture with the target_surface.
+ It defines the region mapping between the subpicture and the target
+ surface through source and destination rectangles (with the same width and height).
+ Both will be displayed at the next call to vaPutSurface. Additional
+ associations before the call to vaPutSurface simply overrides the association.
+*/
+VAStatus vaAssociateSubpicture (
+ VADisplay dpy,
+ VASurface *target_surface,
+ VASubpicture *subpicture,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short width,
+ unsigned short height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+);
+
+typedef struct _VARectangle
+{
+ short x;
+ short y;
+ unsigned short width;
+ unsigned short height;
+} VARectangle;
+
#ifdef __cplusplus
}
#endif
@@ -1165,4 +1442,22 @@ Mostly to demonstrate program flow with no error handling ...
/* all slices have been sent, mark the end for this frame */
vaEndPicture(dpy, context);
+
+ /* The following code demonstrates rendering a sub-title with the target surface */
+ /* Find out supported Subpicture formats */
+ VAImageFormat sub_formats[4];
+ int num_formats;
+ vaQuerySubpictureFormats(dpy, sub_formats, &num_formats);
+ /* Assume that we find AI44 as a subpicture format in sub_formats[0] */
+ VAImage sub_image;
+ VASubpicture subpicture;
+ unsigned char sub_data[128][16];
+ /* fill sub_data with subtitle in AI44 */
+ vaCreateImage(dpy, surfaces, sub_formats, 128, 16, sub_data, &sub_image);
+ vaCreateSubpicture(dpy, &sub_image, &subpicture);
+ unsigned char palette[3][16];
+ /* fill the palette data */
+ vaSetSubpicturePalette(dpy, &subpicture, palette);
+ vaAssociateSubpicture(dpy, surfaces, &subpicture, 0, 0, 296, 400, 128, 16);
+ vaPutSurface(dpy, surfaces, win, 0, 0, 720, 480, 100, 100, 640, 480, NULL, 0, 0);
#endif
diff --git a/src/va_backend.h b/src/va_backend.h
index 7a0c1e0..5cfef4e 100755
--- a/src/va_backend.h
+++ b/src/va_backend.h
@@ -46,19 +46,21 @@ struct VADriverContext
int max_profiles;
int max_entrypoints;
int max_attributes;
+ int max_image_formats;
+ int max_subpic_formats;
void *handle; /* dlopen handle */
void *pDriverData;
struct
{
- VAStatus (*vaTerminate) ( VADriverContextP ctx );
+ VAStatus (*vaTerminate) ( VADriverContextP ctx );
- VAStatus (*vaQueryConfigProfiles) (
+ VAStatus (*vaQueryConfigProfiles) (
VADriverContextP ctx,
VAProfile *profile_list, /* out */
int *num_profiles /* out */
);
- VAStatus (*vaQueryConfigEntrypoints) (
+ VAStatus (*vaQueryConfigEntrypoints) (
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint *entrypoint_list, /* out */
@@ -201,9 +203,111 @@ struct VADriverContext
short desty,
unsigned short destw,
unsigned short desth,
+ VARectangle *cliprects, /* client supplied clip list */
+ unsigned int number_cliprects, /* number of clip rects in the clip list */
int flags /* de-interlacing flags */
);
+ VAStatus (*vaQueryImageFormats) (
+ VADriverContextP ctx,
+ VAImageFormat *format_list, /* out */
+ int *num_formats /* out */
+ );
+
+ VAStatus (*vaCreateImage) (
+ VADriverContextP ctx,
+ VAImageFormat *format,
+ int width,
+ int height,
+ VAImage *image /* out */
+ );
+
+ VAStatus (*vaDestroyImage) (
+ VADriverContextP ctx,
+ VAImage *image
+ );
+
+ VAStatus (*vaGetImage) (
+ VADriverContextP ctx,
+ VASurface *surface,
+ int x, /* coordinates of the upper left source pixel */
+ int y,
+ unsigned int width, /* width and height of the region */
+ unsigned int height,
+ VAImage *image
+ );
+
+ VAStatus (*vaPutImage) (
+ VADriverContextP ctx,
+ VASurface *surface,
+ VAImage *image,
+ int src_x,
+ int src_y,
+ unsigned int width,
+ unsigned int height,
+ int dest_x,
+ int dest_y
+ );
+
+ VAStatus (*vaQuerySubpictureFormats) (
+ VADriverContextP ctx,
+ VAImageFormat *format_list, /* out */
+ unsigned int *flags, /* out */
+ unsigned int *num_formats /* out */
+ );
+
+ VAStatus (*vaCreateSubpicture) (
+ VADriverContextP ctx,
+ VAImage *image,
+ VASubpicture *subpicture /* out */
+ );
+
+ VAStatus (*vaDestroySubpicture) (
+ VADriverContextP ctx,
+ VASubpicture *subpicture
+ );
+
+ VAStatus (*vaSetSubpicturePalette) (
+ VADriverContextP ctx,
+ VASubpicture *subpicture,
+ /*
+ * pointer to an array holding the palette data. The size of the array is
+ * num_palette_entries * entry_bytes in size. The order of the components
+ * in the palette is described by the component_order in VASubpicture struct
+ */
+ unsigned char *palette
+ );
+
+ VAStatus (*vaSetSubpictureChromakey) (
+ VADriverContextP ctx,
+ VASubpicture *subpicture,
+ unsigned int chromakey_min,
+ unsigned int chromakey_max
+ );
+
+ VAStatus (*vaSetSubpictureGlobalAlpha) (
+ VADriverContextP ctx,
+ VASubpicture *subpicture,
+ float global_alpha
+ );
+
+ VAStatus (*vaAssociateSubpicture) (
+ VADriverContextP ctx,
+ VASurface *target_surface,
+ VASubpicture *subpicture,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short width,
+ unsigned short height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+ );
+
VAStatus (*vaDbgCopySurfaceToBuffer) (
VADriverContextP ctx,
VASurface *surface,
diff --git a/src/va_x11.h b/src/va_x11.h
index 60c29b2..a6ed9a7 100755
--- a/src/va_x11.h
+++ b/src/va_x11.h
@@ -44,6 +44,8 @@ VAStatus vaPutSurface (
short desty,
unsigned short destw,
unsigned short desth,
+ VARectangle *cliprects, /* client supplied clip list */
+ unsigned int number_cliprects, /* number of clip rects in the clip list */
int flags /* de-interlacing flags */
);