mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-22 08:56:59 -05:00
jack: add jack_set_sample_rate() extension
This commit is contained in:
parent
5617fa0501
commit
733cf7835e
2 changed files with 35 additions and 0 deletions
|
|
@ -23,6 +23,8 @@ typedef struct jack_image_size {
|
||||||
|
|
||||||
int jack_get_video_image_size(jack_client_t *client, jack_image_size_t *size);
|
int jack_get_video_image_size(jack_client_t *client, jack_image_size_t *size);
|
||||||
|
|
||||||
|
int jack_set_sample_rate (jack_client_t *client, jack_nframes_t nframes);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -426,6 +426,7 @@ struct client {
|
||||||
int rt_max;
|
int rt_max;
|
||||||
unsigned int fix_midi_events:1;
|
unsigned int fix_midi_events:1;
|
||||||
unsigned int global_buffer_size:1;
|
unsigned int global_buffer_size:1;
|
||||||
|
unsigned int global_sample_rate:1;
|
||||||
unsigned int passive_links:1;
|
unsigned int passive_links:1;
|
||||||
unsigned int graph_callback_pending:1;
|
unsigned int graph_callback_pending:1;
|
||||||
unsigned int pending_callbacks:1;
|
unsigned int pending_callbacks:1;
|
||||||
|
|
@ -3936,6 +3937,7 @@ jack_client_t * jack_client_open (const char *client_name,
|
||||||
client->default_as_system = pw_properties_get_bool(client->props, "jack.default-as-system", false);
|
client->default_as_system = pw_properties_get_bool(client->props, "jack.default-as-system", false);
|
||||||
client->fix_midi_events = pw_properties_get_bool(client->props, "jack.fix-midi-events", true);
|
client->fix_midi_events = pw_properties_get_bool(client->props, "jack.fix-midi-events", true);
|
||||||
client->global_buffer_size = pw_properties_get_bool(client->props, "jack.global-buffer-size", false);
|
client->global_buffer_size = pw_properties_get_bool(client->props, "jack.global-buffer-size", false);
|
||||||
|
client->global_sample_rate = pw_properties_get_bool(client->props, "jack.global-sample-rate", false);
|
||||||
client->max_ports = pw_properties_get_uint32(client->props, "jack.max-client-ports", MAX_CLIENT_PORTS);
|
client->max_ports = pw_properties_get_uint32(client->props, "jack.max-client-ports", MAX_CLIENT_PORTS);
|
||||||
client->fill_aliases = pw_properties_get_bool(client->props, "jack.fill-aliases", false);
|
client->fill_aliases = pw_properties_get_bool(client->props, "jack.fill-aliases", false);
|
||||||
client->writable_input = pw_properties_get_bool(client->props, "jack.writable-input", true);
|
client->writable_input = pw_properties_get_bool(client->props, "jack.writable-input", true);
|
||||||
|
|
@ -4723,6 +4725,37 @@ int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPA_EXPORT
|
||||||
|
int jack_set_sample_rate (jack_client_t *client, jack_nframes_t nframes)
|
||||||
|
{
|
||||||
|
struct client *c = (struct client *) client;
|
||||||
|
|
||||||
|
return_val_if_fail(c != NULL, -EINVAL);
|
||||||
|
|
||||||
|
pw_log_info("%p: sample-size %u", client, nframes);
|
||||||
|
|
||||||
|
pw_thread_loop_lock(c->context.loop);
|
||||||
|
if (c->global_sample_rate && c->settings && c->settings->proxy) {
|
||||||
|
char val[256];
|
||||||
|
snprintf(val, sizeof(val), "%u", nframes);
|
||||||
|
pw_metadata_set_property(c->settings->proxy, 0,
|
||||||
|
"clock.force-rate", "", val);
|
||||||
|
} else {
|
||||||
|
pw_properties_setf(c->props, PW_KEY_NODE_FORCE_RATE, "%u", nframes);
|
||||||
|
|
||||||
|
c->info.change_mask |= SPA_NODE_CHANGE_MASK_PROPS;
|
||||||
|
c->info.props = &c->props->dict;
|
||||||
|
|
||||||
|
pw_client_node_update(c->node,
|
||||||
|
PW_CLIENT_NODE_UPDATE_INFO,
|
||||||
|
0, NULL, &c->info);
|
||||||
|
c->info.change_mask = 0;
|
||||||
|
}
|
||||||
|
pw_thread_loop_unlock(c->context.loop);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
jack_nframes_t jack_get_sample_rate (jack_client_t *client)
|
jack_nframes_t jack_get_sample_rate (jack_client_t *client)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue