[vlc] Movie alphamask with another movie
Antoine Cellerier
dionoea at videolan.org
Sat Jan 19 13:31:11 CET 2008
Alex,
On Fri, Jan 18, 2008, Alex Suter wrote:
> What I'm trying to do is mask a movie stream (say, coming from a
> DVD) with another movie stream (coming from a mp4 or something
> similar on disk). The on-disk mp4 would be a very simple black and
> white silhouette. Anything black on the mp4 would be black in the
> final image. Anything white on the mp4 would show the DVD stream
> in the final image.
>
> I got the alphamask plugin working great, but as you say, it currently
> only takes a static png file. I'd love to be able to use a dynamic movie
> based mask in its place.
>
> Thanks again for any pointers. It's fun code to pore over.
What you need to do is use a picture from a mosaic-bridge output instead
of p_sys->p_mask in modules/video_filter/alphamask.c . The question
is: how do I get this picture? Well it's pretty simple. The mosaic
framework uses a bridge object to forward pictures from one of the
decoder items to the mosaic filter itself. That bridge structure is
defined in modules/video_filter/mosaic.h . To get the bridge, you just
need to call GetBridge( some vlc object ). Once you have the bridge, you
have access to the list of all the available mosaic elementary streams.
Each of those has a string id (psz_id in the bridged_es_t structure).
This id makes it possible to identify the source (at runtime, you define
the id in the mosaic-bridge stream output module using the id=something
option). Looping through the pp_es element of the bridge_t object, you
can thus find the appropriate elementary stream to use as a mask. The
last step is getting the appropriate picture from that bridge elementary
stream structure. The p_picture item is in fact a chained list of
pictures. You'll need to add code like in the while loop line 540 in
modules/video_filter/mosaic.c to handle that list properly and get the
appropriate picture_t pointer. Then you're done I guess. To integrate
that properly with the current alphamask filter you could either: 1/ add
another option to enable using input from the mosaic bridge or 2/ use
the mosaic bridge when the mask is set to something like "mosaic:<id>".
I hope that this big text block will help you with the code. Feel free
to ask if you have any other questions ... and please post the patch
once you're done (and a demo video)!
Regards (and happy hacking),
--
Antoine Cellerier
dionoea
More information about the vlc
mailing list