[vlc-devel] New libvlc_media_player Event

basOS G noxelia at gmail.com
Tue Aug 19 07:22:22 CEST 2008


---------- Forwarded message ----------
For some reason i was not told my message was rejected so i'm trying to send
it again...


2008/8/6 basOS G <noxelia at gmail.com>

> Hello,
>   i'm new to vlc coding. I'm thinking to add a new event to the
> libvlc_media_player that will be triggered when a snapshot is taken.
> For this i have realised that the initial trigger should come from function
> *vout_Snapshot @ **src/video_output/vout_intf.c.**
>
> *I also know that somewhere i should register a new event type to the
> media_player event_manager. The correct place seems to be *
> src/control/media_player.c*. There a new function should be created like
> input_position_changed :
> *
>  * snapshotTaken (Private) (input var "?????" Callback)
>  */
> static int
> snapshotTaken( vlc_object_t * p_this, char const * psz_cmd,
>                      vlc_value_t oldval, vlc_value_t newval,
>                      void * p_userdata )
> {
>     VLC_UNUSED(oldval);
>     libvlc_media_player_t * p_mi = p_userdata;
>     vlc_value_t val;
>
>
>     /*TODO: get value of filename */
>
>     libvlc_event_t event;
>     event.type = libvlc_MediaPlayerSnapshotTaken;
>     /*TODO: Add snapshot filename
>            event.u.media_player_position_changed.new_position =
> val.f_float;
>     */
>
>     libvlc_event_send( p_mi->p_event_manager, &event );
>     return VLC_SUCCESS;
> }
>
> Now the first problem is how do i connect snapshotTaken with a trigger ? In
> libvlc_media_player_play there is a line
> * var_AddCallback( p_input_thread, "snapshot-taken", snapshotTaken, p_mi
> );
> *Im not familiar with the variable subsystem (is there a documentation for
> it?). What does var_AddCallback suppose to do and how can someone trigger
> the callback? I assume that when someone calls var_Set for the input_thread
> the callback is triggered.
>

Ok spotted this one (tanx to an old reply Subject: Re: Raising events
)<http://news.gmane.org/find-root.php?message_id=%3c44B760CE.3020106%40thales.co.za%3e>.
We are going to use var_AddCallback. But the last part still remains ..
[ok i know that you have the "release presure", but i will insist for a
while.. By the way why should a *free time* project pose psychopresuring
strict timelines ? Better release something stable with less buggy feautures
at the time it will be ready]

Assuming that we "attached" the "snapshot-taken" var with the p_input_thread
from within the libvlc_media_player object  (that we got from
media_player->p_input_thread),
* how can we find this input_thread from withing vout_thread and call a
var_Set( p_input_thread, "snapshot-taken",  &val )?*

Thanks in advance
  basOS

ps. i have a video filter ready (detects static images and takes snapshots -
> yes thats why i need the snapshot event). Should i post it here? Could i
> make commits to git ?
>

Anyway i'm attaching (stat.txt) the diffs against yesterdays git master
version cause i don't like the filter to be on my computer only !!.
The diffs include : staticdetect video filter definition
                                mod to avcodec plugin to give configuration
access to JPEG compress factor ( it can be combined when using
--snapshot-type jpg to produce better image result )

The filter is working ok but is not on its final state (some configuration
variables issues will be addressed later on ) .

B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080819/26e9c6ef/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stat.txt
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080819/26e9c6ef/attachment.txt>


More information about the vlc-devel mailing list