mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
check/Makefile.am: Use CHECK_CFLAGS and CHECK_LIBS
Original commit message from CVS: * 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.
This commit is contained in:
parent
744193f884
commit
84b76a4359
12 changed files with 245 additions and 79 deletions
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
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:
|
||||
|
|
|
@ -61,9 +61,10 @@ check_PROGRAMS = $(TESTS)
|
|||
|
||||
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 \
|
||||
|
@ -73,6 +74,7 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
|
|||
|
||||
gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \
|
||||
$(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
|
||||
$(CHECK_LIBS) \
|
||||
$(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
|
||||
|
||||
# valgrind testing
|
||||
|
|
|
@ -202,6 +202,8 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_data)
|
|||
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);
|
||||
|
@ -215,6 +217,8 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_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);
|
||||
|
@ -228,13 +232,17 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_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);
|
||||
|
@ -261,7 +269,17 @@ static void test_event
|
|||
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)
|
||||
|
@ -301,48 +319,51 @@ GST_START_TEST (send_custom_events)
|
|||
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));
|
||||
|
|
|
@ -43,18 +43,18 @@ gst_event_new_flush() creates a new flush event.
|
|||
|
||||
<!-- ##### 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:
|
||||
|
|
|
@ -397,6 +397,9 @@ gst_base_src_send_discont (GstBaseSrc * src)
|
|||
{
|
||||
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);
|
||||
|
@ -882,6 +885,8 @@ gst_base_src_start (GstBaseSrc * basesrc)
|
|||
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);
|
||||
|
@ -960,6 +965,8 @@ gst_base_src_stop (GstBaseSrc * 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);
|
||||
|
@ -998,17 +1005,20 @@ gst_base_src_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
@ -1022,6 +1032,7 @@ gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
/* prepare subclass first */
|
||||
if (active) {
|
||||
GST_DEBUG_OBJECT (basesrc, "Activating in pull mode");
|
||||
if (!gst_base_src_start (basesrc))
|
||||
goto error_start;
|
||||
|
||||
|
@ -1032,12 +1043,23 @@ gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1078,8 +1100,10 @@ gst_base_src_change_state (GstElement * element)
|
|||
}
|
||||
|
||||
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:
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef struct
|
|||
GstCaps *caps;
|
||||
guint64 size;
|
||||
GList *buffers;
|
||||
GstTypeFindFactory *factory;
|
||||
}
|
||||
GstTypeFindHelper;
|
||||
|
||||
|
@ -50,12 +51,15 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
|
|||
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;
|
||||
|
@ -86,6 +90,10 @@ helper_find_suggest (gpointer data, guint probability, const GstCaps * caps)
|
|||
{
|
||||
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);
|
||||
|
||||
|
@ -103,6 +111,9 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
|||
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;
|
||||
|
@ -118,6 +129,8 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
|||
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;
|
||||
|
|
|
@ -49,21 +49,29 @@ G_BEGIN_DECLS
|
|||
/**
|
||||
* 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),
|
||||
|
@ -88,6 +96,9 @@ typedef enum {
|
|||
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;
|
||||
|
|
|
@ -397,6 +397,9 @@ gst_base_src_send_discont (GstBaseSrc * src)
|
|||
{
|
||||
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);
|
||||
|
@ -882,6 +885,8 @@ gst_base_src_start (GstBaseSrc * basesrc)
|
|||
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);
|
||||
|
@ -960,6 +965,8 @@ gst_base_src_stop (GstBaseSrc * 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);
|
||||
|
@ -998,17 +1005,20 @@ gst_base_src_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
@ -1022,6 +1032,7 @@ gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
/* prepare subclass first */
|
||||
if (active) {
|
||||
GST_DEBUG_OBJECT (basesrc, "Activating in pull mode");
|
||||
if (!gst_base_src_start (basesrc))
|
||||
goto error_start;
|
||||
|
||||
|
@ -1032,12 +1043,23 @@ gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1078,8 +1100,10 @@ gst_base_src_change_state (GstElement * element)
|
|||
}
|
||||
|
||||
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:
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef struct
|
|||
GstCaps *caps;
|
||||
guint64 size;
|
||||
GList *buffers;
|
||||
GstTypeFindFactory *factory;
|
||||
}
|
||||
GstTypeFindHelper;
|
||||
|
||||
|
@ -50,12 +51,15 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
|
|||
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;
|
||||
|
@ -86,6 +90,10 @@ helper_find_suggest (gpointer data, guint probability, const GstCaps * caps)
|
|||
{
|
||||
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);
|
||||
|
||||
|
@ -103,6 +111,9 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
|||
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;
|
||||
|
@ -118,6 +129,8 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
|||
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;
|
||||
|
|
|
@ -61,9 +61,10 @@ check_PROGRAMS = $(TESTS)
|
|||
|
||||
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 \
|
||||
|
@ -73,6 +74,7 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
|
|||
|
||||
gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \
|
||||
$(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
|
||||
$(CHECK_LIBS) \
|
||||
$(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
|
||||
|
||||
# valgrind testing
|
||||
|
|
|
@ -202,6 +202,8 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_data)
|
|||
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);
|
||||
|
@ -215,6 +217,8 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_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);
|
||||
|
@ -228,13 +232,17 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_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);
|
||||
|
@ -261,7 +269,17 @@ static void test_event
|
|||
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)
|
||||
|
@ -301,48 +319,51 @@ GST_START_TEST (send_custom_events)
|
|||
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));
|
||||
|
|
|
@ -79,18 +79,30 @@ main (int argc, char *argv[])
|
|||
|
||||
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++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue