| 1 |
/* WirePlumber |
| 2 |
* |
| 3 |
* Copyright © 2020 Collabora Ltd. |
| 4 |
* @author Julian Bouzas <[email protected]> |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: MIT |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef __WIREPLUMBER_SPA_TYPE_H__ |
| 10 |
#define __WIREPLUMBER_SPA_TYPE_H__ |
| 11 |
|
| 12 |
#include "defs.h" |
| 13 |
#include "iterator.h" |
| 14 |
|
| 15 |
G_BEGIN_DECLS |
| 16 |
|
| 17 |
/*! |
| 18 |
* \ingroup wpspatype |
| 19 |
*/ |
| 20 |
typedef guint32 WpSpaType; |
| 21 |
/*! |
| 22 |
* \ingroup wpspatype |
| 23 |
*/ |
| 24 |
typedef gconstpointer WpSpaIdTable; |
| 25 |
/*! |
| 26 |
* \ingroup wpspatype |
| 27 |
*/ |
| 28 |
typedef gconstpointer WpSpaIdValue; |
| 29 |
struct spa_type_info; |
| 30 |
|
| 31 |
/* WpSpaType */ |
| 32 |
|
| 33 |
/*! |
| 34 |
* \brief The WpSpaType GType |
| 35 |
* \ingroup wpspatype |
| 36 |
*/ |
| 37 |
#define WP_TYPE_SPA_TYPE (wp_spa_type_get_type ()) |
| 38 |
WP_API |
| 39 |
GType wp_spa_type_get_type (void); |
| 40 |
|
| 41 |
/*! |
| 42 |
* \brief Type id representing an invalid SPA type |
| 43 |
* \ingroup wpspatype |
| 44 |
*/ |
| 45 |
#define WP_SPA_TYPE_INVALID 0xffffffff |
| 46 |
|
| 47 |
WP_API |
| 48 |
WpSpaType wp_spa_type_from_name (const gchar *name); |
| 49 |
|
| 50 |
WP_API |
| 51 |
WpSpaType wp_spa_type_parent (WpSpaType type); |
| 52 |
|
| 53 |
WP_API |
| 54 |
const gchar * wp_spa_type_name (WpSpaType type); |
| 55 |
|
| 56 |
WP_API |
| 57 |
gboolean wp_spa_type_is_fundamental (WpSpaType type); |
| 58 |
|
| 59 |
WP_API |
| 60 |
gboolean wp_spa_type_is_id (WpSpaType type); |
| 61 |
|
| 62 |
WP_API |
| 63 |
gboolean wp_spa_type_is_object (WpSpaType type); |
| 64 |
|
| 65 |
WP_API |
| 66 |
WpSpaIdTable wp_spa_type_get_object_id_values_table (WpSpaType type); |
| 67 |
|
| 68 |
WP_API |
| 69 |
WpSpaIdTable wp_spa_type_get_values_table (WpSpaType type); |
| 70 |
|
| 71 |
/*! |
| 72 |
* \brief The WpSpaIdTable GType |
| 73 |
* \ingroup wpspatype |
| 74 |
*/ |
| 75 |
#define WP_TYPE_SPA_ID_TABLE (wp_spa_id_table_get_type ()) |
| 76 |
WP_API |
| 77 |
GType wp_spa_id_table_get_type (void); |
| 78 |
|
| 79 |
WP_API |
| 80 |
WpSpaIdTable wp_spa_id_table_from_name (const gchar *name); |
| 81 |
|
| 82 |
WP_API |
| 83 |
WpIterator * wp_spa_id_table_new_iterator (WpSpaIdTable table); |
| 84 |
|
| 85 |
WP_API |
| 86 |
WpSpaIdValue wp_spa_id_table_find_value (WpSpaIdTable table, guint value); |
| 87 |
|
| 88 |
WP_API |
| 89 |
WpSpaIdValue wp_spa_id_table_find_value_from_name (WpSpaIdTable table, |
| 90 |
const gchar * name); |
| 91 |
|
| 92 |
WP_API |
| 93 |
WpSpaIdValue wp_spa_id_table_find_value_from_short_name (WpSpaIdTable table, |
| 94 |
const gchar * short_name); |
| 95 |
|
| 96 |
/*! |
| 97 |
* \brief The WpSpaIdValue GType |
| 98 |
* \ingroup wpspatype |
| 99 |
*/ |
| 100 |
#define WP_TYPE_SPA_ID_VALUE (wp_spa_id_value_get_type ()) |
| 101 |
WP_API |
| 102 |
GType wp_spa_id_value_get_type (void); |
| 103 |
|
| 104 |
WP_API |
| 105 |
WpSpaIdValue wp_spa_id_value_from_name (const gchar * name); |
| 106 |
|
| 107 |
WP_API |
| 108 |
WpSpaIdValue wp_spa_id_value_from_short_name (const gchar * table_name, |
| 109 |
const gchar * short_name); |
| 110 |
|
| 111 |
WP_API |
| 112 |
WpSpaIdValue wp_spa_id_value_from_number (const gchar * table_name, guint id); |
| 113 |
|
| 114 |
WP_API |
| 115 |
guint wp_spa_id_value_number (WpSpaIdValue id); |
| 116 |
|
| 117 |
WP_API |
| 118 |
const gchar * wp_spa_id_value_name (WpSpaIdValue id); |
| 119 |
|
| 120 |
WP_API |
| 121 |
const gchar * wp_spa_id_value_short_name (WpSpaIdValue id); |
| 122 |
|
| 123 |
WP_API |
| 124 |
WpSpaType wp_spa_id_value_get_value_type (WpSpaIdValue id, WpSpaIdTable *table); |
| 125 |
|
| 126 |
WP_API |
| 127 |
WpSpaType wp_spa_id_value_array_get_item_type (WpSpaIdValue id, |
| 128 |
WpSpaIdTable *table); |
| 129 |
|
| 130 |
|
| 131 |
/* Dynamic type registration */ |
| 132 |
|
| 133 |
WP_API |
| 134 |
void wp_spa_dynamic_type_init (void); |
| 135 |
|
| 136 |
WP_API |
| 137 |
void wp_spa_dynamic_type_deinit (void); |
| 138 |
|
| 139 |
WP_API |
| 140 |
WpSpaType wp_spa_dynamic_type_register (const gchar *name, WpSpaType parent, |
| 141 |
const struct spa_type_info * values); |
| 142 |
|
| 143 |
WP_API |
| 144 |
WpSpaIdTable wp_spa_dynamic_id_table_register (const gchar *name, |
| 145 |
const struct spa_type_info * values); |
| 146 |
|
| 147 |
G_END_DECLS |
| 148 |
|
| 149 |
#endif |