get meta-information

This forum is about all development around libVLC.
radx
New Cone
New Cone
Posts: 2
Joined: 31 Jul 2009 17:36

get meta-information

Postby radx » 31 Jul 2009 17:47

I use libVLC in my Qt application.

Some code:

Code: Select all

_m = libvlc_media_new (_vlcinstance, song.toUtf8().data(), &_vlcexcep); libvlc_media_player_set_media (_mp, _m, &_vlcexcep); libvlc_media_player_play (_mp, &_vlcexcep );
How can I get meta-information (author, title) of a currently playing file?

radx
New Cone
New Cone
Posts: 2
Joined: 31 Jul 2009 17:36

Re: get meta-information

Postby radx » 31 Jul 2009 20:21

If I use:
_m = libvlc_media_new (_vlcinstance, song.toUtf8().data(), &_vlcexcep);
libvlc_media_player_set_media (_mp, _m, &_vlcexcep);
libvlc_media_player_play (_mp, &_vlcexcep );

qDebug() << libvlc_media_player_get_state(_mp, &_vlcexcep);
I get empty string.

But if I use
sleep(1);
qDebug() << libvlc_media_player_get_state(_mp, &_vlcexcep);
I'll get normally output.

pbekaert
New Cone
New Cone
Posts: 9
Joined: 24 Jul 2009 18:35

Re: get meta-information

Postby pbekaert » 31 Jul 2009 20:29

Metadata information only becomes available when the stream or file is opened. Opening the stream or file happens when you start playing, and takes some time.
Same is true for libvlc_video_get_width etc...
The best thing is to wait for the first video frame to be produced before querying. That raises the next question of course, of how to detect when the first videoframe has been produced. That depends on the video out plugin you use. I do not know the solution for Qt, perhaps you find out in the Qt documentation.
Best,

Philippe.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 14 guests