Hi all I hope someone has the time to help me. Thanks in advance.<div><br></div><div>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.</div>
<div><br></div><div>First I tried call libvlc_media_get_stats from media.c:<br><br> libvlc_media_t *media = p_mi->p_md;<br> libvlc_media_stats_t p_stats;<br> double f_bitrate = 0.0;<br> <br> if( libvlc_media_get_stats(media,&p_stats))<br>
f_bitrate = p_stats.f_demux_bitrate;<br> else<br> f_bitrate = 1.1; /* so I know the call failed */<br><br> return f_bitrate;<br><br></div><div>This always returns 0<br><br>Next I tried calling the stats_ComputeInputStats function from stats.c:<br>
<br>input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );<br> double f_bitrate = 0.0;<br> libvlc_media_stats_t p_stats;<br> if( p_input_thread )<br> {<br> stats_ComputeInputStats(p_input_thread, &p_stats);<br>
f_bitrate = p_stats.f_demux_bitrate;<br> /*if( input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps ) )<br> f_fps = 0.0;*/<br><br><br> vlc_object_release( p_input_thread );<br> }<br>
return f_bitrate;<br></div><div><br>This is returning 2.37e-37 which even for bytes/microsecond is a bit small for a real value and it never changes.<br><br>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.<br>
<br>Shane<br></div>