Mercurial > mplayer.hg
diff libmpcodecs/vf.c @ 14878:5723c4b2a2ea
fixes for encoding of multiple files
- do not uninitialize video encoder between files
- checks for image size & format change moved from mencoder.c to vfilters
by Oded Shimon <ods15@ods15.dyndns.org>
| author | henry |
|---|---|
| date | Tue, 01 Mar 2005 20:21:58 +0000 |
| parents | 1fab95e4513c |
| children | c36a814cdca0 |
line wrap: on
line diff
--- a/libmpcodecs/vf.c Tue Mar 01 20:16:49 2005 +0000 +++ b/libmpcodecs/vf.c Tue Mar 01 20:21:58 2005 +0000 @@ -541,6 +541,37 @@ dst->qscale= src->qscale; } } +/** + * \brief Video config() function wrapper + * + * Blocks config() calls with different size or format for filters + * with VFCAP_CONSTANT + * + * First call is redirected to vf->config. + * + * In following calls, it verifies that the configuration parameters + * are unchanged, and returns either success or error. + * +*/ +int vf_config_wrapper(struct vf_instance_s* vf, + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) +{ + if ((vf->default_caps&VFCAP_CONSTANT) && vf->fmt.have_configured) { + if ((vf->fmt.orig_width != width) + || (vf->fmt.orig_height != height) + || (vf->fmt.orig_fmt != outfmt)) { + mp_msg(MSGT_VFILTER,MSGL_FATAL,MSGTR_ResolutionDoesntMatch); + return 0; + } + return 1; + } + vf->fmt.have_configured = 1; + vf->fmt.orig_height = height; + vf->fmt.orig_width = width; + vf->fmt.orig_fmt = outfmt; + vf->config(vf, width, height, d_width, d_height, flags, outfmt); +} int vf_next_config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, @@ -571,7 +602,7 @@ vf->next=vf2; } vf->next->w = width; vf->next->h = height; - return vf->next->config(vf->next,width,height,d_width,d_height,voflags,outfmt); + return vf_config_wrapper(vf->next,width,height,d_width,d_height,voflags,outfmt); } int vf_next_control(struct vf_instance_s* vf, int request, void* data){
