2002-04-06 22:05:01 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2002-05-25 13:22:28 +00:00
|
|
|
#ifdef HAVE_MALLOC_H
|
|
|
|
#include <malloc.h>
|
|
|
|
#endif
|
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
#include "../config.h"
|
|
|
|
#include "../mp_msg.h"
|
|
|
|
|
2002-04-13 19:14:34 +00:00
|
|
|
#include "img_format.h"
|
|
|
|
#include "mp_image.h"
|
2002-04-06 22:05:01 +00:00
|
|
|
#include "vf.h"
|
|
|
|
|
|
|
|
extern vf_info_t vf_info_vo;
|
|
|
|
extern vf_info_t vf_info_crop;
|
|
|
|
extern vf_info_t vf_info_expand;
|
2002-04-07 03:20:41 +00:00
|
|
|
extern vf_info_t vf_info_pp;
|
2002-04-07 20:21:37 +00:00
|
|
|
extern vf_info_t vf_info_scale;
|
2002-04-26 19:46:36 +00:00
|
|
|
#ifdef USE_LIBFAME
|
2002-04-08 23:12:22 +00:00
|
|
|
extern vf_info_t vf_info_fame;
|
2002-04-26 19:46:36 +00:00
|
|
|
#endif
|
2002-04-09 14:01:53 +00:00
|
|
|
extern vf_info_t vf_info_format;
|
|
|
|
extern vf_info_t vf_info_yuy2;
|
2002-04-11 03:17:14 +00:00
|
|
|
extern vf_info_t vf_info_flip;
|
2002-04-13 14:18:57 +00:00
|
|
|
extern vf_info_t vf_info_rgb2bgr;
|
2002-04-19 02:18:46 +00:00
|
|
|
extern vf_info_t vf_info_rotate;
|
2002-04-21 14:36:36 +00:00
|
|
|
extern vf_info_t vf_info_mirror;
|
2002-04-21 17:22:37 +00:00
|
|
|
extern vf_info_t vf_info_palette;
|
2002-04-27 23:34:44 +00:00
|
|
|
extern vf_info_t vf_info_lavc;
|
2002-05-06 22:48:22 +00:00
|
|
|
extern vf_info_t vf_info_dvbscale;
|
2002-05-12 19:06:54 +00:00
|
|
|
extern vf_info_t vf_info_cropdetect;
|
2002-06-03 14:13:28 +00:00
|
|
|
extern vf_info_t vf_info_test;
|
2002-06-14 01:14:56 +00:00
|
|
|
extern vf_info_t vf_info_noise;
|
2002-06-21 17:38:06 +00:00
|
|
|
extern vf_info_t vf_info_yvu9;
|
2002-04-06 22:05:01 +00:00
|
|
|
|
|
|
|
char** vo_plugin_args=(char**) NULL;
|
|
|
|
|
|
|
|
// list of available filters:
|
|
|
|
static vf_info_t* filter_list[]={
|
|
|
|
&vf_info_crop,
|
|
|
|
&vf_info_expand,
|
2002-04-07 03:20:41 +00:00
|
|
|
&vf_info_pp,
|
2002-04-07 20:21:37 +00:00
|
|
|
&vf_info_scale,
|
2002-04-06 22:05:01 +00:00
|
|
|
// &vf_info_osd,
|
|
|
|
&vf_info_vo,
|
2002-04-26 19:46:36 +00:00
|
|
|
#ifdef USE_LIBFAME
|
2002-04-08 23:12:22 +00:00
|
|
|
&vf_info_fame,
|
2002-04-26 19:46:36 +00:00
|
|
|
#endif
|
2002-04-09 14:01:53 +00:00
|
|
|
&vf_info_format,
|
|
|
|
&vf_info_yuy2,
|
2002-04-11 03:17:14 +00:00
|
|
|
&vf_info_flip,
|
2002-04-13 14:18:57 +00:00
|
|
|
&vf_info_rgb2bgr,
|
2002-04-19 02:18:46 +00:00
|
|
|
&vf_info_rotate,
|
2002-04-21 14:36:36 +00:00
|
|
|
&vf_info_mirror,
|
2002-04-21 17:22:37 +00:00
|
|
|
&vf_info_palette,
|
2002-04-27 23:35:23 +00:00
|
|
|
#ifdef USE_LIBAVCODEC
|
2002-04-27 23:34:44 +00:00
|
|
|
&vf_info_lavc,
|
2002-04-27 23:35:23 +00:00
|
|
|
#endif
|
2002-05-06 22:48:22 +00:00
|
|
|
&vf_info_dvbscale,
|
2002-05-12 19:06:54 +00:00
|
|
|
&vf_info_cropdetect,
|
2002-06-03 14:13:28 +00:00
|
|
|
&vf_info_test,
|
2002-06-14 01:14:56 +00:00
|
|
|
&vf_info_noise,
|
2002-06-21 17:38:06 +00:00
|
|
|
&vf_info_yvu9,
|
2002-04-06 22:05:01 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
// mpi stuff:
|
|
|
|
|
2002-04-17 19:05:14 +00:00
|
|
|
void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){
|
|
|
|
int y;
|
|
|
|
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
2002-04-17 21:50:25 +00:00
|
|
|
y0&=~1;h+=h&1;
|
2002-04-17 19:51:24 +00:00
|
|
|
if(x0==0 && w==mpi->width){
|
2002-04-17 19:05:14 +00:00
|
|
|
// full width clear:
|
|
|
|
memset(mpi->planes[0]+mpi->stride[0]*y0,0,mpi->stride[0]*h);
|
|
|
|
memset(mpi->planes[1]+mpi->stride[1]*(y0>>1),128,mpi->stride[1]*(h>>1));
|
|
|
|
memset(mpi->planes[2]+mpi->stride[2]*(y0>>1),128,mpi->stride[2]*(h>>1));
|
2002-04-17 21:50:25 +00:00
|
|
|
} else
|
2002-04-17 19:05:14 +00:00
|
|
|
for(y=y0;y<y0+h;y+=2){
|
|
|
|
memset(mpi->planes[0]+x0+mpi->stride[0]*y,0,w);
|
|
|
|
memset(mpi->planes[0]+x0+mpi->stride[0]*(y+1),0,w);
|
|
|
|
memset(mpi->planes[1]+(x0>>1)+mpi->stride[1]*(y>>1),128,(w>>1));
|
|
|
|
memset(mpi->planes[2]+(x0>>1)+mpi->stride[2]*(y>>1),128,(w>>1));
|
|
|
|
}
|
2002-04-17 21:50:25 +00:00
|
|
|
return;
|
2002-04-17 19:05:14 +00:00
|
|
|
}
|
|
|
|
// packed:
|
|
|
|
for(y=y0;y<y0+h;y++){
|
|
|
|
unsigned char* dst=mpi->planes[0]+mpi->stride[0]*y+(mpi->bpp>>3)*x0;
|
|
|
|
if(mpi->flags&MP_IMGFLAG_YUV){
|
2002-05-20 03:25:26 +00:00
|
|
|
unsigned int* p=(unsigned int*) dst;
|
2002-04-17 19:05:14 +00:00
|
|
|
int size=(mpi->bpp>>3)*w/4;
|
|
|
|
int i;
|
|
|
|
if(mpi->flags&MP_IMGFLAG_SWAPPED){
|
|
|
|
for(i=0;i<size;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=0x00800080;
|
|
|
|
for(;i<size;i++) p[i]=0x00800080;
|
|
|
|
} else {
|
|
|
|
for(i=0;i<size;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=0x80008000;
|
|
|
|
for(;i<size;i++) p[i]=0x80008000;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
memset(dst,0,(mpi->bpp>>3)*w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h){
|
|
|
|
mp_image_t* mpi=NULL;
|
|
|
|
int w2=w; //(mp_imgflag&MP_IMGFLAG_ACCEPT_STRIDE)?((w+15)&(~15)):w;
|
2002-05-06 22:48:22 +00:00
|
|
|
|
|
|
|
if(vf->put_image==vf_next_put_image){
|
|
|
|
// passthru mode, if the plugin uses the fallback/default put_image() code
|
|
|
|
return vf_get_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h);
|
|
|
|
}
|
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
// Note: we should call libvo first to check if it supports direct rendering
|
|
|
|
// and if not, then fallback to software buffers:
|
|
|
|
switch(mp_imgtype){
|
|
|
|
case MP_IMGTYPE_EXPORT:
|
|
|
|
if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=new_mp_image(w2,h);
|
|
|
|
mpi=vf->imgctx.export_images[0];
|
|
|
|
break;
|
|
|
|
case MP_IMGTYPE_STATIC:
|
|
|
|
if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=new_mp_image(w2,h);
|
|
|
|
mpi=vf->imgctx.static_images[0];
|
|
|
|
break;
|
|
|
|
case MP_IMGTYPE_TEMP:
|
|
|
|
if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h);
|
|
|
|
mpi=vf->imgctx.temp_images[0];
|
|
|
|
break;
|
|
|
|
case MP_IMGTYPE_IPB:
|
|
|
|
if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame:
|
|
|
|
if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h);
|
|
|
|
mpi=vf->imgctx.temp_images[0];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MP_IMGTYPE_IP:
|
|
|
|
if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=new_mp_image(w2,h);
|
|
|
|
mpi=vf->imgctx.static_images[vf->imgctx.static_idx];
|
|
|
|
vf->imgctx.static_idx^=1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(mpi){
|
|
|
|
mpi->type=mp_imgtype;
|
|
|
|
mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT);
|
|
|
|
mpi->flags|=mp_imgflag&(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH|MP_IMGFLAG_ALIGNED_STRIDE|MP_IMGFLAG_DRAW_CALLBACK);
|
|
|
|
if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
|
|
|
|
if((mpi->width!=w2 || mpi->height!=h) && !(mpi->flags&MP_IMGFLAG_DIRECT)){
|
|
|
|
mpi->width=w2;
|
|
|
|
mpi->height=h;
|
|
|
|
if(mpi->flags&MP_IMGFLAG_ALLOCATED){
|
|
|
|
// need to re-allocate buffer memory:
|
|
|
|
free(mpi->planes[0]);
|
|
|
|
mpi->flags&=~MP_IMGFLAG_ALLOCATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!mpi->bpp) mp_image_setfmt(mpi,outfmt);
|
|
|
|
if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){
|
|
|
|
|
|
|
|
// check libvo first!
|
|
|
|
if(vf->get_image) vf->get_image(vf,mpi);
|
|
|
|
|
|
|
|
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
|
|
|
|
// non-direct and not yet allocaed image. allocate it!
|
2002-04-07 21:36:39 +00:00
|
|
|
mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8);
|
2002-04-06 22:05:01 +00:00
|
|
|
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
2002-06-21 17:38:06 +00:00
|
|
|
// YV12/I420/YVU9. feel free to add other planar formats here...
|
2002-04-06 22:05:01 +00:00
|
|
|
if(!mpi->stride[0]) mpi->stride[0]=mpi->width;
|
2002-06-21 17:38:06 +00:00
|
|
|
if (!mpi->stride[1])
|
|
|
|
{
|
|
|
|
if (mpi->imgfmt == IMGFMT_YVU9)
|
|
|
|
mpi->stride[1]=mpi->stride[2]=mpi->width/4;
|
|
|
|
else
|
|
|
|
mpi->stride[1]=mpi->stride[2]=mpi->width/2;
|
|
|
|
}
|
2002-04-06 22:05:01 +00:00
|
|
|
if(mpi->flags&MP_IMGFLAG_SWAPPED){
|
|
|
|
// I420/IYUV (Y,U,V)
|
|
|
|
mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height;
|
|
|
|
mpi->planes[2]=mpi->planes[1]+(mpi->width>>1)*(mpi->height>>1);
|
|
|
|
} else {
|
|
|
|
// YV12,YVU9 (Y,V,U)
|
|
|
|
mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height;
|
2002-06-21 17:38:06 +00:00
|
|
|
if (mpi->imgfmt == IMGFMT_YVU9)
|
|
|
|
mpi->planes[1]=mpi->planes[2]+(mpi->width>>2)*(mpi->height>>2);
|
|
|
|
else
|
|
|
|
mpi->planes[1]=mpi->planes[2]+(mpi->width>>1)*(mpi->height>>1);
|
2002-04-06 22:05:01 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8;
|
|
|
|
}
|
2002-04-17 19:51:24 +00:00
|
|
|
vf_mpi_clear(mpi,0,0,mpi->width,mpi->height);
|
2002-04-06 22:05:01 +00:00
|
|
|
mpi->flags|=MP_IMGFLAG_ALLOCATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){
|
2002-05-20 03:25:26 +00:00
|
|
|
mp_msg(MSGT_DECVIDEO,MSGL_V,"*** [%s] %s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n",
|
2002-04-06 22:05:01 +00:00
|
|
|
vf->info->name,
|
|
|
|
(mpi->type==MP_IMGTYPE_EXPORT)?"Exporting":
|
|
|
|
((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"),
|
|
|
|
mpi->width,mpi->height,mpi->bpp,
|
|
|
|
(mpi->flags&MP_IMGFLAG_YUV)?"YUV":"RGB",
|
|
|
|
(mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed",
|
|
|
|
mpi->bpp*mpi->width*mpi->height/8);
|
2002-06-21 17:38:06 +00:00
|
|
|
mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %x,%x,%x strides: %d,%d,%d)\n",
|
|
|
|
mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2],
|
|
|
|
mpi->stride[0], mpi->stride[1], mpi->stride[2]);
|
2002-04-06 22:05:01 +00:00
|
|
|
mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return mpi;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2002-04-10 23:23:36 +00:00
|
|
|
vf_instance_t* vf_open_plugin(vf_info_t** filter_list, vf_instance_t* next, char *name, char *args){
|
2002-04-06 22:05:01 +00:00
|
|
|
vf_instance_t* vf;
|
|
|
|
int i;
|
|
|
|
for(i=0;;i++){
|
|
|
|
if(!filter_list[i]){
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_ERR,"Couldn't find video filter '%s'\n",name);
|
|
|
|
return NULL; // no such filter!
|
|
|
|
}
|
|
|
|
if(!strcmp(filter_list[i]->name,name)) break;
|
|
|
|
}
|
|
|
|
vf=malloc(sizeof(vf_instance_t));
|
|
|
|
memset(vf,0,sizeof(vf_instance_t));
|
|
|
|
vf->info=filter_list[i];
|
|
|
|
vf->next=next;
|
|
|
|
vf->config=vf_next_config;
|
|
|
|
vf->control=vf_next_control;
|
|
|
|
vf->query_format=vf_next_query_format;
|
|
|
|
vf->put_image=vf_next_put_image;
|
2002-04-11 20:56:17 +00:00
|
|
|
vf->default_caps=VFCAP_ACCEPT_STRIDE;
|
|
|
|
vf->default_reqs=0;
|
2002-04-06 22:05:01 +00:00
|
|
|
if(vf->info->open(vf,args)>0) return vf; // Success!
|
|
|
|
free(vf);
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_ERR,"Couldn't open video filter '%s'\n",name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-04-10 23:23:36 +00:00
|
|
|
vf_instance_t* vf_open_filter(vf_instance_t* next, char *name, char *args){
|
2002-05-20 03:25:26 +00:00
|
|
|
if(strcmp(name,"vo"))
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_INFO,
|
|
|
|
args ? "Opening video filter: [%s=%s]\n"
|
|
|
|
: "Opening video filter: [%s]\n" ,name,args);
|
2002-04-10 23:23:36 +00:00
|
|
|
return vf_open_plugin(filter_list,next,name,args);
|
|
|
|
}
|
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
//============================================================================
|
|
|
|
|
2002-04-11 20:56:17 +00:00
|
|
|
unsigned int vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int preferred){
|
|
|
|
vf_instance_t* vf=*vfp;
|
|
|
|
unsigned int* p;
|
|
|
|
unsigned int best=0;
|
|
|
|
int ret;
|
|
|
|
if((p=list)) while(*p){
|
|
|
|
ret=vf->query_format(vf,*p);
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
|
|
|
|
if(ret&2){ best=*p; break;} // no conversion -> bingo!
|
|
|
|
if(ret&1 && !best) best=*p; // best with conversion
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
if(best) return best; // bingo, they have common csp!
|
|
|
|
// ok, then try with scale:
|
|
|
|
if(vf->info == &vf_info_scale) return 0; // avoid infinite recursion!
|
|
|
|
vf=vf_open_filter(vf,"scale",NULL);
|
|
|
|
if(!vf) return 0; // failed to init "scale"
|
|
|
|
// try the preferred csp first:
|
|
|
|
if(preferred && vf->query_format(vf,preferred)) best=preferred; else
|
|
|
|
// try the list again, now with "scaler" :
|
|
|
|
if((p=list)) while(*p){
|
|
|
|
ret=vf->query_format(vf,*p);
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
|
|
|
|
if(ret&2){ best=*p; break;} // no conversion -> bingo!
|
|
|
|
if(ret&1 && !best) best=*p; // best with conversion
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
if(best) *vfp=vf; // else uninit vf !FIXME!
|
|
|
|
return best;
|
|
|
|
}
|
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
int vf_next_config(struct vf_instance_s* vf,
|
|
|
|
int width, int height, int d_width, int d_height,
|
2002-04-11 20:56:17 +00:00
|
|
|
unsigned int voflags, unsigned int outfmt){
|
|
|
|
int miss;
|
|
|
|
int flags=vf->next->query_format(vf->next,outfmt);
|
|
|
|
if(!flags){
|
|
|
|
// hmm. colorspace mismatch!!!
|
|
|
|
// let's insert the 'scale' filter, it does the job for us:
|
|
|
|
vf_instance_t* vf2;
|
|
|
|
if(vf->next->info==&vf_info_scale) return 0; // scale->scale
|
|
|
|
vf2=vf_open_filter(vf->next,"scale",NULL);
|
|
|
|
if(!vf2) return 0; // shouldn't happen!
|
|
|
|
vf->next=vf2;
|
|
|
|
flags=vf->next->query_format(vf->next,outfmt);
|
|
|
|
if(!flags){
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_ERR,"Cannot find common colorspace, even by inserting 'scale' :(\n");
|
|
|
|
return 0; // FAIL
|
|
|
|
}
|
|
|
|
}
|
2002-05-20 03:25:26 +00:00
|
|
|
mp_msg(MSGT_VFILTER,MSGL_V,"REQ: flags=0x%X req=0x%X \n",flags,vf->default_reqs);
|
2002-04-11 20:56:17 +00:00
|
|
|
miss=vf->default_reqs - (flags&vf->default_reqs);
|
|
|
|
if(miss&VFCAP_ACCEPT_STRIDE){
|
|
|
|
// vf requires stride support but vf->next doesn't support it!
|
|
|
|
// let's insert the 'expand' filter, it does the job for us:
|
|
|
|
vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL);
|
|
|
|
if(!vf2) return 0; // shouldn't happen!
|
|
|
|
vf->next=vf2;
|
|
|
|
}
|
|
|
|
return vf->next->config(vf->next,width,height,d_width,d_height,voflags,outfmt);
|
2002-04-06 22:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int vf_next_control(struct vf_instance_s* vf, int request, void* data){
|
|
|
|
return vf->next->control(vf->next,request,data);
|
|
|
|
}
|
|
|
|
|
|
|
|
int vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt){
|
2002-04-11 20:56:17 +00:00
|
|
|
int flags=vf->next->query_format(vf->next,fmt);
|
|
|
|
if(flags) flags|=vf->default_caps;
|
|
|
|
return flags;
|
2002-04-06 22:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi){
|
2002-05-06 22:48:22 +00:00
|
|
|
vf->next->put_image(vf->next,mpi);
|
2002-04-06 22:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
vf_instance_t* append_filters(vf_instance_t* last){
|
|
|
|
vf_instance_t* vf;
|
2002-04-26 19:38:05 +00:00
|
|
|
char** plugin_args = vo_plugin_args;
|
2002-04-06 22:05:01 +00:00
|
|
|
if(!vo_plugin_args) return last;
|
2002-04-26 19:38:05 +00:00
|
|
|
while(*plugin_args){
|
|
|
|
char* name=strdup(*plugin_args);
|
2002-04-06 22:05:01 +00:00
|
|
|
char* args=strchr(name,'=');
|
|
|
|
if(args){args[0]=0;++args;}
|
|
|
|
vf=vf_open_filter(last,name,args);
|
|
|
|
if(vf) last=vf;
|
|
|
|
free(name);
|
2002-04-26 19:38:05 +00:00
|
|
|
++plugin_args;
|
2002-04-06 22:05:01 +00:00
|
|
|
}
|
|
|
|
return last;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2002-04-20 22:24:19 +00:00
|
|
|
void vf_uninit_filter(vf_instance_t* vf){
|
|
|
|
if(vf->uninit) vf->uninit(vf);
|
|
|
|
free_mp_image(vf->imgctx.static_images[0]);
|
|
|
|
free_mp_image(vf->imgctx.static_images[1]);
|
|
|
|
free_mp_image(vf->imgctx.temp_images[0]);
|
|
|
|
free_mp_image(vf->imgctx.export_images[0]);
|
|
|
|
free(vf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vf_uninit_filter_chain(vf_instance_t* vf){
|
|
|
|
while(vf){
|
|
|
|
vf_instance_t* next=vf->next;
|
|
|
|
vf_uninit_filter(vf);
|
|
|
|
vf=next;
|
|
|
|
}
|
|
|
|
}
|
2002-05-13 21:05:03 +00:00
|
|
|
|
|
|
|
void vf_list_plugins(){
|
|
|
|
int i=0;
|
|
|
|
while(filter_list[i]){
|
|
|
|
mp_msg(MSGT_VFILTER,MSGL_INFO,"\t%-10s: %s\n",filter_list[i]->name,filter_list[i]->info);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|