From 6aa149a930a8d0d38e7f6d6226393388510dbbe2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 29 Jun 2005 15:17:25 +0000 Subject: [PATCH] gst/: Moved gst_element_factory_can_[sink|src]_caps() to gstutils and added the definition to the header file. Original commit message from CVS: * gst/gstelementfactory.c: * gst/gstutils.h: * gst/gstutils.c: Moved gst_element_factory_can_[sink|src]_caps() to gstutils and added the definition to the header file. --- ChangeLog | 8 +++++ gst/gstelementfactory.c | 67 --------------------------------------- gst/gstutils.c | 69 +++++++++++++++++++++++++++++++++++++++++ gst/gstutils.h | 5 +++ 4 files changed, 82 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46a61c62bd..cbcba64ff1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-06-29 Edward Hervey + + * gst/gstelementfactory.c: + * gst/gstutils.h: + * gst/gstutils.c: + Moved gst_element_factory_can_[sink|src]_caps() to gstutils and added + the definition to the header file. + 2005-06-29 Andy Wingo * docs/gst/Makefile.am (scan-build.stamp): Totally only check diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 3f70ddce70..48212fc629 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -566,73 +566,6 @@ gst_element_factory_get_uri_protocols (GstElementFactory * factory) return factory->uri_protocols; } -/** - * gst_element_factory_can_src_caps : - * @factory: factory to query - * @caps: the caps to check - * - * Checks if the factory can source the given capability. - * - * Returns: true if it can src the capabilities - */ -gboolean -gst_element_factory_can_src_caps (GstElementFactory * factory, - const GstCaps * caps) -{ - GList *templates; - - g_return_val_if_fail (factory != NULL, FALSE); - g_return_val_if_fail (caps != NULL, FALSE); - - templates = factory->staticpadtemplates; - - while (templates) { - GstStaticPadTemplate *template = (GstStaticPadTemplate *) templates->data; - - if (template->direction == GST_PAD_SRC) { - if (gst_caps_is_always_compatible (gst_static_caps_get (&template-> - static_caps), caps)) - return TRUE; - } - templates = g_list_next (templates); - } - - return FALSE; -} - -/** - * gst_element_factory_can_sink_caps : - * @factory: factory to query - * @caps: the caps to check - * - * Checks if the factory can sink the given capability. - * - * Returns: true if it can sink the capabilities - */ -gboolean -gst_element_factory_can_sink_caps (GstElementFactory * factory, - const GstCaps * caps) -{ - GList *templates; - - g_return_val_if_fail (factory != NULL, FALSE); - g_return_val_if_fail (caps != NULL, FALSE); - - templates = factory->staticpadtemplates; - - while (templates) { - GstStaticPadTemplate *template = (GstStaticPadTemplate *) templates->data; - - if (template->direction == GST_PAD_SINK) { - if (gst_caps_is_always_compatible (caps, - gst_static_caps_get (&template->static_caps))) - return TRUE; - } - templates = g_list_next (templates); - } - - return FALSE; -} static void gst_element_factory_unload_thyself (GstPluginFeature * feature) { diff --git a/gst/gstutils.c b/gst/gstutils.c index 8bbaa58995..138aca161f 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -732,6 +732,75 @@ gst_element_state_get_name (GstElementState state) return ""; } +/** + * gst_element_factory_can_src_caps : + * @factory: factory to query + * @caps: the caps to check + * + * Checks if the factory can source the given capability. + * + * Returns: true if it can src the capabilities + */ +gboolean +gst_element_factory_can_src_caps (GstElementFactory * factory, + const GstCaps * caps) +{ + GList *templates; + + g_return_val_if_fail (factory != NULL, FALSE); + g_return_val_if_fail (caps != NULL, FALSE); + + templates = factory->staticpadtemplates; + + while (templates) { + GstStaticPadTemplate *template = (GstStaticPadTemplate *) templates->data; + + if (template->direction == GST_PAD_SRC) { + if (gst_caps_is_always_compatible (gst_static_caps_get (&template-> + static_caps), caps)) + return TRUE; + } + templates = g_list_next (templates); + } + + return FALSE; +} + +/** + * gst_element_factory_can_sink_caps : + * @factory: factory to query + * @caps: the caps to check + * + * Checks if the factory can sink the given capability. + * + * Returns: true if it can sink the capabilities + */ +gboolean +gst_element_factory_can_sink_caps (GstElementFactory * factory, + const GstCaps * caps) +{ + GList *templates; + + g_return_val_if_fail (factory != NULL, FALSE); + g_return_val_if_fail (caps != NULL, FALSE); + + templates = factory->staticpadtemplates; + + while (templates) { + GstStaticPadTemplate *template = (GstStaticPadTemplate *) templates->data; + + if (template->direction == GST_PAD_SINK) { + if (gst_caps_is_always_compatible (caps, + gst_static_caps_get (&template->static_caps))) + return TRUE; + } + templates = g_list_next (templates); + } + + return FALSE; +} + + /* if return val is true, *direct_child is a caller-owned ref on the direct * child of ancestor that is part of object's ancestry */ static gboolean diff --git a/gst/gstutils.h b/gst/gstutils.h index a6d0c2bb15..67382bb63d 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -251,6 +251,11 @@ gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadn GstElement *dest, const gchar *destpadname); void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname); + +/* 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); + /* util query functions */ gboolean gst_element_query_position (GstElement *element, GstFormat *format, gint64 *cur, gint64 *end);