1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-03 05:22:23 +00:00

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
This commit is contained in:
reimar 2009-02-25 12:01:00 +00:00
parent 0806e4548e
commit 99caf8cc68

View File

@ -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")