wireplumber/lib/wp/collection-manager.h
Julian Bouzas 19d5ef54e9 lib: Add new WpCollectionManager API
This API allows handling of collections easily. It mainly allows creating them,
destroying them, collect globals into a them and dropping glovals from them.
The manager also automatically destroys a collection of all globals where
dropped from the collection.
2026-03-20 11:10:17 -04:00

105 lines
2.7 KiB
C

/* WirePlumber
*
* Copyright © 2025 Collabora Ltd.
* @author Julian Bouzas <julian.bouzas@ollabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_COLLECTION_MANAGER_H__
#define __WIREPLUMBER_COLLECTION_MANAGER_H__
#include "object.h"
#include "collection.h"
G_BEGIN_DECLS
/*!
* \brief Flags to be used as WpObjectFeatures for WpCollectionManager.
* \ingroup wpcollectionmanager
*/
typedef enum { /*< flags >*/
/*! Loads the collection manager */
WP_COLLECTION_MANAGER_LOADED = (1 << 0),
} WpCollectionManagerFeatures;
/*!
* \brief The WpCollectionManager GType
* \ingroup wpcollectionmanager
*/
#define WP_TYPE_COLLECTION_MANAGER (wp_collection_manager_get_type ())
WP_API
G_DECLARE_FINAL_TYPE (WpCollectionManager, wp_collection_manager, WP,
COLLECTION_MANAGER, WpObject)
WP_API
WpCollectionManager * wp_collection_manager_new (WpCore * core,
const gchar * metadata_name);
WP_API
WpCollectionManager * wp_collection_manager_find (WpCore * core,
const gchar *metadata_name);
/* Collection */
WP_API
void wp_collection_manager_create_collection (WpCollectionManager *self,
const gchar *collection_name, GCancellable * cancellable,
GAsyncReadyCallback callback, gpointer user_data);
WP_API
void wp_collection_manager_create_collection_closure (WpCollectionManager *self,
const gchar *collection_name, GCancellable * cancellable,
GClosure *closure);
WP_API
WpCollection *wp_collection_manager_create_collection_finish (
WpCollectionManager * self, GAsyncResult * res, GError ** error);
WP_API
gboolean wp_collection_manager_destroy_collection (WpCollectionManager *self,
const gchar *collection_name);
WP_API
gboolean wp_collection_manager_has_collection (WpCollectionManager *self,
const gchar *collection_name);
WP_API
WpCollection * wp_collection_manager_get_collection (
WpCollectionManager *self, const gchar *collection_name);
WP_API
guint wp_collection_manager_get_collection_count (WpCollectionManager *self);
WP_API
WpIterator * wp_collection_manager_new_collection_iterator (
WpCollectionManager *self);
/* Global */
WP_API
gboolean wp_collection_manager_collect_global (WpCollectionManager *self,
WpGlobalProxy *global, const gchar *collection_name);
WP_API
gboolean wp_collection_manager_drop_global (WpCollectionManager *self,
WpGlobalProxy *global);
WP_API
WpCollection * wp_collection_manager_get_global_collection (
WpCollectionManager *self, WpGlobalProxy *global);
WP_API
gboolean wp_collection_manager_is_global_collected (WpCollectionManager *self,
WpGlobalProxy *global, const gchar *collection_name);
WP_API
WpIterator * wp_collection_manager_new_global_iterator (
WpCollectionManager *self, const gchar *collection_name);
G_END_DECLS
#endif