DEFAULT_SLEEP_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ERROR_AFTER,
g_param_spec_int ("error-after", "Error After", "Error after N buffers",
- G_MININT, G_MAXINT, DEFAULT_ERROR_AFTER,
+ -1, G_MAXINT, DEFAULT_ERROR_AFTER,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DROP_PROBABILITY,
g_param_spec_float ("drop-probability", "Drop Probability",
**/
g_object_class_install_property (gobject_class, PROP_EOS_AFTER,
g_param_spec_int ("eos-after", "EOS After", "EOS after N buffers",
- G_MININT, G_MAXINT, DEFAULT_ERROR_AFTER,
+ -1, G_MAXINT, DEFAULT_EOS_AFTER,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
{
identity->sleep_time = DEFAULT_SLEEP_TIME;
identity->error_after = DEFAULT_ERROR_AFTER;
+ identity->error_after_counter = DEFAULT_ERROR_AFTER;
identity->drop_probability = DEFAULT_DROP_PROBABILITY;
identity->drop_buffer_flags = DEFAULT_DROP_BUFFER_FLAGS;
identity->datarate = DEFAULT_DATARATE;
identity->ts_offset = DEFAULT_TS_OFFSET;
g_cond_init (&identity->blocked_cond);
identity->eos_after = DEFAULT_EOS_AFTER;
+ identity->eos_after_counter = DEFAULT_EOS_AFTER;
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM_CAST (identity), TRUE);
}
identity->prev_offset_end = GST_BUFFER_OFFSET_END (buf);
identity->prev_offset = GST_BUFFER_OFFSET (buf);
- if (identity->error_after >= 0) {
- identity->error_after--;
- if (identity->error_after == 0)
+ if (identity->error_after_counter >= 0) {
+ identity->error_after_counter--;
+ if (identity->error_after_counter == 0)
goto error_after;
}
- if (identity->eos_after >= 0) {
- identity->eos_after--;
- if (identity->eos_after == 0)
+ if (identity->eos_after_counter >= 0) {
+ identity->eos_after_counter--;
+ if (identity->eos_after_counter == 0)
goto eos_after;
}
identity = GST_IDENTITY (trans);
+ if (identity->eos_after != DEFAULT_EOS_AFTER
+ && identity->error_after != DEFAULT_ERROR_AFTER)
+ goto both_afters_defined;
+
identity->offset = 0;
identity->prev_timestamp = GST_CLOCK_TIME_NONE;
identity->prev_duration = GST_CLOCK_TIME_NONE;
identity->prev_offset_end = GST_BUFFER_OFFSET_NONE;
identity->prev_offset = GST_BUFFER_OFFSET_NONE;
+ identity->error_after_counter = identity->error_after;
+ identity->eos_after_counter = identity->eos_after;
return TRUE;
+
+ /* ERROR */
+both_afters_defined:
+ {
+ GST_ELEMENT_ERROR (identity, CORE, FAILED,
+ (_("eos-after and error-after can't both be defined.")), (NULL));
+ return FALSE;
+ }
}
static gboolean