diff options
author | Holger Kaelberer <holger.k@elberer.de> | 2012-05-15 11:17:25 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-10-05 16:03:34 +0200 |
commit | 0ba6be934d5a675b1f39bd6b3e8f7e16e9165b84 (patch) | |
tree | 1a6d27b098e58ea7414c4c77825112e0a47ce50d | |
parent | ad49d146b4383694213fffca8a903aaecb439b16 (diff) |
subpicture: add support for global-alpha subpictures.
... aka implement vaSetSubpictureGlobalAlpha().
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r-- | src/vdpau_subpic.c | 13 | ||||
-rw-r--r-- | src/vdpau_video_x11.c | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/vdpau_subpic.c b/src/vdpau_subpic.c index 7e8ba79..5e5ef74 100644 --- a/src/vdpau_subpic.c +++ b/src/vdpau_subpic.c @@ -55,20 +55,20 @@ vdpau_subpic_formats_map[VDPAU_MAX_SUBPICTURE_FORMATS + 1] = { { VDP_IMAGE_FORMAT_TYPE_RGBA, VDP_RGBA_FORMAT_B8G8R8A8, { VA_FOURCC('A','R','G','B'), VA_MSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, - 0 }, + VA_SUBPICTURE_GLOBAL_ALPHA }, { VDP_IMAGE_FORMAT_TYPE_RGBA, VDP_RGBA_FORMAT_R8G8B8A8, { VA_FOURCC('A','B','G','R'), VA_MSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, - 0 }, + VA_SUBPICTURE_GLOBAL_ALPHA }, #else { VDP_IMAGE_FORMAT_TYPE_RGBA, VDP_RGBA_FORMAT_B8G8R8A8, { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, - 0 }, + VA_SUBPICTURE_GLOBAL_ALPHA }, { VDP_IMAGE_FORMAT_TYPE_RGBA, VDP_RGBA_FORMAT_R8G8B8A8, { VA_FOURCC('R','G','B','A'), VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, - 0 }, + VA_SUBPICTURE_GLOBAL_ALPHA }, #endif { 0, VDP_INVALID_HANDLE, } }; @@ -197,8 +197,8 @@ subpicture_associate_1( unsigned int flags ) { - /* XXX: flags are not supported */ - if (flags) + /* we only support the VA_SUBPICTURE_GLOBAL_ALPHA flag */ + if (flags & ~VA_SUBPICTURE_GLOBAL_ALPHA) return VA_STATUS_ERROR_FLAG_NOT_SUPPORTED; SubpictureAssociationP assoc = malloc(sizeof(*assoc)); @@ -419,6 +419,7 @@ create_subpicture( obj_subpicture->last_commit = 0; obj_subpicture->vdp_format_type = m->vdp_format_type; obj_subpicture->vdp_format = m->vdp_format; + obj_subpicture->alpha = 1.0; VdpStatus vdp_status; switch (obj_subpicture->vdp_format_type) { diff --git a/src/vdpau_video_x11.c b/src/vdpau_video_x11.c index d0f3976..8171549 100644 --- a/src/vdpau_video_x11.c +++ b/src/vdpau_video_x11.c @@ -502,6 +502,7 @@ render_subpicture( blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; VdpStatus vdp_status; + VdpColor color = { 1.0, 1.0, 1.0, obj_subpicture->alpha }; switch (obj_image->vdp_format_type) { case VDP_IMAGE_FORMAT_TYPE_RGBA: vdp_status = vdpau_output_surface_render_bitmap_surface( @@ -510,7 +511,7 @@ render_subpicture( &dst_rect, obj_subpicture->vdp_bitmap_surface, &src_rect, - NULL, + &color, &blend_state, VDP_OUTPUT_SURFACE_RENDER_ROTATE_0 ); |