Page 1 of 1

get meta-information

Posted: 31 Jul 2009 17:47
by radx
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?

Re: get meta-information

Posted: 31 Jul 2009 20:21
by radx
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.

Re: get meta-information

Posted: 31 Jul 2009 20:29
by pbekaert
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.