Files
wireplumber/lib/wp/json-utils.h
George Kiagiadakis 89ac416e99 lib: add new json-utils set of functions
The purpose is to wrap some utilities that pipewire provides that use JSON.

Start by wrapping pw_conf_match_rules(), which despite its name, it has nothing
to do with the configuration object. It operates directly on JSON and can be
useful to work with match rules outside the context of configuration files.
2023-11-07 16:36:49 +02:00

39 lines
1.1 KiB
C

/* WirePlumber
*
* Copyright © 2023 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_JSON_UTILS_H__
#define __WIREPLUMBER_JSON_UTILS_H__
#include "spa-json.h"
#include "properties.h"
G_BEGIN_DECLS
/*!
* \brief A function to be called by wp_json_utils_match_rules() when a match is found.
* \param data (closure): the user data passed to wp_json_utils_match_rules()
* \param action the rule's action string
* \param value the value associated with this action
* \param error (out): return location for a GError
* \returns FALSE if an error occurred and the match process should stop, TRUE otherwise
* \ingroup wpjsonutils
*/
typedef gboolean (*WpRuleMatchCallback) (gpointer data, const gchar * action,
WpSpaJson * value, GError ** error);
WP_API
gboolean wp_json_utils_match_rules (WpSpaJson * json, WpProperties * match_props,
WpRuleMatchCallback callback, gpointer data, GError ** error);
WP_API
gint wp_json_utils_match_rules_update_properties (WpSpaJson *json, WpProperties *props);
G_END_DECLS
#endif