[vlc-devel] [PATCH] Adding a libvlc_MediaPlayerLengthChanged event

Hugo Beauzee-Luyssen beauze.h at gmail.com
Mon May 11 10:21:59 CEST 2009


On Sun, May 10, 2009 at 10:25 PM, Laurent Aimar <fenrir at via.ecp.fr> wrote:
> Hi,
>
> On Sun, May 10, 2009, Hugo Beauzee-Luyssen wrote:
>> 2009/5/10 Rémi Denis-Courmont <remi at remlab.net>:
>> >        Hello,
>> >
>> > Le dimanche 10 mai 2009 16:50:03 Hugo Beauzee-Luyssen, vous avez écrit :
>> >> With some demuxers, the length isn't computed right away, and there's
>> >> no event to know when the length actually changed. Therefore, this is
>> >> a patch that implement a libvlc_MediaPlayerLengthChanged event.
>> >> It's not fired with the others "INPUT_EVENT_TIMES" events, since
>> >> firering an event from here would result in firering an event with
>> >> each libvlc_MediaPlayerPositionChanged event... instead, it's
>> >> triggered on its own.
>  I do think that the event INPUT_EVENT_LENGTH is not needed, INPUT_EVENT_TIMES
> is enought for that.
>

I disagree : at the moment, there's no way of knowing if the length
has changed. Indeed the Trigger function is called with
INPUT_EVENT_TIMES, which means either length, time, or position has
changed. However, the only way of knowing if the length has changed is
to call libvlc_media_player_get_length each time an time or position
changed event is fired. This patch is provided in order to prevent
this kind of behaviour.
Another possibility would have been to fire the
libvlc_MediaPlayerLengthChanged event in the
input_event_changed function, however, there's no way of knowing if
the length has changed inside this function, which is why another
Trigger is called from input_SendEventTimes().

Regards,

-- 
Hugo Beauzée-Luyssen



More information about the vlc-devel mailing list