# HG changeset patch # User reimar # Date 1235563260 0 # Node ID fdc03572004c2648ae5f6d307acbe96f7049d578 # Parent 127a1f7028736b9098a7f34de72dbeb0dda7ce96 Change code to actually work when NUM_OUTPUT_SURFACES is changed. diff -r 127a1f702873 -r fdc03572004c libvo/vo_vdpau.c --- a/libvo/vo_vdpau.c Wed Feb 25 09:32:32 2009 +0000 +++ b/libvo/vo_vdpau.c Wed Feb 25 12:01:00 2009 +0000 @@ -75,7 +75,7 @@ message, vdp_get_error_string(vdp_st)); /* number of video and output surfaces */ -#define NUM_OUTPUT_SURFACES 3 +#define NUM_OUTPUT_SURFACES 2 #define MAX_VIDEO_SURFACES 50 /* number of palette entries */ @@ -128,7 +128,6 @@ static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle; static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; -/* output_surfaces[2] is used in composite-picture. */ static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface; @@ -142,7 +141,9 @@ static VdpDecoderRender *vdp_decoder_render; static void *vdpau_lib_handle; -static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES]; +/* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */ +#define osd_surface output_surfaces[NUM_OUTPUT_SURFACES] +static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES + 1]; static int output_surface_width, output_surface_height; static VdpVideoMixer video_mixer; @@ -266,7 +267,7 @@ output_surface_height = FFMAX(output_surface_height, vo_dheight); } // Creation of output_surfaces - for (i = 0; i < NUM_OUTPUT_SURFACES; i++) { + for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { if (output_surfaces[i] != VDP_INVALID_HANDLE) vdp_output_surface_destroy(output_surfaces[i]); vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, @@ -585,8 +586,8 @@ pitch = w*2; - // write source_data to output_surfaces[2]. - vdp_st = vdp_output_surface_put_bits_indexed(output_surfaces[2], + // write source_data to osd_surface. + vdp_st = vdp_output_surface_put_bits_indexed(osd_surface, VDP_INDEXED_FORMAT_I8A8, (const void *const*)&index_data, &pitch, @@ -605,7 +606,7 @@ vdp_st = vdp_output_surface_render_output_surface(output_surface, &output_indexed_rect_vid, - output_surfaces[2], + osd_surface, &output_indexed_rect_vid, NULL, &blend_state, @@ -747,7 +748,7 @@ 0); CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") - surface_num = !surface_num; + surface_num = (surface_num + 1) % NUM_OUTPUT_SURFACES; visible_buf = 1; } @@ -888,7 +889,7 @@ vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy") - for (i = 0; i < NUM_OUTPUT_SURFACES; i++) { + for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { vdp_st = vdp_output_surface_destroy(output_surfaces[i]); output_surfaces[i] = VDP_INVALID_HANDLE; CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")