gst/gstpad.c: Don't allow activation of a srcpad in pull_range if it has no getrange function.

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_activate_pull), (gst_pad_link_prepare):
Don't allow activation of a srcpad in pull_range if it has no
getrange function.
Change some debug statements to be a little clearer

* plugins/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query):
Check that we have a peer before executing queries thereupon.

* tests/examples/metadata/read-metadata.c: (message_loop):
Use gst_bus_pop instead of gst_bus_poll when we just want it to
immediately return us any available message with 0 timeout.
This commit is contained in:
Jan Schmidt 2005-12-14 10:09:35 +00:00
parent 83a815e648
commit bcdfacaf5d
4 changed files with 34 additions and 8 deletions

View file

@ -1,3 +1,18 @@
2005-12-14 Jan Schmidt <thaytan@mad.scientist.com>
* gst/gstpad.c: (gst_pad_activate_pull), (gst_pad_link_prepare):
Don't allow activation of a srcpad in pull_range if it has no
getrange function.
Change some debug statements to be a little clearer
* plugins/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query):
Check that we have a peer before executing queries thereupon.
* tests/examples/metadata/read-metadata.c: (message_loop):
Use gst_bus_pop instead of gst_bus_poll when we just want it to
immediately return us any available message with 0 timeout.
2005-12-12 Michael Smith <msmith@fluendo.com>
* gst/gsttypefindfactory.c: (gst_type_find_factory_call_function):

View file

@ -706,6 +706,10 @@ gst_pad_activate_pull (GstPad * pad, gboolean active)
goto peer_failed;
gst_object_unref (peer);
}
} else {
if (GST_PAD_GETRANGEFUNC (pad) == NULL)
goto failure; /* Can't activate pull on a src without a
getrange function */
}
new = active ? GST_ACTIVATE_PULL : GST_ACTIVATE_NONE;
@ -1624,7 +1628,7 @@ not_srcpad:
}
src_was_linked:
{
GST_CAT_INFO (GST_CAT_PADS, "src %s:%s was linked",
GST_CAT_INFO (GST_CAT_PADS, "src %s:%s was already linked",
GST_DEBUG_PAD_NAME (srcpad));
/* we do not emit a warning in this case because unlinking cannot
* be made MT safe.*/
@ -1640,7 +1644,7 @@ not_sinkpad:
}
sink_was_linked:
{
GST_CAT_INFO (GST_CAT_PADS, "sink %s:%s was linked",
GST_CAT_INFO (GST_CAT_PADS, "sink %s:%s was already linked",
GST_DEBUG_PAD_NAME (sinkpad));
/* we do not emit a warning in this case because unlinking cannot
* be made MT safe.*/

View file

@ -308,14 +308,19 @@ static gboolean
gst_type_find_handle_src_query (GstPad * pad, GstQuery * query)
{
GstTypeFindElement *typefind;
gboolean res;
gboolean res = FALSE;
GstPad *peer;
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
res = gst_pad_query (GST_PAD_PEER (typefind->sink), query);
if (!res)
peer = gst_pad_get_peer (typefind->sink);
if (peer == NULL)
return FALSE;
res = gst_pad_query (peer, query);
if (!res)
goto out;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
@ -323,7 +328,7 @@ gst_type_find_handle_src_query (GstPad * pad, GstQuery * query)
GstFormat format;
if (typefind->store == NULL)
return TRUE;
goto out;
gst_query_parse_position (query, &format, &peer_pos);
@ -343,7 +348,9 @@ gst_type_find_handle_src_query (GstPad * pad, GstQuery * query)
break;
}
return TRUE;
out:
gst_object_unref (peer);
return res;
}
#if 0

View file

@ -51,7 +51,7 @@ message_loop (GstElement * element, GstTagList ** tags)
while (!done) {
GstMessage *message;
message = gst_bus_poll (bus, GST_MESSAGE_ANY, 0);
message = gst_bus_pop (bus);
if (message == NULL)
/* All messages read, we're done */
break;