mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
Respect the rate from the position as the default
This commit is contained in:
parent
9b41e4dfd9
commit
c14881fbe2
3 changed files with 25 additions and 4 deletions
|
|
@ -506,6 +506,8 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
|||
switch (id) {
|
||||
case SPA_IO_Position:
|
||||
res = spa_node_set_io(this->resample, id, data, size);
|
||||
res = spa_node_set_io(this->fmt[0], id, data, size);
|
||||
res = spa_node_set_io(this->fmt[1], id, data, size);
|
||||
break;
|
||||
default:
|
||||
res = -ENOENT;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ struct impl {
|
|||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
|
||||
struct spa_io_position *io_position;
|
||||
|
||||
uint64_t info_all;
|
||||
struct spa_node_info info;
|
||||
struct props props;
|
||||
|
|
@ -214,7 +216,20 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
|||
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
struct impl *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size);
|
||||
|
||||
switch (id) {
|
||||
case SPA_IO_Position:
|
||||
this->io_position = data;
|
||||
break;
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
|
|
@ -387,9 +402,11 @@ static int port_enum_formats(void *object,
|
|||
info.info.raw.channels, info.info.raw.position);
|
||||
}
|
||||
} else {
|
||||
uint32_t rate = this->io_position ?
|
||||
this->io_position->clock.rate.denom : DEFAULT_RATE;
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_FORMAT_AUDIO_rate, SPA_POD_CHOICE_RANGE_Int(
|
||||
DEFAULT_RATE, 1, INT32_MAX),
|
||||
rate, 1, INT32_MAX),
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(
|
||||
DEFAULT_CHANNELS, 1, INT32_MAX),
|
||||
0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue