[MPlayer-dev-eng] mp-g2 pre14
Fabian Franz
FabianFranz at gmx.de
Mon Apr 21 23:20:10 CEST 2003
Am Montag, 21. April 2003 22:23 schrieb Arpi:
> 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:
nice, that was waht I thought after the reply, but you were faster :-)
>
>
> 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;
> }
This filter does always the same afais.
So you could also encapsulate it in some function like:
static mp_image_t* process_image(vf_dunno_t* vf, mp_image_t* mpi, void*
render, void* filter)
That would have this concept, which would allow auto-inserting, but also allow
filters to consist just out of one render and one filter-function!
simplicity and functionality.
Hm, would this work ? Or did I overlook again something ?
cu
Fabian
>
> 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
>
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
More information about the MPlayer-dev-eng
mailing list