+2005-08-21 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * check/Makefile.am:
+ Use CHECK_CFLAGS and CHECK_LIBS
+ * check/gst/gstevent.c: (event_probe), (test_event),
+ (GST_START_TEST):
+ Don't leak events.
+ * gst/base/gstbasesrc.c: (gst_base_src_send_discont),
+ (gst_base_src_start), (gst_base_src_stop),
+ (gst_base_src_activate_push), (gst_base_src_activate_pull),
+ (gst_base_src_change_state):
+ Sprinkle gst_base_src_stop liberally around error paths to fix
+ problems reusing a source after failed state changes.
+ * gst/base/gsttypefindhelper.c: (helper_find_peek),
+ (helper_find_suggest), (gst_type_find_helper):
+ Extra debug output. Don't segfault on GST_PAD_GETRANGEFUNC = NULL
+ * gst/gstevent.h:
+ * docs/gst/tmpl/gstevent.sgml:
+ Migrate part of the docs from the SGML file. Wait for ensonic to
+ tell me how I did it wrong ;)
+ * tools/gst-typefind.c: (main):
+ Extra robustness to state changes between files.
+
2005-08-21 Thomas Vander Stichele <thomas at apestaart dot org>
* check/Makefile.am:
noinst_HEADERS = gst/capslist.h
-AM_CFLAGS = $(GST_OBJ_CFLAGS)
+AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
LDADD = $(GST_OBJ_LIBS) \
- $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la
+ $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
+ $(CHECK_LIBS)
gst_libs_gdp_SOURCES = \
gst-libs/gdp.c \
gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \
$(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
- $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
+ $(CHECK_LIBS) \
+ $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
# valgrind testing
# these just need valgrind fixing, period
case GST_EVENT_CUSTOM_UP:
case GST_EVENT_CUSTOM_BOTH:
case GST_EVENT_CUSTOM_BOTH_OOB:
+ if (got_event_before_q != NULL)
+ break;
gst_event_ref (data);
g_get_current_time (&got_event_time);
got_event_before_q = GST_EVENT (data);
case GST_EVENT_CUSTOM_DS_OOB:
case GST_EVENT_CUSTOM_BOTH:
case GST_EVENT_CUSTOM_BOTH_OOB:
+ if (got_event_after_q != NULL)
+ break;
gst_event_ref (data);
g_get_current_time (&got_event_time);
got_event_after_q = GST_EVENT (data);
}
static void test_event
- (GstEventType type, GstPad * pad, gboolean expect_before_q)
+ (GstBin * pipeline, GstEventType type, GstPad * pad,
+ gboolean expect_before_q)
{
GstEvent *event;
gint i;
got_event_before_q = got_event_after_q = NULL;
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+ gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
+
event = gst_event_new_custom (type,
gst_structure_empty_new ("application/x-custom"));
g_get_current_time (&sent_event_time);
fail_if (got_event_after_q == NULL);
fail_unless (GST_EVENT_TYPE (got_event_after_q) == type);
}
-};
+
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
+ gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
+
+ if (got_event_before_q)
+ gst_event_unref (got_event_before_q);
+ if (got_event_after_q)
+ gst_event_unref (got_event_after_q);
+
+ got_event_before_q = got_event_after_q = NULL;
+}
static gint64
timediff (GTimeVal * end, GTimeVal * start)
gst_pad_add_event_probe (sinkpad, (GCallback) event_probe,
GINT_TO_POINTER (FALSE));
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
/* Upstream events */
- test_event (GST_EVENT_CUSTOM_UP, sinkpad, TRUE);
+ test_event (pipeline, GST_EVENT_CUSTOM_UP, sinkpad, TRUE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_UP took to long to reach source");
+ "GST_EVENT_CUSTOM_UP took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH took to long to reach source");
+ "GST_EVENT_CUSTOM_BOTH took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source");
+ "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
/* Out of band downstream events */
- test_event (GST_EVENT_CUSTOM_DS_OOB, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_DS_OOB, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_DS_OOB took to long to reach source");
+ "GST_EVENT_CUSTOM_DS_OOB took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source");
+ "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
/* In-band downstream events are expected to take at least 1 second
* to traverse the the queue */
- test_event (GST_EVENT_CUSTOM_DS, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_DS, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) >= G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %lld us",
- timediff (&got_event_time, &sent_event_time));
+ "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) >= G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %lld us",
- timediff (&got_event_time, &sent_event_time));
+ "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_bin_watch_for_state_change (GST_BIN (pipeline));
<!-- ##### ENUM GstEventType ##### -->
<para>
-The different major types of events.
+
</para>
-@GST_EVENT_UNKNOWN: unknown event.
+@GST_EVENT_UNKNOWN:
@GST_EVENT_FLUSH_START:
@GST_EVENT_FLUSH_STOP:
-@GST_EVENT_EOS: an end-of-stream event.
+@GST_EVENT_EOS:
@GST_EVENT_NEWSEGMENT:
@GST_EVENT_TAG:
@GST_EVENT_FILLER:
-@GST_EVENT_QOS: a quality of service event
-@GST_EVENT_SEEK: a seek event.
+@GST_EVENT_QOS:
+@GST_EVENT_SEEK:
@GST_EVENT_NAVIGATION:
@GST_EVENT_CUSTOM_UP:
@GST_EVENT_CUSTOM_DS:
{
GstEvent *event;
+ GST_DEBUG_OBJECT (src, "Sending newsegment from %" G_GINT64_FORMAT
+ " to %" G_GINT64_FORMAT, (gint64) src->segment_start,
+ (gint64) src->segment_end);
event = gst_event_new_newsegment (1.0,
GST_FORMAT_BYTES,
(gint64) src->segment_start, (gint64) src->segment_end, (gint64) 0);
if (GST_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED))
return TRUE;
+ GST_DEBUG_OBJECT (basesrc, "starting source");
+
basesrc->num_buffers_left = basesrc->num_buffers;
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
if (!GST_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED))
return TRUE;
+ GST_DEBUG_OBJECT (basesrc, "stopping source");
+
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
if (bclass->stop)
result = bclass->stop (basesrc);
/* prepare subclass first */
if (active) {
+ GST_DEBUG_OBJECT (basesrc, "Activating in push mode");
if (!gst_base_src_start (basesrc))
goto error_start;
return gst_pad_start_task (pad, (GstTaskFunction) gst_base_src_loop, pad);
} else {
+ GST_DEBUG_OBJECT (basesrc, "Deactivating in push mode");
return gst_base_src_deactivate (basesrc, pad);
}
error_start:
{
- GST_DEBUG_OBJECT (basesrc, "failed to start");
+ gst_base_src_stop (basesrc);
+ GST_DEBUG_OBJECT (basesrc, "Failed to start in push mode");
return FALSE;
}
}
/* prepare subclass first */
if (active) {
+ GST_DEBUG_OBJECT (basesrc, "Activating in pull mode");
if (!gst_base_src_start (basesrc))
goto error_start;
return TRUE;
} else {
+ GST_DEBUG_OBJECT (basesrc, "Deactivating in pull mode");
+
+ if (!gst_base_src_stop (basesrc))
+ goto error_stop;
+
return gst_base_src_deactivate (basesrc, pad);
}
error_start:
{
- GST_DEBUG_OBJECT (basesrc, "failed to start");
+ gst_base_src_stop (basesrc);
+ GST_DEBUG_OBJECT (basesrc, "Failed to start in pull mode");
+ return FALSE;
+ }
+error_stop:
+ {
+ GST_DEBUG_OBJECT (basesrc, "Failed to stop in pull mode");
return FALSE;
}
}
}
if ((presult = GST_ELEMENT_CLASS (parent_class)->change_state (element)) !=
- GST_STATE_SUCCESS)
+ GST_STATE_SUCCESS) {
+ gst_base_src_stop (basesrc);
return presult;
+ }
switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED:
GstCaps *caps;
guint64 size;
GList *buffers;
+ GstTypeFindFactory *factory;
}
GstTypeFindHelper;
GstPad *src;
GstFlowReturn ret;
- if (size == 0)
- return NULL;
-
find = (GstTypeFindHelper *) data;
src = find->src;
+ GST_LOG_OBJECT (src, "'%s' called peek (%" G_GINT64_FORMAT ", %u)",
+ GST_PLUGIN_FEATURE_NAME (find->factory), offset, size);
+
+ if (size == 0)
+ return NULL;
+
if (offset < 0) {
if (find->size == -1 || find->size < -offset)
return NULL;
{
GstTypeFindHelper *find = (GstTypeFindHelper *) data;
+ GST_LOG_OBJECT (find->src,
+ "'%s' called called suggest (%u, %" GST_PTR_FORMAT ")",
+ GST_PLUGIN_FEATURE_NAME (find->factory), probability, caps);
+
if (probability > find->best_probability) {
GstCaps *copy = gst_caps_copy (caps);
GList *walk, *type_list = NULL;
GstCaps *result = NULL;
+ g_return_val_if_fail (src != NULL, NULL);
+ g_return_val_if_fail (GST_PAD_GETRANGEFUNC (src) != NULL, NULL);
+
walk = type_list = gst_type_find_factory_get_list ();
find.src = src;
while (walk) {
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
+ find.factory = factory;
+
gst_type_find_factory_call_function (factory, &gst_find);
if (find.best_probability >= GST_TYPE_FIND_MAXIMUM)
break;
/**
* GstEventType:
* @GST_EVENT_UNKNOWN: unknown event.
- * @GST_EVENT_FLUSH_START: start a flush operation
- * @GST_EVENT_FLUSH_STOP: stop a flush operation
- * @GST_EVENT_EOS: no more data is to be expected.
- * @GST_EVENT_NEWSEGMENT: a new segment started
- * @GST_EVENT_TAG: a new tag
- * @GST_EVENT_FILLER: filler for sparse data streams.
- * @GST_EVENT_QOS: a quality message
- * @GST_EVENT_SEEK: a request for a new playback position and rate.
- * @GST_EVENT_NAVIGATION: a navigation event
- * @GST_EVENT_CUSTOM_UP: Custom upstream event, carrying a custom GstStructure
- * @GST_EVENT_CUSTOM_DS: Custom in-stream downstream, carrying a custom GstStructure
- * @GST_EVENT_CUSTOM_DS_OOB: Custom out-of-band downstream event, carrying a custom GstStructure
- * @GST_EVENT_CUSTOM_BOTH: Custom up or downstream event. In-band when travelling downstream.
- * @GST_EVENT_CUSTOM_BOTH_OOB: Custom up or downstream out-of-band event.
+ * @GST_EVENT_FLUSH_START: Start a flush operation
+ * @GST_EVENT_FLUSH_STOP: Stop a flush operation
+ * @GST_EVENT_EOS: End-Of-Stream. No more data is to be expected to follow without
+ * a NEWSEGMENT event.
+ * @GST_EVENT_NEWSEGMENT: A new media segment follows in the dataflow.
+ * @GST_EVENT_TAG: A new set of metadata tags has been found in the stream.
+ * @GST_EVENT_FILLER: Filler for sparse data streams.
+ * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements that the downstream elements
+ * are being starved of or flooded with data.
+ * @GST_EVENT_SEEK: A request for a new playback position and rate.
+ * @GST_EVENT_NAVIGATION: Navigation events are usually used for communicating user
+ * requests, such as mouse or keyboard movements, to upstream elements.
+ * @GST_EVENT_CUSTOM_UP: Upstream custom event
+ * @GST_EVENT_CUSTOM_DS: Downstream custom event that travels in the data flow.
+ * @GST_EVENT_CUSTOM_DS_OOB: Custom out-of-band downstream event.
+ * @GST_EVENT_CUSTOM_BOTH: Custom upstream or downstream event. In-band when travelling downstream.
+ * @GST_EVENT_CUSTOM_BOTH_OOB: Custom upstream or downstream out-of-band event.
*
+ * GstEventType lists the standard event types that can be sent in a pipeline.
+ *
+ * The custom event types can be used for private messages between elements that can't be expressed using normal
+ * GStreamer buffer passing semantics. Custom events carry an arbitrary GstStructure.
+ * Specific custom events are distinguished by the name of the structure.
*/
typedef enum {
GST_EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (32, GST_EVDIR_BOTH)
} GstEventType;
+/**
+ * @The name used for memory allocation tracing
+ */
#define GST_EVENT_TRACE_NAME "GstEvent"
typedef struct _GstEvent GstEvent;
{
GstEvent *event;
+ GST_DEBUG_OBJECT (src, "Sending newsegment from %" G_GINT64_FORMAT
+ " to %" G_GINT64_FORMAT, (gint64) src->segment_start,
+ (gint64) src->segment_end);
event = gst_event_new_newsegment (1.0,
GST_FORMAT_BYTES,
(gint64) src->segment_start, (gint64) src->segment_end, (gint64) 0);
if (GST_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED))
return TRUE;
+ GST_DEBUG_OBJECT (basesrc, "starting source");
+
basesrc->num_buffers_left = basesrc->num_buffers;
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
if (!GST_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED))
return TRUE;
+ GST_DEBUG_OBJECT (basesrc, "stopping source");
+
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
if (bclass->stop)
result = bclass->stop (basesrc);
/* prepare subclass first */
if (active) {
+ GST_DEBUG_OBJECT (basesrc, "Activating in push mode");
if (!gst_base_src_start (basesrc))
goto error_start;
return gst_pad_start_task (pad, (GstTaskFunction) gst_base_src_loop, pad);
} else {
+ GST_DEBUG_OBJECT (basesrc, "Deactivating in push mode");
return gst_base_src_deactivate (basesrc, pad);
}
error_start:
{
- GST_DEBUG_OBJECT (basesrc, "failed to start");
+ gst_base_src_stop (basesrc);
+ GST_DEBUG_OBJECT (basesrc, "Failed to start in push mode");
return FALSE;
}
}
/* prepare subclass first */
if (active) {
+ GST_DEBUG_OBJECT (basesrc, "Activating in pull mode");
if (!gst_base_src_start (basesrc))
goto error_start;
return TRUE;
} else {
+ GST_DEBUG_OBJECT (basesrc, "Deactivating in pull mode");
+
+ if (!gst_base_src_stop (basesrc))
+ goto error_stop;
+
return gst_base_src_deactivate (basesrc, pad);
}
error_start:
{
- GST_DEBUG_OBJECT (basesrc, "failed to start");
+ gst_base_src_stop (basesrc);
+ GST_DEBUG_OBJECT (basesrc, "Failed to start in pull mode");
+ return FALSE;
+ }
+error_stop:
+ {
+ GST_DEBUG_OBJECT (basesrc, "Failed to stop in pull mode");
return FALSE;
}
}
}
if ((presult = GST_ELEMENT_CLASS (parent_class)->change_state (element)) !=
- GST_STATE_SUCCESS)
+ GST_STATE_SUCCESS) {
+ gst_base_src_stop (basesrc);
return presult;
+ }
switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED:
GstCaps *caps;
guint64 size;
GList *buffers;
+ GstTypeFindFactory *factory;
}
GstTypeFindHelper;
GstPad *src;
GstFlowReturn ret;
- if (size == 0)
- return NULL;
-
find = (GstTypeFindHelper *) data;
src = find->src;
+ GST_LOG_OBJECT (src, "'%s' called peek (%" G_GINT64_FORMAT ", %u)",
+ GST_PLUGIN_FEATURE_NAME (find->factory), offset, size);
+
+ if (size == 0)
+ return NULL;
+
if (offset < 0) {
if (find->size == -1 || find->size < -offset)
return NULL;
{
GstTypeFindHelper *find = (GstTypeFindHelper *) data;
+ GST_LOG_OBJECT (find->src,
+ "'%s' called called suggest (%u, %" GST_PTR_FORMAT ")",
+ GST_PLUGIN_FEATURE_NAME (find->factory), probability, caps);
+
if (probability > find->best_probability) {
GstCaps *copy = gst_caps_copy (caps);
GList *walk, *type_list = NULL;
GstCaps *result = NULL;
+ g_return_val_if_fail (src != NULL, NULL);
+ g_return_val_if_fail (GST_PAD_GETRANGEFUNC (src) != NULL, NULL);
+
walk = type_list = gst_type_find_factory_get_list ();
find.src = src;
while (walk) {
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
+ find.factory = factory;
+
gst_type_find_factory_call_function (factory, &gst_find);
if (find.best_probability >= GST_TYPE_FIND_MAXIMUM)
break;
noinst_HEADERS = gst/capslist.h
-AM_CFLAGS = $(GST_OBJ_CFLAGS)
+AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
LDADD = $(GST_OBJ_LIBS) \
- $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la
+ $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
+ $(CHECK_LIBS)
gst_libs_gdp_SOURCES = \
gst-libs/gdp.c \
gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \
$(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
- $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
+ $(CHECK_LIBS) \
+ $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
# valgrind testing
# these just need valgrind fixing, period
case GST_EVENT_CUSTOM_UP:
case GST_EVENT_CUSTOM_BOTH:
case GST_EVENT_CUSTOM_BOTH_OOB:
+ if (got_event_before_q != NULL)
+ break;
gst_event_ref (data);
g_get_current_time (&got_event_time);
got_event_before_q = GST_EVENT (data);
case GST_EVENT_CUSTOM_DS_OOB:
case GST_EVENT_CUSTOM_BOTH:
case GST_EVENT_CUSTOM_BOTH_OOB:
+ if (got_event_after_q != NULL)
+ break;
gst_event_ref (data);
g_get_current_time (&got_event_time);
got_event_after_q = GST_EVENT (data);
}
static void test_event
- (GstEventType type, GstPad * pad, gboolean expect_before_q)
+ (GstBin * pipeline, GstEventType type, GstPad * pad,
+ gboolean expect_before_q)
{
GstEvent *event;
gint i;
got_event_before_q = got_event_after_q = NULL;
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+ gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
+
event = gst_event_new_custom (type,
gst_structure_empty_new ("application/x-custom"));
g_get_current_time (&sent_event_time);
fail_if (got_event_after_q == NULL);
fail_unless (GST_EVENT_TYPE (got_event_after_q) == type);
}
-};
+
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
+ gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
+
+ if (got_event_before_q)
+ gst_event_unref (got_event_before_q);
+ if (got_event_after_q)
+ gst_event_unref (got_event_after_q);
+
+ got_event_before_q = got_event_after_q = NULL;
+}
static gint64
timediff (GTimeVal * end, GTimeVal * start)
gst_pad_add_event_probe (sinkpad, (GCallback) event_probe,
GINT_TO_POINTER (FALSE));
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
/* Upstream events */
- test_event (GST_EVENT_CUSTOM_UP, sinkpad, TRUE);
+ test_event (pipeline, GST_EVENT_CUSTOM_UP, sinkpad, TRUE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_UP took to long to reach source");
+ "GST_EVENT_CUSTOM_UP took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH took to long to reach source");
+ "GST_EVENT_CUSTOM_BOTH took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source");
+ "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
/* Out of band downstream events */
- test_event (GST_EVENT_CUSTOM_DS_OOB, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_DS_OOB, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_DS_OOB took to long to reach source");
+ "GST_EVENT_CUSTOM_DS_OOB took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) < G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source");
+ "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
/* In-band downstream events are expected to take at least 1 second
* to traverse the the queue */
- test_event (GST_EVENT_CUSTOM_DS, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_DS, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) >= G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %lld us",
- timediff (&got_event_time, &sent_event_time));
+ "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
- test_event (GST_EVENT_CUSTOM_BOTH, srcpad, FALSE);
+ test_event (pipeline, GST_EVENT_CUSTOM_BOTH, srcpad, FALSE);
fail_unless (timediff (&got_event_time,
&sent_event_time) >= G_USEC_PER_SEC / 2,
- "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %lld us",
- timediff (&got_event_time, &sent_event_time));
+ "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %"
+ G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_bin_watch_for_state_change (GST_BIN (pipeline));
while (i < argc) {
GstElementStateReturn sret;
+ GstElementState state;
filename = argv[i];
g_object_set (source, "location", filename, NULL);
+ GST_DEBUG ("Starting typefinding for %s", filename);
+
/* typefind will only commit to PAUSED if it actually finds a type;
* otherwise the state change fails */
sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
- if (sret != GST_STATE_SUCCESS)
+ if (GST_STATE_ASYNC == sret) {
+ if (GST_STATE_FAILURE ==
+ gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL))
+ break;
+ } else if (sret != GST_STATE_SUCCESS)
g_print ("%s - No type found\n", argv[i]);
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
+ if (GST_STATE_ASYNC ==
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL)) {
+ if (GST_STATE_FAILURE ==
+ gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL))
+ break;
+ }
i++;
}