changeset 35033:387485e3956a

vf_ass: Improve format query. The output format should always match the input format for this filter, and we should set the EOSD capability. This also simplifies adding support for more formats. Patch by Xidorn Quan [quanxunzhen gmail com].
author reimar
date Wed, 29 Aug 2012 16:06:26 +0000
parents 5dcaa3aa2c7b
children 2ade7db5c3bd
files libmpcodecs/vf_ass.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_ass.c	Tue Aug 28 20:47:34 2012 +0000
+++ b/libmpcodecs/vf_ass.c	Wed Aug 29 16:06:26 2012 +0000
@@ -75,6 +75,7 @@
     if (outfmt == IMGFMT_IF09)
         return 0;
 
+    vf->priv->outfmt = outfmt;
     vf->priv->outh = height + ass_top_margin + ass_bottom_margin;
     vf->priv->outw = width;
 
@@ -366,7 +367,7 @@
     case IMGFMT_YV12:
     case IMGFMT_I420:
     case IMGFMT_IYUV:
-        return vf_next_query_format(vf, vf->priv->outfmt);
+        return vf_next_query_format(vf, fmt) | VFCAP_EOSD;
     }
     return 0;
 }
@@ -399,10 +400,10 @@
 static int vf_open(vf_instance_t *vf, char *args)
 {
     int flags;
-    vf->priv->outfmt = vf_match_csp(&vf->next, fmt_list, IMGFMT_YV12);
-    if (vf->priv->outfmt)
-        flags = vf_next_query_format(vf, vf->priv->outfmt);
-    if (!vf->priv->outfmt || (vf->priv->auto_insert && flags & VFCAP_EOSD)) {
+    unsigned outfmt = vf_match_csp(&vf->next, fmt_list, IMGFMT_YV12);
+    if (outfmt)
+        flags = vf_next_query_format(vf, outfmt);
+    if (!outfmt || (vf->priv->auto_insert && flags & VFCAP_EOSD)) {
         uninit(vf);
         return 0;
     }