]> git.sesse.net Git - vlc/commitdiff
vdpau/chroma: remove dead code and simplify
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 7 Jun 2014 14:00:04 +0000 (17:00 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 7 Jun 2014 16:10:58 +0000 (19:10 +0300)
modules/hw/vdpau/chroma.c

index 94747955af75208720feeb1fc0bb46554f8bfd98..fa6367646fcc6480ab3c09cb97ec91896bc7afa8 100644 (file)
@@ -292,24 +292,21 @@ static picture_t *OutputAllocate(filter_t *filter)
     picture_sys_t *psys = pic->p_sys;
     assert(psys->vdp != NULL);
 
-    if (unlikely(sys->vdp != psys->vdp) && (sys->mixer != VDP_INVALID_HANDLE))
-    {
-        Flush(filter); /* release surfaces from the old device */
-        vdp_video_mixer_destroy(sys->vdp, sys->mixer);
-        vdp_release_x11(sys->vdp);
-        sys->mixer = VDP_INVALID_HANDLE;
+    if (likely(sys->mixer != VDP_INVALID_HANDLE))
+    {   /* Not the first output picture */
+        assert(psys->vdp == sys->vdp);
+        return pic;
     }
 
-    if (unlikely(sys->mixer == VDP_INVALID_HANDLE))
-    {
-        sys->vdp = vdp_hold_x11(psys->vdp, NULL);
-        sys->device = psys->device;
-        sys->mixer = MixerCreate(filter);
-        if (sys->mixer == VDP_INVALID_HANDLE)
-            goto error;
-    }
-    return pic;
-error:
+    /* First picture: get the context and allocate the mixer */
+    sys->vdp = vdp_hold_x11(psys->vdp, NULL);
+    sys->device = psys->device;
+    sys->mixer = MixerCreate(filter);
+    if (sys->mixer != VDP_INVALID_HANDLE)
+        return pic;
+
+    vdp_release_x11(psys->vdp);
+    psys->vdp = NULL;
     picture_Release(pic);
     return NULL;
 }