mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 22:12:34 +00:00
gst/base/gstbasesrc.c (gst_base_src_start): Post an error if the source couldn't negotiate.
Original commit message from CVS: 2005-07-13 Andy Wingo <wingo@pobox.com> * gst/base/gstbasesrc.c (gst_base_src_start): Post an error if the source couldn't negotiate.
This commit is contained in:
parent
b6df31811d
commit
9cb62f69e3
7 changed files with 93 additions and 5 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2005-07-13 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* gst/base/gstbasesrc.c (gst_base_src_start): Post an error if the
|
||||
source couldn't negotiate.
|
||||
|
||||
* gst/parse/grammar.y: Revert 1.54->1.55, so we now do filtered
|
||||
connections again.
|
||||
|
||||
* gst/gstutils.h:
|
||||
* gst/gstutils.c (gst_element_link_pads_filtered): New old
|
||||
function. I am channeling Hades. Put your boots on suckers!!!
|
||||
|
||||
2005-07-13 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* testsuite/caps/Makefile.am:
|
||||
|
|
|
@ -14,6 +14,9 @@ GstMiniObject
|
|||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstMiniObject ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -883,6 +883,9 @@ could_not_start:
|
|||
could_not_negotiate:
|
||||
{
|
||||
GST_DEBUG_OBJECT (basesrc, "could not negotiate, stopping");
|
||||
GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT,
|
||||
("Could not connect source to pipeline"),
|
||||
("Check your filtered caps, if any"));
|
||||
gst_base_src_stop (basesrc);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1228,6 +1228,68 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_link_pads_filtered:
|
||||
* @src: a #GstElement containing the source pad.
|
||||
* @srcpadname: the name of the #GstPad in source element or NULL for any pad.
|
||||
* @dest: the #GstElement containing the destination pad.
|
||||
* @destpadname: the name of the #GstPad in destination element or NULL for any pad.
|
||||
* @caps: the #GstCaps to filter the link, or #NULL for no filter.
|
||||
*
|
||||
* Links the two named pads of the source and destination elements. Side effect
|
||||
* is that if one of the pads has no parent, it becomes a child of the parent of
|
||||
* the other element. If they have different parents, the link fails. If @caps
|
||||
* is not #NULL, makes sure that the caps of the link is a subset of @caps.
|
||||
*
|
||||
* Returns: TRUE if the pads could be linked, FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
||||
GstElement * dest, const gchar * destpadname, GstCaps * filter)
|
||||
{
|
||||
/* checks */
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (src), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (dest), FALSE);
|
||||
g_return_val_if_fail (filter == NULL || GST_IS_CAPS (filter), FALSE);
|
||||
|
||||
if (filter) {
|
||||
GstElement *capsfilter;
|
||||
GstObject *parent;
|
||||
|
||||
capsfilter = gst_element_factory_make ("capsfilter", NULL);
|
||||
if (!capsfilter) {
|
||||
GST_ERROR ("Could not make a capsfilter");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
parent = gst_object_get_parent (GST_OBJECT (src));
|
||||
g_return_val_if_fail (GST_IS_BIN (parent), FALSE);
|
||||
|
||||
if (!gst_bin_add (GST_BIN (parent), capsfilter)) {
|
||||
GST_ERROR ("Could not add capsfilter");
|
||||
gst_object_unref (capsfilter);
|
||||
gst_object_unref (parent);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_object_unref (parent);
|
||||
|
||||
g_object_set (capsfilter, "filter-caps", filter, NULL);
|
||||
|
||||
if (gst_element_link_pads (src, srcpadname, capsfilter, "sink")
|
||||
&& gst_element_link_pads (capsfilter, "src", dest, destpadname)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
GST_INFO ("Could not link elements");
|
||||
gst_bin_remove (GST_BIN (GST_OBJECT_PARENT (capsfilter)), capsfilter);
|
||||
/* will unref and unlink as appropriate */
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
return gst_element_link_pads (src, srcpadname, dest, destpadname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_link:
|
||||
* @src: a #GstElement containing the source pad.
|
||||
|
@ -1243,7 +1305,7 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname,
|
|||
gboolean
|
||||
gst_element_link (GstElement * src, GstElement * dest)
|
||||
{
|
||||
return gst_element_link_pads (src, NULL, dest, NULL);
|
||||
return gst_element_link_pads_filtered (src, NULL, dest, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -252,6 +252,10 @@ gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadn
|
|||
void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname,
|
||||
GstElement *dest, const gchar *destpadname);
|
||||
|
||||
gboolean gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
||||
GstElement * dest, const gchar * destpadname,
|
||||
GstCaps *filter);
|
||||
|
||||
/* util elementfactory functions */
|
||||
gboolean gst_element_factory_can_src_caps(GstElementFactory *factory, const GstCaps *caps);
|
||||
gboolean gst_element_factory_can_sink_caps(GstElementFactory *factory, const GstCaps *caps);
|
||||
|
|
|
@ -377,7 +377,7 @@ gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
|
|||
GST_ELEMENT_NAME (src), link->src_pad,
|
||||
GST_ELEMENT_NAME (link->sink), link->sink_pad);
|
||||
|
||||
if (gst_element_link_pads (src, link->src_pad, link->sink, link->sink_pad)) {
|
||||
if (gst_element_link_pads_filtered (src, link->src_pad, link->sink, link->sink_pad, link->caps)) {
|
||||
/* do this here, we don't want to get any problems later on when unlocking states */
|
||||
GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
|
||||
GST_ELEMENT_NAME (src), link->src_pad,
|
||||
|
@ -447,8 +447,9 @@ gst_parse_perform_link (link_t *link, graph_t *graph)
|
|||
link->caps);
|
||||
|
||||
if (!srcs || !sinks) {
|
||||
if (gst_element_link_pads (src, srcs ? (const gchar *) srcs->data : NULL,
|
||||
sink, sinks ? (const gchar *) sinks->data : NULL)) {
|
||||
if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL,
|
||||
sink, sinks ? (const gchar *) sinks->data : NULL,
|
||||
link->caps)) {
|
||||
gst_parse_element_lock (sink, gst_element_is_locked_state (src));
|
||||
goto success;
|
||||
} else {
|
||||
|
@ -470,7 +471,7 @@ gst_parse_perform_link (link_t *link, graph_t *graph)
|
|||
const gchar *sink_pad = (const gchar *) sinks->data;
|
||||
srcs = g_slist_next (srcs);
|
||||
sinks = g_slist_next (sinks);
|
||||
if (gst_element_link_pads (src, src_pad, sink, sink_pad)) {
|
||||
if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad, link->caps)) {
|
||||
gst_parse_element_lock (sink, gst_element_is_locked_state (src));
|
||||
continue;
|
||||
} else {
|
||||
|
|
|
@ -883,6 +883,9 @@ could_not_start:
|
|||
could_not_negotiate:
|
||||
{
|
||||
GST_DEBUG_OBJECT (basesrc, "could not negotiate, stopping");
|
||||
GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT,
|
||||
("Could not connect source to pipeline"),
|
||||
("Check your filtered caps, if any"));
|
||||
gst_base_src_stop (basesrc);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue