[vlc-devel] libvlc_MediaMetaChanged event being sent too soon

Frank Enderle frank.enderle at anamica.de
Sat Jul 10 08:15:40 CEST 2010

the event is fired as soon as vlc gets the data from the streaming
server. however it does not take in account that the audio data will be
buffered and thus delayed. that's why there's a gap between the event
and the actual data being valid for the current stream position.

i solved this for me by applying a patch to vlc which gives me the
ability to see how much streamtime is buffered. when i get the event i
calculate when it becomes valid by adding the time left in the buffer to
the current (monotonic) timestamp and put the result in a ring buffer
which is frequently checked. when the title change gets valid it is
shown to the user and removed from the ring.

i played with the thought to add this as a patch to vlc itself so the
event is fired timecorrected, but i didn't do it because i think it is
the applications responsibility to deal with the delay since there might
be cases when it is a good idea to have the data early, for example if
you want to do some artwork prefetch. so i only added the ability to get
the time left in the buffers.

i sent the patch a while ago to the list, but i don't think it has been
incorporated to the git master (i might be wrong). i added you the patch
against vlc 1.1.0. it gives you a new function to get the buffered time
in ms.

libvlc_media_player_get_buffered_time(libvlc_media_player_t *p_mi);

hope this helps


Am 10.07.2010 01:17, schrieb Jason Butler:
> I am using libvlc 1.1.0 to play an audio steam on Linux. I want to get
> the title, album, and artist every time the track changes so I am
> hooking up a callback function to the libvlc_MediaMetaChanged event. The
> problem is when the stream starts playing the libvlc_MediaMetaChanged
> event is sent serveral times before all the track meta data is valid. If
> I call  libvlc_media_get_meta(m,libvlc_meta_Artist), or
> libvlc_media_get_meta(m,libvlc_meta_Album) too soon then I get a segment
> fault.  I thought about waiting for the libvlc_MediaPlayerPlaying event
> but libvlc_MediaMetaChanged event is still sent several times before the
> album and artist data is valid.
> Is there a way to check if the artist and album data is valid before
> calling  libvlc_media_get_meta?
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel

Dipl.-Ing. (FH) Frank Enderle

anamica UG (haftungsbeschränkt)
Beinsteinerstr. 6
71334 Waiblingen

Telefon:  +49 151 14981091
Telefax:  +49 7151 1335770
E-Mail:   frank.enderle at anamica.de
Internet: www.anamica.de

Handelsregister: AG Stuttgart HRB 732357
Geschäftsführer: Yvonne Holzwarth, Frank Enderle
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vlc-1.1.0-buffer-time.patch
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100710/6a48a4f2/attachment.ksh>

More information about the vlc-devel mailing list