<HTML>
<HEAD>
<TITLE>Counting video frames</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>I’ve come across a problem processing individual frames of a movie using the appsrc component.<BR>
<BR>
The code in my main loop looks something like this:<BR>
<BR>
if ( !g_queue_is_empty( GST_APP_SINK( sink )->queue ))<BR>
{<BR>
// Get access to raw frame buffer<BR>
GstBuffer *buff = gst_app_sink_pull_buffer( GST_APP_SINK( sink ));<BR>
if ( buff )<BR>
{ <BR>
// Get pointer to frame data<BR>
guint8 *buff_data = (guint8 *)GST_BUFFER_DATA( buff );<BR>
<BR>
// Do something with buffer here<BR>
<BR>
// Release buffer <BR>
gst_buffer_unref( buff );<BR>
buff = NULL;<BR>
<BR>
num_frames++; <BR>
}<BR>
}<BR>
<BR>
This works, but if I run it a few times, using the same video each time, I sometimes see that the number of frames processed is lower than expected. This happens maybe once in five runs.<BR>
I used a gst_app_sink_set_drop( sink , false ) to ensure that the pipeline stalls if I don’t pull buffers quickly enough.<BR>
<BR>
Any ideas why or where I might be dropping frames ?<BR>
<BR>
On a similar topic, is there a mechanism within Gstreamer for identifying the number of frames in a movie file ?<BR>
<BR>
Thanks !<BR>
<BR>
Darren </SPAN></FONT>
<!--[object_id=#friendmts.co.uk#]--><FONT color=#0000ff>
<P align=left><FONT face=Tahoma color=#0000ff size=2><FONT size=3> </FONT></P>
<P align=left>*** FRIEND MTS LIMITED EMAIL CONFIDENTIALITY ***</FONT></P>
<P align=left><FONT color=#0000ff><FONT face=Tahoma size=2>This email message and any attachments may contain information which is confidential or privileged and is intended for the sole use of the person to whom it is addressed. If you are not the intended recipient, be aware that any disclosures, copying, distribution or use of the contents is prohibited. If you have received this email message in error, please notify our office by telephone (+44 (0)121 633 2000) or email (</FONT><A href="mailto:admin@friendmts.co.uk"><FONT face=Tahoma size=2>admin@friendmts.co.uk</FONT></A><FONT face=Tahoma size=2>) immediately. Thank you.</FONT></FONT></P></FONT></BODY>
</HTML>