mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-15 08:56:38 -05:00
small cleanups
Remove the temp storage for formats and props now that we get a builder from the host to write into.
This commit is contained in:
parent
f3bca48398
commit
4d890a2d98
9 changed files with 7 additions and 48 deletions
|
|
@ -240,16 +240,6 @@ impl_node_port_get_info(struct spa_node *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int port_enum_formats(struct spa_node *node,
|
|
||||||
enum spa_direction direction, uint32_t port_id,
|
|
||||||
uint32_t *index,
|
|
||||||
const struct spa_pod_object *filter,
|
|
||||||
struct spa_pod_builder *builder)
|
|
||||||
{
|
|
||||||
struct state *this = SPA_CONTAINER_OF(node, struct state, node);
|
|
||||||
return spa_alsa_enum_format(this, index, filter, builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int port_get_format(struct spa_node *node,
|
static int port_get_format(struct spa_node *node,
|
||||||
enum spa_direction direction, uint32_t port_id,
|
enum spa_direction direction, uint32_t port_id,
|
||||||
uint32_t *index,
|
uint32_t *index,
|
||||||
|
|
@ -262,7 +252,7 @@ static int port_get_format(struct spa_node *node,
|
||||||
if (!this->have_format)
|
if (!this->have_format)
|
||||||
return SPA_RESULT_NO_FORMAT;
|
return SPA_RESULT_NO_FORMAT;
|
||||||
|
|
||||||
if(*index > 0)
|
if (*index > 0)
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
|
|
||||||
spa_pod_builder_object(builder,
|
spa_pod_builder_object(builder,
|
||||||
|
|
@ -297,7 +287,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
||||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||||
|
|
||||||
if (id == t->param.idEnumFormat) {
|
if (id == t->param.idEnumFormat) {
|
||||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
return spa_alsa_enum_format(this, index, filter, builder);
|
||||||
}
|
}
|
||||||
else if (id == t->param.idFormat) {
|
else if (id == t->param.idFormat) {
|
||||||
return port_get_format(node, direction, port_id, index, filter, builder);
|
return port_get_format(node, direction, port_id, index, filter, builder);
|
||||||
|
|
|
||||||
|
|
@ -254,17 +254,6 @@ static void recycle_buffer(struct state *this, uint32_t buffer_id)
|
||||||
spa_list_append(&this->free, &b->link);
|
spa_list_append(&this->free, &b->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int port_enum_formats(struct spa_node *node,
|
|
||||||
enum spa_direction direction,
|
|
||||||
uint32_t port_id,
|
|
||||||
uint32_t *index,
|
|
||||||
const struct spa_pod_object *filter,
|
|
||||||
struct spa_pod_builder *builder)
|
|
||||||
{
|
|
||||||
struct state *this = SPA_CONTAINER_OF(node, struct state, node);
|
|
||||||
return spa_alsa_enum_format(this, index, filter, builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int port_get_format(struct spa_node *node,
|
static int port_get_format(struct spa_node *node,
|
||||||
enum spa_direction direction, uint32_t port_id,
|
enum spa_direction direction, uint32_t port_id,
|
||||||
uint32_t *index,
|
uint32_t *index,
|
||||||
|
|
@ -311,12 +300,15 @@ impl_node_port_enum_params(struct spa_node *node,
|
||||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||||
|
|
||||||
if (id == t->param.idEnumFormat) {
|
if (id == t->param.idEnumFormat) {
|
||||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
return spa_alsa_enum_format(this, index, filter, builder);
|
||||||
}
|
}
|
||||||
else if (id == t->param.idFormat) {
|
else if (id == t->param.idFormat) {
|
||||||
return port_get_format(node, direction, port_id, index, filter, builder);
|
return port_get_format(node, direction, port_id, index, filter, builder);
|
||||||
}
|
}
|
||||||
else if (id == t->param.idBuffers) {
|
else if (id == t->param.idBuffers) {
|
||||||
|
if (*index > 0)
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
|
||||||
spa_pod_builder_object(builder,
|
spa_pod_builder_object(builder,
|
||||||
id, t->param_alloc_buffers.Buffers,
|
id, t->param_alloc_buffers.Buffers,
|
||||||
":", t->param_alloc_buffers.size, "i", this->props.min_latency * this->frame_size,
|
":", t->param_alloc_buffers.size, "i", this->props.min_latency * this->frame_size,
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,6 @@ struct state {
|
||||||
|
|
||||||
bool have_format;
|
bool have_format;
|
||||||
struct spa_audio_info current_format;
|
struct spa_audio_info current_format;
|
||||||
uint8_t format_buffer[1024];
|
|
||||||
|
|
||||||
snd_pcm_uframes_t buffer_frames;
|
snd_pcm_uframes_t buffer_frames;
|
||||||
snd_pcm_uframes_t period_frames;
|
snd_pcm_uframes_t period_frames;
|
||||||
|
|
@ -142,8 +141,6 @@ struct state {
|
||||||
size_t frame_size;
|
size_t frame_size;
|
||||||
|
|
||||||
struct spa_port_info info;
|
struct spa_port_info info;
|
||||||
uint32_t params[3];
|
|
||||||
uint8_t params_buffer[1024];
|
|
||||||
struct spa_port_io *io;
|
struct spa_port_io *io;
|
||||||
|
|
||||||
struct buffer buffers[MAX_BUFFERS];
|
struct buffer buffers[MAX_BUFFERS];
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ struct impl {
|
||||||
struct port in_ports[MAX_PORTS];
|
struct port in_ports[MAX_PORTS];
|
||||||
struct port out_ports[1];
|
struct port out_ports[1];
|
||||||
|
|
||||||
uint8_t format_buffer[4096];
|
|
||||||
bool have_format;
|
bool have_format;
|
||||||
int n_formats;
|
int n_formats;
|
||||||
struct spa_audio_info format;
|
struct spa_audio_info format;
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,6 @@ struct impl {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
struct spa_loop *data_loop;
|
struct spa_loop *data_loop;
|
||||||
|
|
||||||
uint8_t props_buffer[512];
|
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
|
@ -137,7 +136,6 @@ struct impl {
|
||||||
|
|
||||||
bool have_format;
|
bool have_format;
|
||||||
struct spa_audio_info current_format;
|
struct spa_audio_info current_format;
|
||||||
uint8_t format_buffer[1024];
|
|
||||||
size_t bpf;
|
size_t bpf;
|
||||||
render_func_t render_func;
|
render_func_t render_func;
|
||||||
double accumulator;
|
double accumulator;
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ struct port {
|
||||||
|
|
||||||
bool have_format;
|
bool have_format;
|
||||||
struct spa_video_info current_format;
|
struct spa_video_info current_format;
|
||||||
uint8_t format_buffer[1024];
|
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
bool opened;
|
bool opened;
|
||||||
|
|
@ -154,7 +153,6 @@ struct impl {
|
||||||
|
|
||||||
uint32_t seq;
|
uint32_t seq;
|
||||||
|
|
||||||
uint8_t props_buffer[512];
|
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
|
@ -455,16 +453,6 @@ static int impl_node_port_get_info(struct spa_node *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int port_enum_formats(struct spa_node *node,
|
|
||||||
enum spa_direction direction, uint32_t port_id,
|
|
||||||
uint32_t *index,
|
|
||||||
const struct spa_pod_object *filter,
|
|
||||||
struct spa_pod_builder *builder)
|
|
||||||
{
|
|
||||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
|
||||||
return spa_v4l2_enum_format(this, index, filter, builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int port_get_format(struct spa_node *node,
|
static int port_get_format(struct spa_node *node,
|
||||||
enum spa_direction direction, uint32_t port_id,
|
enum spa_direction direction, uint32_t port_id,
|
||||||
uint32_t *index,
|
uint32_t *index,
|
||||||
|
|
@ -547,7 +535,7 @@ static int impl_node_port_enum_params(struct spa_node *node,
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
else if (id == t->param.idEnumFormat) {
|
else if (id == t->param.idEnumFormat) {
|
||||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
return spa_v4l2_enum_format(this, index, filter, builder);
|
||||||
}
|
}
|
||||||
else if (id == t->param.idFormat) {
|
else if (id == t->param.idFormat) {
|
||||||
return port_get_format(node, direction, port_id, index, filter, builder);
|
return port_get_format(node, direction, port_id, index, filter, builder);
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,6 @@ spa_v4l2_enum_format(struct impl *this,
|
||||||
media_subtype = *SPA_MEMBER(&this->type, info->media_subtype_offset, uint32_t);
|
media_subtype = *SPA_MEMBER(&this->type, info->media_subtype_offset, uint32_t);
|
||||||
video_format = *SPA_MEMBER(&this->type, info->format_offset, uint32_t);
|
video_format = *SPA_MEMBER(&this->type, info->format_offset, uint32_t);
|
||||||
|
|
||||||
spa_pod_builder_init(builder, port->format_buffer, sizeof(port->format_buffer));
|
|
||||||
spa_pod_builder_push_object(builder, &f[0],
|
spa_pod_builder_push_object(builder, &f[0],
|
||||||
this->type.param.idEnumFormat, this->type.format);
|
this->type.param.idEnumFormat, this->type.format);
|
||||||
spa_pod_builder_add(builder,
|
spa_pod_builder_add(builder,
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,6 @@ struct impl {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
struct spa_loop *data_loop;
|
struct spa_loop *data_loop;
|
||||||
|
|
||||||
uint8_t props_buffer[512];
|
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
|
@ -126,7 +125,6 @@ struct impl {
|
||||||
|
|
||||||
bool have_format;
|
bool have_format;
|
||||||
struct spa_video_info current_format;
|
struct spa_video_info current_format;
|
||||||
uint8_t format_buffer[1024];
|
|
||||||
size_t bpp;
|
size_t bpp;
|
||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ struct port {
|
||||||
bool have_format;
|
bool have_format;
|
||||||
|
|
||||||
struct spa_port_info info;
|
struct spa_port_info info;
|
||||||
uint8_t params_buffer[1024];
|
|
||||||
|
|
||||||
struct buffer buffers[MAX_BUFFERS];
|
struct buffer buffers[MAX_BUFFERS];
|
||||||
uint32_t n_buffers;
|
uint32_t n_buffers;
|
||||||
|
|
@ -112,7 +111,6 @@ struct impl {
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
void *callbacks_data;
|
void *callbacks_data;
|
||||||
|
|
||||||
uint8_t format_buffer[1024];
|
|
||||||
struct spa_audio_info current_format;
|
struct spa_audio_info current_format;
|
||||||
int bpf;
|
int bpf;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue