wireplumber/modules/module-metadata.c

64 lines
1.5 KiB
C
Raw Normal View History

2020-07-29 19:27:40 +05:30
/* WirePlumber
*
2020-08-31 16:21:07 +03:00
* Copyright © 2020 Collabora Ltd.
2020-07-29 19:27:40 +05:30
* @author Raghavendra Rao <raghavendra.rao@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#include <wp/wp.h>
#include <pipewire/pipewire.h>
2020-08-31 16:21:07 +03:00
struct _WpMetadataPlugin
2020-07-29 19:27:40 +05:30
{
WpPlugin parent;
WpImplMetadata *metadata;
};
2020-08-31 16:21:07 +03:00
G_DECLARE_FINAL_TYPE (WpMetadataPlugin, wp_metadata_plugin,
WP, METADATA_PLUGIN, WpPlugin)
G_DEFINE_TYPE (WpMetadataPlugin, wp_metadata_plugin, WP_TYPE_PLUGIN)
2020-07-29 19:27:40 +05:30
static void
2020-08-31 16:21:07 +03:00
wp_metadata_plugin_init (WpMetadataPlugin * self)
2020-07-29 19:27:40 +05:30
{
}
static void
2020-08-31 16:21:07 +03:00
wp_metadata_plugin_activate (WpPlugin * plugin)
2020-07-29 19:27:40 +05:30
{
2020-08-31 16:21:07 +03:00
WpMetadataPlugin * self = WP_METADATA_PLUGIN (plugin);
2020-07-29 19:27:40 +05:30
g_autoptr (WpCore) core = wp_plugin_get_core (plugin);
g_return_if_fail (core);
2020-08-31 16:21:07 +03:00
self->metadata = wp_impl_metadata_new (core);
2020-07-29 19:27:40 +05:30
wp_proxy_augment (WP_PROXY(self->metadata),
2020-08-31 16:21:07 +03:00
WP_PROXY_FEATURES_STANDARD, NULL,
2020-07-29 19:27:40 +05:30
NULL, self);
}
static void
2020-08-31 16:21:07 +03:00
wp_metadata_plugin_deactivate (WpPlugin * plugin)
2020-07-29 19:27:40 +05:30
{
2020-08-31 16:21:07 +03:00
WpMetadataPlugin * self = WP_METADATA_PLUGIN (plugin);
2020-07-29 19:27:40 +05:30
g_clear_object (&self->metadata);
}
static void
2020-08-31 16:21:07 +03:00
wp_metadata_plugin_class_init (WpMetadataPluginClass * klass)
2020-07-29 19:27:40 +05:30
{
WpPluginClass *plugin_class = (WpPluginClass *) klass;
2020-08-31 16:21:07 +03:00
plugin_class->activate = wp_metadata_plugin_activate;
plugin_class->deactivate = wp_metadata_plugin_deactivate;
2020-07-29 19:27:40 +05:30
}
WP_PLUGIN_EXPORT void
wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args)
{
2020-08-31 16:21:07 +03:00
wp_plugin_register (g_object_new (wp_metadata_plugin_get_type (),
2020-07-29 19:27:40 +05:30
"module", module,
NULL));
2020-08-31 16:21:07 +03:00
}