[MPlayer-dev-eng] mp-g2 pre14
Arpi
arpi at thot.banki.hu
Mon Apr 21 22:23:27 CEST 2003
Hi,
> > Which will be called next, vd can also prepend filters before the first.
> >
> > I don't see, why this won't be possible...
>
> Because this does not accomplish the goal at all. It assumes input and
> output frames are in one-to-one correspondence, and it probably
> wouldn't work at all with dr/slices.
yes, but i've mixed the 2 ideas. what about this code:
mp_image_t* vf_process_image(vf_start){
vf_dunno_t* vf=vf_start;
mp_image_t* mpi=NULL;
// find which filter will produce the image for us:
// (normally this loop goes up to vf_vd, ie to the codec,
// except if any of the filters above us have pending queued images)
while((vf=vf->prev)){
if(vf->process_image)
if((mpi=vf->process_image(vf,NULL))) break;
}
if(!mpi || !vf) return NULL; // error (codec failed?)
// now vf points to the top filter which produced an image: mpi, and
// vf_start points to the bottom filter, where we requested the image
// drive our 'mpi' through the filters from vf to vf_start, including
// the newcomers (auto-inserted filters)
while((vf=vf->next) && vf!=vf_start){
if(vf->process_image)
if(!(mpi=vf->process_image(vf,mpi))) // filter image
return NULL; // some filter inbetween failed :(((((
}
// done.
return mpi;
}
example filter:
static mp_image_t* process_image(vf_dunno_t* vf, mp_image_t* mpi){
mp_image_t* dmpi;
if(!mpi){
if(we have pending images?){
dmpi=vf_get_image(...)
render
return dmpi;
}
return NULL; // no thanks
}
dmpi=vf_get_image(...)
filter mpi into dmpi
while(we need one more image?){
mpi=vf_process_image(vf);
if(!mpi) sorry, no more...
filter mpi into dmpi
}
return dmpi;
}
it should work (in theory, point me posisble problems please).
it allows any filter to insert new filters bellow itself while in
process_image(), and the new filters will be immediately used as soon
as it returns with mpi;
A'rpi / Astral & ESP-team
--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu
More information about the MPlayer-dev-eng
mailing list