baseparse: custom bufferflag indicates not to count frame in stats
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Thu, 29 Oct 2009 14:18:37 +0000 (15:18 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 8 Apr 2011 14:44:48 +0000 (15:44 +0100)
gst/audioparsers/gstbaseparse.c
gst/audioparsers/gstbaseparse.h

index 7e5c937..fa506a1 100644 (file)
@@ -942,7 +942,9 @@ gst_base_parse_push_buffer (GstBaseParse * parse, GstBuffer * buffer)
 
   /* update stats */
   parse->priv->bytecount += GST_BUFFER_SIZE (buffer);
-  parse->priv->framecount++;
+  parse->priv->framecount +=
+      !GST_BUFFER_FLAG_IS_SET (buffer, GST_BASE_PARSE_BUFFER_FLAG_NO_FRAME);
+  GST_BUFFER_FLAG_UNSET (buffer, GST_BASE_PARSE_BUFFER_FLAG_NO_FRAME);
   if (parse->priv->update_interval &&
       (parse->priv->framecount % parse->priv->update_interval) == 0)
     gst_base_parse_update_duration (parse);
index 2654cb1..a6a5f54 100644 (file)
@@ -79,6 +79,17 @@ G_BEGIN_DECLS
 #define GST_BASE_PARSE_FLOW_DROPPED   GST_FLOW_CUSTOM_SUCCESS
 
 /**
+ * GST_BASE_PARSE_BUFFER_FLAG_NO_FRAME:
+ *
+ * A #GstBufferFlag that can be set to have this buffer not counted as frame,
+ * e.g. if this frame is dependent on a previous one.  As it is not counted as
+ * a frame, bitrate increases but frame to time conversions are maintained.
+ *
+ * Since: 0.10.x
+ */
+#define GST_BASE_PARSE_BUFFER_FLAG_NO_FRAME     GST_BUFFER_FLAG_LAST
+
+/**
  * GST_BASE_PARSE_LOCK:
  * @obj: base parse instance
  *