[MPlayer-cvslog] r28731 - trunk/libvo/vo_vdpau.c

reimar subversion at mplayerhq.hu
Wed Feb 25 13:01:01 CET 2009


Author: reimar
Date: Wed Feb 25 13:01:00 2009
New Revision: 28731

Log:
Change code to actually work when NUM_OUTPUT_SURFACES is changed.

Modified:
   trunk/libvo/vo_vdpau.c

Modified: trunk/libvo/vo_vdpau.c
==============================================================================
--- trunk/libvo/vo_vdpau.c	Wed Feb 25 10:32:32 2009	(r28730)
+++ trunk/libvo/vo_vdpau.c	Wed Feb 25 13:01:00 2009	(r28731)
@@ -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      
 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                
 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,
 
     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,
 
     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")



More information about the MPlayer-cvslog mailing list