Calculate timestamp in handoff callback

Mayank Agarwal mayank77fromindia at gmail.com
Tue Apr 7 03:16:19 PDT 2015


Hi,

I am implementing handoff cb in the following way,but i am getting timestamp
as 0.Duration i am getting right.Please find below the code:

GstStructure *struc;
const GValue *codec_data;
bool r;
int bufsamplesize = 0;
GstClockTime timestamp;
        int framerate = 0;
int duration = 0;

buffer_count++;


        if(GST_BUFFER_TIMESTAMP_IS_VALID(buffer))
        g_printf("DTS buffer is valid\n");

        if(GST_BUFFER_DURATION_IS_VALID(buffer))
        g_printf("DTS buffer is valid\n");

        bufsamplesize = GST_BUFFER_SIZE(buffer);
        g_printf("Buffer sample size = %d\n",bufsamplesize);


        timestamp = GST_BUFFER_TIMESTAMP(buffer);
        g_print ("Timestamp calculated = : %" GST_TIME_FORMAT "\n",
      GST_TIME_ARGS (timestamp));
        duration = GST_BUFFER_DURATION(buffer);
        g_printf("Duration = %d\n",duration);

framerate = 1000000*1/timestamp;
        g_print ("Framerate calculated = : %" GST_TIME_FORMAT "\n",
      GST_TIME_ARGS (framerate));


/*struc = gst_caps_get_structure(GST_BUFFER_CAPS(buffer), 0);
codec_data = gst_structure_get_value(struc, "codec_data");
if (codec_data) {
GstBuffer *tmp;
tmp = gst_value_get_buffer(codec_data);
printf("Inside codec_data\n");
}*/



How to correctly calculate the timestamp from buffer,and how to deduce
the frame rate from
that.What other video quality parameters gstreamer support and how can
i retrieve it.


Regards
Mayank


More information about the gstreamer-devel mailing list