[vlc-devel] libvlc_MediaMetaChanged event being sent too soon

Frank Enderle frank.enderle at anamica.de
Mon Jul 12 19:54:27 CEST 2010


i do the same and it works here.

if(mp && libvlc_media_player_get_state(mp) == libvlc_Playing) {
	offset = libvlc_media_player_get_buffered_time(mp);
}

afterwards offset contains a value.


Am 12.07.2010 20:32, schrieb Jason Butler:
> I put the following code inside my libvlc_MediaMeataChanged event handler:
> 
> signed long long int time = libvlc_media_player_get_buffered_time(mp);
> printf("buffer time: %lli\n", time);
> 
> It always returned a buffer time of 0. Is this the expected result or am
> I doing something wrong.
> I got the same result if I used an int instead of a signed long long.
> libvlc_time_t is a int64_t which I believe is a singed long long.
> 
> On 10-07-10 01:15 AM, Frank Enderle wrote:
>> 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_time_t
>> libvlc_media_player_get_buffered_time(libvlc_media_player_t *p_mi);
>>
>> hope this helps
>>
>> frank
>>
>> 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
>>>     
>>
>>   
>>
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc-devel
>>   
> 
> 
> 
> _______________________________________________
> 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



More information about the vlc-devel mailing list