#define GST_CAT_DEFAULT gst_base_parse_debug
/* Supported formats */
-static GstFormat fmtlist[] = {
+static const GstFormat fmtlist[] = {
GST_FORMAT_DEFAULT,
GST_FORMAT_BYTES,
GST_FORMAT_TIME,
GstIndex *index;
gint index_id;
gboolean own_index;
+ GStaticMutex index_lock;
+
/* seek table entries only maintained if upstream is BYTE seekable */
gboolean upstream_seekable;
gboolean upstream_has_duration;
parse->priv->index = NULL;
}
+ g_static_mutex_free (&parse->priv->index_lock);
+
gst_base_parse_clear_queues (parse);
G_OBJECT_CLASS (parent_class)->finalize (object);
parse->priv->pad_mode = GST_ACTIVATE_NONE;
+ g_static_mutex_init (&parse->priv->index_lock);
+
/* init state */
gst_base_parse_reset (parse);
GST_DEBUG_OBJECT (parse, "init ok");
associations[1].value = offset;
/* index might change on-the-fly, although that would be nutty app ... */
- GST_OBJECT_LOCK (parse);
+ g_static_mutex_lock (&parse->priv->index_lock);
gst_index_add_associationv (parse->priv->index, parse->priv->index_id,
(key) ? GST_ASSOCIATION_FLAG_KEY_UNIT : GST_ASSOCIATION_FLAG_DELTA_UNIT,
2, (const GstIndexAssociation *) &associations);
- GST_OBJECT_UNLOCK (parse);
+ g_static_mutex_unlock (&parse->priv->index_lock);
if (key) {
parse->priv->index_last_offset = offset;
*
* By default, announced average bitrate is estimated. The average bitrate
* is used to estimate the total duration of the stream and to estimate
- * a seek position, if there's no index and #GST_BASE_PARSE_FORMAT_FLAG_SYNCABLE
- * is set.
+ * a seek position, if there's no index and the format is syncable
+ * (see gst_base_parse_set_syncable()).
*
* Since: 0.10.33
*/
goto exit;
}
- GST_OBJECT_LOCK (parse);
+ g_static_mutex_lock (&parse->priv->index_lock);
if (parse->priv->index) {
/* Let's check if we have an index entry for that time */
entry = gst_index_get_assoc_entry (parse->priv->index,
ts = GST_CLOCK_TIME_NONE;
}
}
- GST_OBJECT_UNLOCK (parse);
+ g_static_mutex_unlock (&parse->priv->index_lock);
exit:
if (_ts)
{
GstBaseParse *parse = GST_BASE_PARSE (element);
- GST_OBJECT_LOCK (parse);
+ g_static_mutex_lock (&parse->priv->index_lock);
if (parse->priv->index)
gst_object_unref (parse->priv->index);
if (index) {
parse->priv->index = gst_object_ref (index);
- gst_index_get_writer_id (index, GST_OBJECT (element),
+ gst_index_get_writer_id (index, GST_OBJECT_CAST (element),
&parse->priv->index_id);
parse->priv->own_index = FALSE;
- } else
+ } else {
parse->priv->index = NULL;
- GST_OBJECT_UNLOCK (parse);
+ }
+ g_static_mutex_unlock (&parse->priv->index_lock);
}
static GstIndex *
GstBaseParse *parse = GST_BASE_PARSE (element);
GstIndex *result = NULL;
- GST_OBJECT_LOCK (parse);
+ g_static_mutex_lock (&parse->priv->index_lock);
if (parse->priv->index)
result = gst_object_ref (parse->priv->index);
- GST_OBJECT_UNLOCK (parse);
+ g_static_mutex_unlock (&parse->priv->index_lock);
return result;
}
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* If this is our own index destroy it as the
* old entries might be wrong for the new stream */
+ g_static_mutex_lock (&parse->priv->index_lock);
if (parse->priv->own_index) {
gst_object_unref (parse->priv->index);
parse->priv->index = NULL;
&parse->priv->index_id);
parse->priv->own_index = TRUE;
}
+ g_static_mutex_unlock (&parse->priv->index_lock);
break;
default:
break;