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.
This commit is contained in:
Edward Hervey 2005-06-29 15:17:25 +00:00
parent a42fb99bac
commit 6aa149a930
4 changed files with 82 additions and 67 deletions

View file

@ -1,3 +1,11 @@
2005-06-29 Edward Hervey <edward@fluendo.com>
* 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 <wingo@pobox.com>
* docs/gst/Makefile.am (scan-build.stamp): Totally only check

View file

@ -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)
{

View file

@ -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

View file

@ -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);