changeset 36332:9de70162224b

Avoid reinitializing VDPAU on e.g. simple aspect changes. This avoids decode error if frames from before the aspect change are used as reference frames after. It also reduces the issues when using VDPAU together with -lavdopts threads=n
author reimar
date Wed, 21 Aug 2013 18:08:37 +0000
parents 8aac4a73c0d4
children dc90c43a2674
files libvo/vo_vdpau.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_vdpau.c	Wed Aug 21 18:08:25 2013 +0000
+++ b/libvo/vo_vdpau.c	Wed Aug 21 18:08:37 2013 +0000
@@ -690,6 +690,15 @@
 #endif
     flip = flags & VOFLAG_FLIPPING;
 
+    if (image_format == format &&
+        vid_width    == width  &&
+        vid_height   == height) {
+        // at most aspect change, avoid reinit
+        vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height,
+                                flags, CopyFromParent, "vdpau", title);
+        resize();
+        return 0;
+    }
     image_format = format;
     vid_width    = width;
     vid_height   = height;
@@ -1118,6 +1127,9 @@
 static int query_format(uint32_t format)
 {
     int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED | VFCAP_FLIP;
+    // if we are already using it we obviously support it
+    if (format == image_format && decoder != VDP_INVALID_HANDLE)
+        return default_flags;
     switch (format) {
     case IMGFMT_BGRA:
         if (force_mixer)
@@ -1251,6 +1263,9 @@
 static int preinit(const char *arg)
 {
     int i;
+    image_format = 0;
+    vid_width    = 0;
+    vid_height   = 0;
 
     deint = 0;
     deint_type = 3;