#include <stdlib.h>
#include <string.h>
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/base/gstadapter.h>
#include "gstbaseparse.h"
GstIndex *index;
gint index_id;
gboolean own_index;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- GStaticMutex index_lock;
-#else
GMutex index_lock;
-#endif
/* seek table entries only maintained if upstream is BYTE seekable */
gboolean upstream_seekable;
GstClockTime start_ts;
} GstBaseParseSeek;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-#define GST_BASE_PARSE_INDEX_LOCK(parse) \
- g_static_mutex_lock (&parse->priv->index_lock);
-#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
- g_static_mutex_unlock (&parse->priv->index_lock);
-#else
#define GST_BASE_PARSE_INDEX_LOCK(parse) \
g_mutex_lock (&parse->priv->index_lock);
#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
g_mutex_unlock (&parse->priv->index_lock);
-#endif
static GstElementClass *parent_class = NULL;
gst_object_unref (parse->priv->index);
parse->priv->index = NULL;
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_free (&parse->priv->index_lock);
-#else
g_mutex_clear (&parse->priv->index_lock);
-#endif
gst_base_parse_clear_queues (parse);
parse->priv->pad_mode = GST_PAD_MODE_NONE;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_init (&parse->priv->index_lock);
-#else
g_mutex_init (&parse->priv->index_lock);
-#endif
/* init state */
gst_base_parse_reset (parse);
}
}
-GType
-gst_base_parse_frame_get_type (void)
-{
- static volatile gsize frame_type = 0;
-
- if (g_once_init_enter (&frame_type)) {
- GType _type;
-
- _type = g_boxed_type_register_static ("GstBaseParseFrame",
- (GBoxedCopyFunc) gst_base_parse_frame_copy,
- (GBoxedFreeFunc) gst_base_parse_frame_free);
- g_once_init_leave (&frame_type, _type);
- }
- return (GType) frame_type;
-}
+G_DEFINE_BOXED_TYPE (GstBaseParseFrame, gst_base_parse_frame,
+ (GBoxedCopyFunc) gst_base_parse_frame_copy,
+ (GBoxedFreeFunc) gst_base_parse_frame_free);
/**
* gst_base_parse_frame_init:
g_slist_free (parse->priv->pending_seeks);
parse->priv->pending_seeks = NULL;
+ if (parse->priv->adapter)
+ gst_adapter_clear (parse->priv->adapter);
+
/* we know it is not alloc'ed, but maybe other stuff to free, some day ... */
parse->priv->frame._private_flags |=
GST_BASE_PARSE_FRAME_PRIVATE_FLAG_NOALLOC;
caps =
gst_caps_intersect_full (filter, template_caps,
GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (template_caps);
} else {
- caps = gst_caps_copy (template_caps);
+ caps = template_caps;
}
gst_query_set_caps_result (query, caps);
gst_caps_unref (caps);
last_stop = last_start + GST_BUFFER_DURATION (buffer);
/* should have caps by now */
- g_return_val_if_fail (gst_pad_has_current_caps (parse->srcpad),
- GST_FLOW_ERROR);
+ if (!gst_pad_has_current_caps (parse->srcpad))
+ goto no_caps;
/* segment adjustment magic; only if we are running the whole show */
if (!parse->priv->passthrough && parse->segment.rate > 0.0 &&
gst_base_parse_frame_free (frame);
return ret;
+
+ /* ERRORS */
+no_caps:
+ {
+ GST_ELEMENT_ERROR (parse, STREAM, DECODE, ("No caps set"), (NULL));
+ return GST_FLOW_ERROR;
+ }
}