element/deviceprovider: Add instance getter functions for class properties

That is, the metadata and pad templates. Using instance getters is
easier to deal with for bindings, especially autogenerated ones.
This commit is contained in:
Sebastian Dröge 2017-08-17 14:13:39 +03:00
parent 82ed369991
commit 0459b2db84
6 changed files with 106 additions and 0 deletions

View file

@ -896,6 +896,7 @@ gst_element_link_filtered
<SUBSECTION element-properties>
gst_element_class_get_metadata
gst_element_get_metadata
gst_element_set_base_time
gst_element_get_base_time
gst_element_set_start_time
@ -911,6 +912,8 @@ gst_element_set_name
gst_element_get_name
gst_element_set_parent
gst_element_get_parent
gst_element_get_pad_template
gst_element_get_pad_template_list
<SUBSECTION element-clocks>
gst_element_set_clock
@ -3824,6 +3827,7 @@ gst_device_provider_device_remove
gst_device_provider_get_bus
gst_device_provider_get_devices
gst_device_provider_get_factory
gst_device_provider_get_metadata
gst_device_provider_register
gst_device_provider_start
gst_device_provider_stop

View file

@ -351,6 +351,29 @@ gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
return gst_structure_get_string ((GstStructure *) klass->metadata, key);
}
/**
* gst_device_provider_get_metadata:
* @provider: provider to get metadata for
* @key: the key to get
*
* Get metadata with @key in @provider.
*
* Returns: the metadata for @key.
*
* Since: 1.14
*/
const gchar *
gst_device_provider_get_metadata (GstDeviceProvider * provider,
const gchar * key)
{
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
g_return_val_if_fail (key != NULL, NULL);
return
gst_device_provider_class_get_metadata (GST_DEVICE_PROVIDER_GET_CLASS
(provider), key);
}
/**
* gst_device_provider_get_devices:
* @provider: A #GstDeviceProvider

View file

@ -134,6 +134,9 @@ GST_EXPORT
void gst_device_provider_unhide_provider (GstDeviceProvider * provider,
const gchar * name);
GST_EXPORT
const gchar * gst_device_provider_get_metadata (GstDeviceProvider * provider,
const gchar * key);
/* device provider class meta data */

View file

@ -1461,6 +1461,26 @@ gst_element_class_get_metadata (GstElementClass * klass, const gchar * key)
return gst_structure_get_string ((GstStructure *) klass->metadata, key);
}
/**
* gst_element_get_metadata:
* @element: class to get metadata for
* @key: the key to get
*
* Get metadata with @key in @klass.
*
* Returns: the metadata for @key.
*
* Since: 1.14
*/
const gchar *
gst_element_get_metadata (GstElement * element, const gchar * key)
{
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (key != NULL, NULL);
return gst_element_class_get_metadata (GST_ELEMENT_GET_CLASS (element), key);
}
/**
* gst_element_class_get_pad_template_list:
* @element_class: a #GstElementClass to get pad templates of.
@ -1482,6 +1502,27 @@ gst_element_class_get_pad_template_list (GstElementClass * element_class)
return element_class->padtemplates;
}
/**
* gst_element_get_pad_template_list:
* @element: a #GstElement to get pad templates of.
*
* Retrieves a list of the pad templates associated with @element. The
* list must not be modified by the calling code.
*
* Returns: (transfer none) (element-type Gst.PadTemplate): the #GList of
* pad templates.
*
* Since: 1.14
*/
GList *
gst_element_get_pad_template_list (GstElement * element)
{
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return
gst_element_class_get_pad_template_list (GST_ELEMENT_GET_CLASS (element));
}
/**
* gst_element_class_get_pad_template:
* @element_class: a #GstElementClass to get the pad template of.
@ -1519,6 +1560,29 @@ gst_element_class_get_pad_template (GstElementClass *
return NULL;
}
/**
* gst_element_get_pad_template:
* @element: a #GstElement to get the pad template of.
* @name: the name of the #GstPadTemplate to get.
*
* Retrieves a padtemplate from @element with the given name.
*
* Returns: (transfer none) (nullable): the #GstPadTemplate with the
* given name, or %NULL if none was found. No unreferencing is
* necessary.
*
* Since: 1.14
*/
GstPadTemplate *
gst_element_get_pad_template (GstElement * element, const gchar * name)
{
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (name != NULL, NULL);
return gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (element),
name);
}
static GstPadTemplate *
gst_element_class_get_request_pad_template (GstElementClass *
element_class, const gchar * name)

View file

@ -1008,6 +1008,14 @@ GST_EXPORT
void gst_element_remove_property_notify_watch (GstElement * element,
gulong watch_id);
GST_EXPORT
GstPadTemplate* gst_element_get_pad_template (GstElement *element, const gchar *name);
GST_EXPORT
GList* gst_element_get_pad_template_list (GstElement *element);
GST_EXPORT
const gchar * gst_element_get_metadata (GstElement * element, const gchar * key);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstElement, gst_object_unref)
#endif

View file

@ -479,6 +479,7 @@ EXPORTS
gst_device_provider_get_devices
gst_device_provider_get_factory
gst_device_provider_get_hidden_providers
gst_device_provider_get_metadata
gst_device_provider_get_type
gst_device_provider_hide_provider
gst_device_provider_register
@ -536,6 +537,9 @@ EXPORTS
gst_element_get_context_unlocked
gst_element_get_contexts
gst_element_get_factory
gst_element_get_metadata
gst_element_get_pad_template
gst_element_get_pad_template_list
gst_element_get_request_pad
gst_element_get_start_time
gst_element_get_state