[vlc-devel] Hacking with VLC
Shane Phelan
streamey at gmail.com
Wed Nov 16 16:59:24 CET 2011
Hi all I hope someone has the time to help me. Thanks in advance.
So, I'm hacking around in VLC I thought one of the interesting things I
could try would be to get some of the stats about the video I'm playing
from a stream onto the web page. So as a proof of concept I hijacked the
libvlc_media_player_get_fps function and was going to try and return the
bitrate instead. No point in messing with the external API until I can
actually get the data.
First I tried call libvlc_media_get_stats from media.c:
libvlc_media_t *media = p_mi->p_md;
libvlc_media_stats_t p_stats;
double f_bitrate = 0.0;
if( libvlc_media_get_stats(media,&p_stats))
f_bitrate = p_stats.f_demux_bitrate;
else
f_bitrate = 1.1; /* so I know the call failed */
return f_bitrate;
This always returns 0
Next I tried calling the stats_ComputeInputStats function from stats.c:
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
double f_bitrate = 0.0;
libvlc_media_stats_t p_stats;
if( p_input_thread )
{
stats_ComputeInputStats(p_input_thread, &p_stats);
f_bitrate = p_stats.f_demux_bitrate;
/*if( input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps ) )
f_fps = 0.0;*/
vlc_object_release( p_input_thread );
}
return f_bitrate;
This is returning 2.37e-37 which even for bytes/microsecond is a bit small
for a real value and it never changes.
That all being said I'm sure I'm way off base with how this all works. I
have a feeling that my second approach is more on track, but it looks like
stats.c requires a timer to constantly do the calculations? Am I correct
in that assumption? Thanks for the hand holding.
Shane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20111116/e8683e87/attachment.html>
More information about the vlc-devel
mailing list