"libvlc_media_tracks_get" issue

This forum is about all development around libVLC.
Moriquendi
Blank Cone
Blank Cone
Posts: 74
Joined: 31 May 2011 16:22

"libvlc_media_tracks_get" issue

Postby Moriquendi » 20 Oct 2017 15:15

Hello,

I'am using VLC 2.2.5.1 API in my QT program. I have a .ts stream and I am opening it using libvlc API where I would like to show media information just like Tools->Codec Information->Codec tab in VLC interface. My code is as follows;

Code: Select all

libvlc_media_track_t **tracks; libvlc_media_stats_t stats; libvlc_media_t *media = libvlc_media_player_get_media(player->core()); if (libvlc_media_get_stats(media, &stats)) { libvlc_media_tracks_get(media,&tracks); libvlc_video_track_t *video = (*tracks)->video; libvlc_audio_track_t *audio = (*tracks)->audio; qDebug()<<"INPUT BITRATE:"<<stats.f_input_bitrate*1024*8; qDebug()<<"DISPLAY RESOLUTION:"<<video->i_width<<"x"<<video->i_height; qDebug()<<"DISPLAY RESOLUTION(2nd solution):"<<libvlc_video_get_width(player->core())<<"x"<<libvlc_video_get_height(player->core()); qDebug() << "AUDIO CHANNELS:"<<audio->i_channels; qDebug() << "AUDIO SAMPLERATE:"<<audio->i_rate; qDebug() <<"FPS:"<<libvlc_media_player_get_fps(player->core()); }
The output of this block is as follows;

Code: Select all

INPUT BITRATE:1241.16 DISPLAY RESOLUTION: 44100 x 2 DISPLAY RESOLUTION(2nd solution): 1920 x 1080 AUDIO CHANNELS: 2 AUDIO SAMPLERATE: 44100 FPS: 0
For some reason, in my video track struct, i_width and i_height fields equal to audio track sample rate and channel fields respectively. Also, libvlc_media_player_get_fps always returns 0.

Am I missing something or is there a way to do this properly?

Cheers.

P.S: When I open this .ts stream via VLC 2.2.5.1, and go to Tools->Codec Information->Codec tab, everything seems to be correct.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: "libvlc_media_tracks_get" issue

Postby Jean-Baptiste Kempf » 11 Nov 2017 14:20

Use 3.0 and use preparsing().
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: "libvlc_media_tracks_get" issue

Postby neosettler » 25 May 2019 02:17

Hi,

preparsing() how?

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: "libvlc_media_tracks_get" issue

Postby mfkl » 27 May 2019 04:15

https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media.html#ga55f5a33e22aa32e17a9bb75decd1497b
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests