gboolean exact_position;
/* seek events are temporarily kept to match them with newsegments */
GSList *pending_seeks;
+
+ /* property */
+ /* number of initial frames to discard */
+ gint skip;
};
typedef struct _GstBaseParseSeek
GstClockTime start_ts;
} GstBaseParseSeek;
+/* signals and args */
+enum
+{
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_SKIP
+ /* FILL ME */
+};
+
+#define PROP_DEFAULT_SKIP 0
+
+
static GstElementClass *parent_class = NULL;
static void gst_base_parse_class_init (GstBaseParseClass * klass);
static void gst_base_parse_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_base_parse_get_index (GstElement * element);
+static void gst_base_parse_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_base_parse_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static gboolean gst_base_parse_sink_activate (GstPad * sinkpad);
static gboolean gst_base_parse_sink_activate_push (GstPad * pad,
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_base_parse_set_index);
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_base_parse_get_index);
+ gobject_class->set_property = gst_base_parse_set_property;
+ gobject_class->get_property = gst_base_parse_get_property;
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SKIP,
+ g_param_spec_int ("skip", "skip", "Discard number of initial frames",
+ 0, G_MAXINT, PROP_DEFAULT_SKIP,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/* Default handlers */
klass->check_valid_frame = gst_base_parse_check_frame;
klass->parse_frame = gst_base_parse_parse_frame;
parse->adapter = gst_adapter_new ();
parse->priv->pad_mode = GST_ACTIVATE_NONE;
+ parse->priv->skip = PROP_DEFAULT_SKIP;
/* init state */
gst_base_parse_reset (parse);
gst_buffer_unref (buffer);
ret = GST_FLOW_OK;
} else if (ret == GST_FLOW_OK) {
- ret = gst_pad_push (parse->srcpad, buffer);
- GST_LOG_OBJECT (parse, "frame (%d bytes) pushed: %s",
- GST_BUFFER_SIZE (buffer), gst_flow_get_name (ret));
+ if (G_LIKELY (!parse->priv->skip)) {
+ ret = gst_pad_push (parse->srcpad, buffer);
+ GST_LOG_OBJECT (parse, "frame (%d bytes) pushed: %s",
+ GST_BUFFER_SIZE (buffer), gst_flow_get_name (ret));
+ } else {
+ GST_DEBUG_OBJECT (parse, "initial frame (%d bytes) discarded",
+ GST_BUFFER_SIZE (buffer));
+ parse->priv->skip--;
+ }
} else {
gst_buffer_unref (buffer);
GST_LOG_OBJECT (parse, "frame (%d bytes) not pushed: %s",
return result;
}
+static void
+gst_base_parse_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstBaseParse *parse;
+
+ parse = GST_BASE_PARSE (object);
+
+ switch (prop_id) {
+ case PROP_SKIP:
+ parse->priv->skip = g_value_get_int (value);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+gst_base_parse_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
+{
+ GstBaseParse *parse;
+
+ parse = GST_BASE_PARSE (object);
+
+ switch (prop_id) {
+ case PROP_SKIP:
+ g_value_set_int (value, parse->priv->skip);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static GstStateChangeReturn
gst_base_parse_change_state (GstElement * element, GstStateChange transition)
{