diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-02-25 12:01:00 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-02-25 12:01:00 +0000 |
commit | 99caf8cc681401665b5c3f3f49c015738be0be9f (patch) | |
tree | b99e9c62129c1c86de22321650cbf7e3167769a2 | |
parent | 0806e4548ee90f5491c4213c113798b0ae853989 (diff) |
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28731 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/vo_vdpau.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 4eb7095a83..36190bb11a 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -75,7 +75,7 @@ LIBVO_EXTERN(vdpau) 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 VdpPresentationQueueDisplay *vdp_presentation_queue_display; 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 VdpDecoderDestroy *vdp_decoder_destroy; 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 @@ static void resize(void) 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 @@ static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src, 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 @@ static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src, 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 @@ static void flip_page(void) 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 @@ static void DestroyVdpauObjects(void) 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") |