diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 44f1ebe1a6..8b790bc7b2 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -197,6 +197,8 @@ gst_elementfactory_find gst_elementfactory_get_list gst_elementfactory_can_src_caps gst_elementfactory_can_sink_caps +gst_elementfactory_can_src_caps_list +gst_elementfactory_can_sink_caps_list gst_elementfactory_create gst_elementfactory_make gst_elementfactory_save_thyself @@ -305,8 +307,10 @@ gst_pad_set_chain_function gst_pad_set_get_function gst_pad_set_getregion_function gst_pad_set_qos_function -gst_pad_set_caps -gst_pad_get_caps +gst_pad_set_caps_list +gst_pad_get_caps_list +gst_pad_get_caps_by_name +gst_pad_check_compatibility gst_pad_set_name gst_pad_get_name gst_pad_set_parent @@ -331,6 +335,8 @@ GST_PAD_FACTORY_SOMETIMES GST_PAD_FACTORY_ALWAYS GST_PAD_FACTORY_SINK GST_PAD_FACTORY_SRC +GST_PAD_FACTORY_CAPS + GstPadPresence GstPadTemplate @@ -385,6 +391,8 @@ GST_AUTOPLUG_MAX_COST GstAutoplugCostFunction GstAutoplugListFunction gst_autoplug_caps +gst_autoplug_pads +gst_autoplug_caps_list GstAutoplug GST_AUTOPLUG @@ -496,9 +504,11 @@ GstCapsFactory[] gst_caps_new gst_caps_new_with_props gst_caps_register +gst_caps_register_count gst_caps_set_props gst_caps_get_props gst_caps_check_compatibility +gst_caps_list_check_compatibility gst_caps_save_thyself gst_caps_load_thyself @@ -517,6 +527,7 @@ GST_PROPS_FOURCC GST_PROPS_FOURCC_INT GST_PROPS_BOOLEAN gst_props_register +gst_props_register_count gst_props_new gst_props_merge gst_props_check_compatibility @@ -532,6 +543,7 @@ GST_PROPS_INT_ID GST_PROPS_INT_RANGE_ID GST_PROPS_FOURCC_ID GST_PROPS_BOOL_ID +GST_PROPS_LAST_ID
diff --git a/docs/gst/tmpl/gstautoplug.sgml b/docs/gst/tmpl/gstautoplug.sgml index d96f6d9d8a..6eff251d89 100644 --- a/docs/gst/tmpl/gstautoplug.sgml +++ b/docs/gst/tmpl/gstautoplug.sgml @@ -44,11 +44,31 @@ Get a list of all elements. These elements will be used in autoplugging -Perform autoplugging between the two given caps. + -@srccaps: the source capability structure -@sinkcaps: the sink capability structure -@Returns: th GList of elements that convert srccaps into sinkcaps. +@srccaps: +@sinkcaps: +@Returns: + + + + + + + +@srcpad: +@sinkpad: +@Returns: + + + + + + + +@srccaps: +@sinkcaps: +@Returns: diff --git a/docs/gst/tmpl/gstcaps.sgml b/docs/gst/tmpl/gstcaps.sgml index 4cb67217b0..6c53861409 100644 --- a/docs/gst/tmpl/gstcaps.sgml +++ b/docs/gst/tmpl/gstcaps.sgml @@ -20,6 +20,7 @@ a mime-type and a set of properties. +@name: @id: the typeid of the capability @properties: the properties of the capability @@ -40,6 +41,7 @@ a mime-type and a set of properties. +@name: @mime: @Returns: @@ -49,6 +51,7 @@ a mime-type and a set of properties. +@name: @mime: @props: @Returns: @@ -63,6 +66,18 @@ a mime-type and a set of properties. @Returns: + + + + + +@factory: +@counter: +@Returns: + +@count: + + @@ -95,6 +110,16 @@ a mime-type and a set of properties. @caps2: + + + + + +@fromcaps: +@tocaps: +@Returns: + + diff --git a/docs/gst/tmpl/gstelement.sgml b/docs/gst/tmpl/gstelement.sgml index e3b0c19d0b..f9aadd3c05 100644 --- a/docs/gst/tmpl/gstelement.sgml +++ b/docs/gst/tmpl/gstelement.sgml @@ -432,6 +432,26 @@ circumstances. @Returns: + + + + + +@factory: +@caps: +@Returns: + + + + + + + +@factory: +@caps: +@Returns: + + diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index 61399f0b70..3da1deb959 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -197,7 +197,7 @@ Destroy the pad @qos: - + @@ -206,7 +206,7 @@ Destroy the pad @caps: - + @@ -215,6 +215,26 @@ Destroy the pad @Returns: + + + + + +@pad: +@name: +@Returns: + + + + + + + +@srcpad: +@sinkpad: +@Returns: + + @@ -415,6 +435,14 @@ Indicates a srcpad for the padfactory. + + +Starts the declaration of a the capabilities for this padtemplate + + +@a...: a capability factory + + Indicates when this pad will become available diff --git a/docs/gst/tmpl/gstprops.sgml b/docs/gst/tmpl/gstprops.sgml index e3f3eb4b6b..b3072e8b93 100644 --- a/docs/gst/tmpl/gstprops.sgml +++ b/docs/gst/tmpl/gstprops.sgml @@ -95,6 +95,16 @@ Create a boolean property @Returns: + + + + + +@factory: +@counter: +@Returns: + + diff --git a/docs/gst/tmpl/gstreamer-unused.sgml b/docs/gst/tmpl/gstreamer-unused.sgml index 2ccba7df98..9c4ed92c38 100644 --- a/docs/gst/tmpl/gstreamer-unused.sgml +++ b/docs/gst/tmpl/gstreamer-unused.sgml @@ -1258,6 +1258,14 @@ The end point of a filter graph @Returns: + + + + + +@pad: +@caps: + @@ -2004,6 +2012,14 @@ GstFilter @buf: + + + + + +@pad: +@Returns: + diff --git a/gst/Makefile.am b/gst/Makefile.am index fb114fc16b..2b58c3a982 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -82,7 +82,7 @@ noinst_HEADERS = \ gsti386.h \ gstppc.h -CFLAGS += -g -Wall +CFLAGS += -O2 -Wall libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS) libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) diff --git a/gst/gstautoplug.c b/gst/gstautoplug.c index 20b38dfdac..6ffdde6c1a 100644 --- a/gst/gstautoplug.c +++ b/gst/gstautoplug.c @@ -143,6 +143,16 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data) return GST_AUTOPLUG_MAX_COST; } +/** + * gst_autoplug_caps: + * @srccaps: the source caps + * @sinkcaps: the sink caps + * + * Perform autoplugging between the two given caps. + * + * Returns: a list of elementfactories that can connect + * the two caps + */ GList* gst_autoplug_caps (GstCaps *srccaps, GstCaps *sinkcaps) { @@ -159,6 +169,16 @@ gst_autoplug_caps (GstCaps *srccaps, GstCaps *sinkcaps) &caps); } +/** + * gst_autoplug_caps_list: + * @srccaps: the source caps list + * @sinkcaps: the sink caps list + * + * Perform autoplugging between the two given caps lists. + * + * Returns: a list of elementfactories that can connect + * the two caps lists + */ GList* gst_autoplug_caps_list (GList *srccaps, GList *sinkcaps) { @@ -175,6 +195,16 @@ gst_autoplug_caps_list (GList *srccaps, GList *sinkcaps) &caps); } +/** + * gst_autoplug_pads: + * @srcpad: the source pad + * @sinkpad: the sink pad + * + * Perform autoplugging between the two given pads + * + * Returns: a list of elementfactories that can connect + * the two pads + */ GList* gst_autoplug_pads (GstPad *srcpad, GstPad *sinkpad) { diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 8952844879..d4acb0af9c 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -45,7 +45,7 @@ void _gst_caps_initialize (void); GstCaps* gst_caps_new (gchar *name, gchar *mime); GstCaps* gst_caps_new_with_props (gchar *name, gchar *mime, GstProps *props); GstCaps* gst_caps_register (GstCapsFactory *factory); -GstCaps* gst_caps_register_count (GstCapsFactory *factory, guint *count); +GstCaps* gst_caps_register_count (GstCapsFactory *factory, guint *counter); GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props); GstProps* gst_caps_get_props (GstCaps *caps); diff --git a/gst/gstpad.c b/gst/gstpad.c index 42f3957dfa..e009cbf5ba 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -469,20 +469,13 @@ gst_pad_connect (GstPad *srcpad, g_return_if_fail((srcpad->direction == GST_PAD_SRC) && (sinkpad->direction == GST_PAD_SINK)); - /* chack pad compatibility */ - if (srcpad->caps && sinkpad->caps) { - if (!gst_caps_check_compatibility (srcpad->caps, sinkpad->caps)) { - g_warning ("gstpad: connecting incompatible pads (%s:%s) and (%s:%s)\n", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); - } - else { - DEBUG ("gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); - } + if (!gst_pad_check_compatibility (srcpad, sinkpad)) { + g_warning ("gstpad: connecting incompatible pads (%s:%s) and (%s:%s)\n", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); } else { - DEBUG ("gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); + DEBUG ("gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); } /* first set peers */ @@ -610,6 +603,7 @@ gst_pad_set_caps_list (GstPad *pad, pad->caps = caps; } + /** * gst_pad_get_caps_list: * @pad: the pad to get the capabilities from @@ -627,6 +621,70 @@ gst_pad_get_caps_list (GstPad *pad) return pad->caps; } +/** + * gst_pad_get_caps_by_name: + * @pad: the pad to get the capabilities from + * @name: the name of the capability to get + * + * get the capabilities with the given name from this pad + * + * Returns: a capability or NULL if not found + */ +GstCaps * +gst_pad_get_caps_by_name (GstPad *pad, gchar *name) +{ + GList *caps; + + g_return_val_if_fail (pad != NULL, NULL); + g_return_val_if_fail (GST_IS_PAD (pad), NULL); + + caps = pad->caps; + + while (caps) { + GstCaps *cap = (GstCaps *)caps->data; + + if (!strcmp (cap->name, name)) + return cap; + + caps = g_list_next (caps); + } + + return NULL; +} + +/** + * gst_pad_check_compatibility: + * @srcpad: the srcpad to check + * @sinkpad: the sinkpad to check against + * + * check if two pads have compatible capabilities + * + * Returns: TRUE if they are compatible ot the capabilities + * could not be checked + */ +gboolean +gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad) +{ + g_return_val_if_fail (srcpad != NULL, FALSE); + g_return_val_if_fail (GST_IS_PAD (srcpad), FALSE); + g_return_val_if_fail (sinkpad != NULL, FALSE); + g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE); + + if (srcpad->caps && sinkpad->caps) { + if (!gst_caps_list_check_compatibility (srcpad->caps, sinkpad->caps)) { + return FALSE; + } + else { + return TRUE; + } + } + else { + DEBUG ("gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); + return TRUE; + } +} + /** * gst_pad_get_peer: * @pad: the pad to get the peer from diff --git a/tests/.gitignore b/tests/.gitignore index a471d16e13..f688ba124e 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -18,3 +18,5 @@ paranoia props autoplug mp3encode +case4 +padfactory