[vlc-devel] libvlc access to each frame..

buhochileno at gmail.com buhochileno at gmail.com
Sun Mar 22 05:41:32 CET 2009


basos g wrote:
>
>
>
>         You could implement a video filter (extfilter) (taking another
>         as a
>         guideline (e.g. blur or motion detect) that has a
>          p_sys->pf_frame_callback ( picture_t*) function pointer.
>         Also you could init this pointer with a config var (e.g.
>         --extfilter-filter-callback=0x43454343 )
>
>          
>
>     no idea where to start to look on the vlc code...Do you know if it
>     is posible to access to that function pointer from libvlc? (in
>     that way I can make a wraper for that  function pointer...)
>
>
> Take another video filter as a guideline and impement a new one that 
> does not filter the picture but instead calls an external to libvlc 
> function callback.
> For this to be accompished your new filter should accept a 
> configuration parameter that should carry that external functions 
> address.
> When your ext program should intialize libvlc (libvlc_new) it should 
> provide this parameter.
> For example :
>
> void MyFilterCallback( picture_t* p_in, picture_t* p_out )
> {
>    // make proccessing on p_in,
>    // store on the preallocated p_out
> }
>
> void main()
> {
>  
>     char* psz_callback;
>
>     sprintf( psz_callback, "%x", MyFilterCallback )
>
>      char* args[10];
>      args[0] = "--video-filte"; args[1] = "extfilter"
>      args[2] = "--extfilter-callback" ; args[3] = psz_callback
>      args[4] = NULL ;
>
>  
>      libvlc_new (args ) ;
>    //...........
>  
> }
>
>
> The callback config could be of type string and parsed inside the 
> extfilter init function as a pointer.
> It could be of type int but i don't know if is a long long (64 bit) or 
> just long (32 bit). On the latter case it could not store a hole 
> function pointer on the new 64 bit platforms. This detail needs 
> special care anyway.
>
>  
>  
>
>         have a Filter function on the extfilter filter like this ( no
>         memory management code on this example) :
>
>         Filter( p_pic )
>         {
>           if ( p_sys->pf_frame_callback )
>                p_out = p_sys->pf_frame_callback( p_pic )
>           else
>                p_out = p_pic  ;
>          return p_pic
>         }
>
>
>
>         Also with the internal vlc_includes you could apply
>         modification or
>         filters to the picture_t struct.
>
>          
>
>     the filters need to be compiled wih vlc?
>
>
> Maybe there are other ways (look in wiki.videolan.org 
> <http://wiki.videolan.org> and forum.videolan.org 
> <http://forum.videolan.org>)
>
> But i suggest to waste some time making your own vlc build and that 
> hack on top of it. There are nice build tutorial on the wiki (look for 
> compile vlc). But you may have to make a bigger effort when compiling 
> on windows.
>  
> Good luck
>  basos
>
Ok, I get the idea, so step 1 for me: write a basic simple working C 
example using libvlc (currently I have a couple using libvlc from c#, 
best to start trying directly from C to start, so do you have one 
arround?, I find one on the vlc wiki but is for libvlc/vlc 0.8 and many 
things change..). Step 2: add the "callback filter" as in the example 
that you show me also directly in C to start and ....Step 3: add a 
delegate from c# as the callback to that filter...

Also about compiling vlc, yeap I compile vlc a couple of times, but 
where can I find in the code the motion or other filters to take a look 
as examples?

Thanks for your time and patience basos...

Mauricio

PS: Trying to use ffmpeg functions from c# is very frustrating 
(currently I able to simple decode and encode frames, but try to write 
packages into a rtp session is a diferent history...), ffmpeg changes 
structures to often and if you add to that mono memory/marshalling 
problems it can be a nightmare, so after fighting a lot I think that is 
best to use vlc that do the job pretty well, only need to interact with 
the frames to do the image analisys...

Thanks again, and hope that you can give some directions and help about 
this, is very dificult to find help or usefull/updated info in the 
ffmpeg/vlc world...If I make this thing work I promise a wiki :-)

Cheers!!,

> ------------------------------------------------------------------------
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>   




More information about the vlc-devel mailing list