comparison libmpcodecs/vf_ass.c @ 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 e8af23854aa1
children 848835e1b053
comparison
equal deleted inserted replaced
35032:5dcaa3aa2c7b 35033:387485e3956a
73 struct mp_eosd_settings res = {0}; 73 struct mp_eosd_settings res = {0};
74 74
75 if (outfmt == IMGFMT_IF09) 75 if (outfmt == IMGFMT_IF09)
76 return 0; 76 return 0;
77 77
78 vf->priv->outfmt = outfmt;
78 vf->priv->outh = height + ass_top_margin + ass_bottom_margin; 79 vf->priv->outh = height + ass_top_margin + ass_bottom_margin;
79 vf->priv->outw = width; 80 vf->priv->outw = width;
80 81
81 if (!opt_screen_size_x && !opt_screen_size_y) { 82 if (!opt_screen_size_x && !opt_screen_size_y) {
82 d_width = d_width * vf->priv->outw / width; 83 d_width = d_width * vf->priv->outw / width;
364 { 365 {
365 switch (fmt) { 366 switch (fmt) {
366 case IMGFMT_YV12: 367 case IMGFMT_YV12:
367 case IMGFMT_I420: 368 case IMGFMT_I420:
368 case IMGFMT_IYUV: 369 case IMGFMT_IYUV:
369 return vf_next_query_format(vf, vf->priv->outfmt); 370 return vf_next_query_format(vf, fmt) | VFCAP_EOSD;
370 } 371 }
371 return 0; 372 return 0;
372 } 373 }
373 374
374 static int control(vf_instance_t *vf, int request, void *data) 375 static int control(vf_instance_t *vf, int request, void *data)
397 }; 398 };
398 399
399 static int vf_open(vf_instance_t *vf, char *args) 400 static int vf_open(vf_instance_t *vf, char *args)
400 { 401 {
401 int flags; 402 int flags;
402 vf->priv->outfmt = vf_match_csp(&vf->next, fmt_list, IMGFMT_YV12); 403 unsigned outfmt = vf_match_csp(&vf->next, fmt_list, IMGFMT_YV12);
403 if (vf->priv->outfmt) 404 if (outfmt)
404 flags = vf_next_query_format(vf, vf->priv->outfmt); 405 flags = vf_next_query_format(vf, outfmt);
405 if (!vf->priv->outfmt || (vf->priv->auto_insert && flags & VFCAP_EOSD)) { 406 if (!outfmt || (vf->priv->auto_insert && flags & VFCAP_EOSD)) {
406 uninit(vf); 407 uninit(vf);
407 return 0; 408 return 0;
408 } 409 }
409 410
410 if (vf->priv->auto_insert) 411 if (vf->priv->auto_insert)