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());
}
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
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.