changeset 36617:7d4fa6681d2b

vd: Make sure we test the preferred format first. Otherwise vd_ffmpeg will always convert 422 to 420 for e.g. ffh246 since it only needs a stride adjustment.
author reimar
date Thu, 23 Jan 2014 19:36:52 +0000
parents b98f5481ed41
children 9b18f6a45d01
files libmpcodecs/vd.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd.c	Thu Jan 23 19:21:53 2014 +0000
+++ b/libmpcodecs/vd.c	Thu Jan 23 19:36:52 2014 +0000
@@ -152,6 +152,7 @@
                        unsigned int preferred_outfmt)
 {
     int i, j;
+    int only_preferred = 1;
     unsigned int out_fmt = 0;
     int screen_size_x = 0;      //SCREEN_SIZE_X;
     int screen_size_y = 0;      //SCREEN_SIZE_Y;
@@ -189,9 +190,15 @@
     }
 
     j = -1;
-    for (i = 0; i < CODECS_MAX_OUTFMT; i++) {
+    for (i = 0; only_preferred || i < CODECS_MAX_OUTFMT; i++) {
         int flags;
+        if (i == CODECS_MAX_OUTFMT) {
+            i = 0;
+            only_preferred = 0;
+        }
         out_fmt = sh->codec->outfmt[i];
+        if (only_preferred && out_fmt != preferred_outfmt)
+            continue;
         if (out_fmt == (unsigned int) 0xFFFFFFFF)
             continue;
         // check (query) if codec really support this outfmt...