Monitoring fps manually by adding probe in element pad

Gokul Vellingiri vgokul129 at gmail.com
Mon Mar 2 22:23:05 PST 2015


I'm really interested in calculating fps rate in individual element in my
pipeline.Here in below code i have target on autovideosink element.I know
with fpsdisplaysink we can achieve it.But i don't want so.I came to know
that by adding Probe in the element pad we can achieve it.I'm trying this on
my Linux machine.

Code:
#include <gst/gst.h>
#include <time.h>
#include <sys/time.h>

gdouble start_time=0,end_time=0;
gint count=0;

static GstPadProbeReturn cb_have_data (GstPad *pad,GstPadProbeInfo *info,
gpointer user_data)
{
..
..
..
 if(count==0){
                start_time=call_time_function()/1000000000.0;
        }

        count++;
        end_time=call_time_function()/1000000000.0;

        if((end_time-start_time)>1){

     *g_printf("\n****\nCalculated FPS value:%d\n*****\n",count);*
                count=0;
        }
..
..
..
}

int main(){
..
..
..
//Sink Element

        sink = gst_element_factory_make ("xvimagesink", "sink");

//Adding Probe to sink element

        pad = gst_element_get_static_pad (sink, "sink");
        gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
                        (GstPadProbeCallback) cb_have_data, NULL, NULL);

gst_element_set_state(pipeline,GST_STATE_PLAYING);
..
..

}

In console i'll be able to see the fps displayed and my video is also
playing perfectly.Is this the correct way in calculating fps in individual
element by probing.

Any idea?

Thanks,
~GOKUL.



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Monitoring-fps-manually-by-adding-probe-in-element-pad-tp4670955.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list