Problem with getting video resolution

This forum is about all development around libVLC.
hanky
Blank Cone
Blank Cone
Posts: 21
Joined: 30 May 2012 07:49

Problem with getting video resolution

Postby hanky » 05 Jun 2012 15:08

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Problem with getting video resolution

Postby Rémi Denis-Courmont » 05 Jun 2012 16:57

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

hanky
Blank Cone
Blank Cone
Posts: 21
Joined: 30 May 2012 07:49

Re: Problem with getting video resolution

Postby hanky » 05 Jun 2012 17:24

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?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 15 guests