| 1 |
/* WirePlumber |
| 2 |
* |
| 3 |
* Copyright © 2020 Collabora Ltd. |
| 4 |
* @author George Kiagiadakis <[email protected]> |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: MIT |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "wp.h" |
| 10 |
#include <pipewire/pipewire.h> |
| 11 |
#include <libintl.h> |
| 12 |
#include "wpbuildbasedirs.h" |
| 13 |
|
| 14 |
WP_DEFINE_LOCAL_LOG_TOPIC ("wp") |
| 15 |
|
| 16 |
/*! |
| 17 |
* \defgroup wp Library Initialization |
| 18 |
* \{ |
| 19 |
*/ |
| 20 |
|
| 21 |
/*! |
| 22 |
* \brief Initializes WirePlumber and PipeWire underneath. |
| 23 |
* |
| 24 |
* \em flags can modify which parts are initialized, in cases where you want |
| 25 |
* to handle part of this initialization externally. |
| 26 |
* |
| 27 |
* \param flags initialization flags |
| 28 |
*/ |
| 29 |
void |
| 30 |
wp_init (WpInitFlags flags) |
| 31 |
{ |
| 32 |
/* Initialize the logging system */ |
| 33 |
wp_log_init (flags); |
| 34 |
|
| 35 |
wp_info ("WirePlumber " WIREPLUMBER_VERSION " initializing"); |
| 36 |
|
| 37 |
if (flags & WP_INIT_PIPEWIRE) |
| 38 |
pw_init (NULL, NULL); |
| 39 |
|
| 40 |
if (flags & WP_INIT_SPA_TYPES) |
| 41 |
wp_spa_dynamic_type_init (); |
| 42 |
|
| 43 |
bindtextdomain (GETTEXT_PACKAGE, BUILD_LOCALEDIR); |
| 44 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 45 |
|
| 46 |
/* ensure WpProxy subclasses are loaded, which is needed to be able |
| 47 |
to autodetect the GType of proxies created through wp_proxy_new_global() */ |
| 48 |
g_type_ensure (WP_TYPE_CLIENT); |
| 49 |
g_type_ensure (WP_TYPE_DEVICE); |
| 50 |
g_type_ensure (WP_TYPE_LINK); |
| 51 |
g_type_ensure (WP_TYPE_METADATA); |
| 52 |
g_type_ensure (WP_TYPE_NODE); |
| 53 |
g_type_ensure (WP_TYPE_PORT); |
| 54 |
g_type_ensure (WP_TYPE_FACTORY); |
| 55 |
} |
| 56 |
|
| 57 |
/*! |
| 58 |
* \brief Gets the WirePlumber library version |
| 59 |
* \returns WirePlumber library version |
| 60 |
* |
| 61 |
* \since 0.4.12 |
| 62 |
*/ |
| 63 |
const char * |
| 64 |
wp_get_library_version (void) |
| 65 |
{ |
| 66 |
return WIREPLUMBER_VERSION; |
| 67 |
} |
| 68 |
|
| 69 |
/*! |
| 70 |
* \brief Gets the WirePlumber library API version |
| 71 |
* \returns WirePlumber library API version |
| 72 |
* |
| 73 |
* \since 0.4.12 |
| 74 |
*/ |
| 75 |
const char * |
| 76 |
wp_get_library_api_version (void) |
| 77 |
{ |
| 78 |
return WIREPLUMBER_API_VERSION; |
| 79 |
} |
| 80 |
|
| 81 |
/*! \} */ |