Page 1 of 1

Problem with getting video resolution

Posted: 05 Jun 2012 15:08
by hanky
Hello.

I'm using the following functions to get video resolution:

Code: Select all

libvlc_media_parse(m_media); libvlc_video_get_size(m_player, 0, &x, &y)
This works with .flv videos but doesn't work with .mpg ones.

I've tried to look inside the 'libvlc_video_get_size' function and saw that 'libvlc_media_get_tracks_info(p_mi->p_md, &info)' call returns zero on .mpg files.

I can play all these .mpg videos via VLC player and can see their resolution too.

Where's my mistake?

Re: Problem with getting video resolution

Posted: 05 Jun 2012 16:57
by RĂ©mi Denis-Courmont
VLC plays the file. I expect you can get the resolution if you play the file and wait for the correct event (e.g. "vout").

Unfortunately, (pre)parsing cannot provide all infos for all formats.

Re: Problem with getting video resolution

Posted: 05 Jun 2012 17:24
by hanky
I've tried this, but it didn't work.

I've created an event manager for my player to wait for libvlc_MediaPlayerVout event:

Code: Select all

libvlc_event_manager_t *managerPlayer = libvlc_media_player_event_manager(mediaPlayer); libvlc_event_attach(managerPlayer, libvlc_MediaPlayerVout, &getSize, mediaPlayer);
When libvlc_MediaPlayerVout event triggered, my function getSize calls libvlc_video_get_size which returns 0 (success), but still sets video dimensions x and y to 0.

Am I missing something?