changeset 36319:4e5239ebd43d

Avoid some code duplication.
author reimar
date Fri, 09 Aug 2013 20:11:22 +0000
parents df2964c3d543
children 7129dbdaae8c
files libvo/vo_vdpau.c
diffstat 1 files changed, 4 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_vdpau.c	Fri Aug 09 20:10:54 2013 +0000
+++ b/libvo/vo_vdpau.c	Fri Aug 09 20:11:22 2013 +0000
@@ -346,6 +346,8 @@
     is_preempted = 1;
 }
 
+static void mark_vdpau_objects_uninitialized(void);
+
 /* Initialize vdp_get_proc_address, called from preinit() */
 static int win_x11_init_vdpau_procs(void)
 {
@@ -408,6 +410,8 @@
         {0, NULL}
     };
 
+    mark_vdpau_objects_uninitialized();
+
     vdp_st = vdp_device_create_x11(mDisplay, mScreen,
                                &vdp_device, &vdp_get_proc_address);
     if (vdp_st != VDP_STATUS_OK) {
@@ -654,7 +658,6 @@
         return 0;
     is_preempted = 0;
     mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Attempting to recover from preemption.\n");
-    mark_vdpau_objects_uninitialized();
     if (win_x11_init_vdpau_procs() < 0 ||
         win_x11_init_vdpau_flip_queue() < 0 ||
         create_vdp_mixer(vdp_chroma_type) < 0) {
@@ -1275,16 +1278,6 @@
     if (!vo_init() || win_x11_init_vdpau_procs())
         return -1;
 
-    decoder = VDP_INVALID_HANDLE;
-    for (i = 0; i < MAX_VIDEO_SURFACES; i++)
-        surface_render[i].surface = VDP_INVALID_HANDLE;
-    video_mixer = VDP_INVALID_HANDLE;
-    for (i = 0; i <= NUM_OUTPUT_SURFACES; i++)
-        output_surfaces[i] = VDP_INVALID_HANDLE;
-    vdp_flip_queue = VDP_INVALID_HANDLE;
-    output_surface_width = output_surface_height = -1;
-    rgba_surface = VDP_INVALID_HANDLE;
-
     // full grayscale palette.
     for (i = 0; i < PALETTE_SIZE; ++i)
         palette[i] = (i << 16) | (i << 8) | i;