mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-19 08:57:14 -05:00
export-sink: update port params
This commit is contained in:
parent
b238c8c2f6
commit
7281a2b2cf
1 changed files with 42 additions and 30 deletions
|
|
@ -85,7 +85,9 @@ struct data {
|
||||||
struct spa_video_info_raw format;
|
struct spa_video_info_raw format;
|
||||||
int32_t stride;
|
int32_t stride;
|
||||||
|
|
||||||
struct spa_param *params[2];
|
struct spa_port_info info;
|
||||||
|
struct spa_param_info params[5];
|
||||||
|
|
||||||
struct spa_region region;
|
struct spa_region region;
|
||||||
|
|
||||||
struct spa_buffer *buffers[MAX_BUFFERS];
|
struct spa_buffer *buffers[MAX_BUFFERS];
|
||||||
|
|
@ -137,25 +139,14 @@ static int impl_add_listener(struct spa_node *node,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||||
struct spa_port_info info;
|
|
||||||
struct spa_param_info params[5];
|
|
||||||
struct spa_hook_list save;
|
struct spa_hook_list save;
|
||||||
|
|
||||||
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
|
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
|
||||||
|
|
||||||
info = SPA_PORT_INFO_INIT();
|
d->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||||
info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||||
info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
spa_node_emit_port_info(&d->hooks, SPA_DIRECTION_INPUT, 0, &d->info);
|
||||||
info.change_mask = SPA_PORT_CHANGE_MASK_PARAMS;
|
d->info.change_mask = 0;
|
||||||
params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
|
||||||
params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
|
||||||
params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
|
||||||
params[3] = SPA_PARAM_INFO(SPA_PARAM_Buffers, SPA_PARAM_INFO_READ);
|
|
||||||
params[4] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
|
|
||||||
info.params = params;
|
|
||||||
info.n_params = 5;
|
|
||||||
|
|
||||||
spa_node_emit_port_info(&d->hooks, SPA_DIRECTION_INPUT, 0, &info);
|
|
||||||
|
|
||||||
spa_hook_list_join(&d->hooks, &save);
|
spa_hook_list_join(&d->hooks, &save);
|
||||||
|
|
||||||
|
|
@ -304,9 +295,12 @@ static int port_set_format(struct spa_node *node,
|
||||||
Uint32 sdl_format;
|
Uint32 sdl_format;
|
||||||
void *dest;
|
void *dest;
|
||||||
|
|
||||||
if (format == NULL)
|
d->info.change_mask = SPA_PORT_CHANGE_MASK_PARAMS;
|
||||||
return 0;
|
if (format == NULL) {
|
||||||
|
SDL_DestroyTexture(d->texture);
|
||||||
|
d->params[3] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
|
||||||
|
d->params[4] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
|
||||||
|
} else {
|
||||||
spa_debug_format(0, NULL, format);
|
spa_debug_format(0, NULL, format);
|
||||||
|
|
||||||
spa_format_video_raw_parse(format, &d->format);
|
spa_format_video_raw_parse(format, &d->format);
|
||||||
|
|
@ -323,6 +317,12 @@ static int port_set_format(struct spa_node *node,
|
||||||
SDL_LockTexture(d->texture, NULL, &dest, &d->stride);
|
SDL_LockTexture(d->texture, NULL, &dest, &d->stride);
|
||||||
SDL_UnlockTexture(d->texture);
|
SDL_UnlockTexture(d->texture);
|
||||||
|
|
||||||
|
d->params[3] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READWRITE);
|
||||||
|
d->params[4] = SPA_PARAM_INFO(SPA_PARAM_Buffers, SPA_PARAM_INFO_READ);
|
||||||
|
}
|
||||||
|
spa_node_emit_port_info(&d->hooks, direction, port_id, &d->info);
|
||||||
|
d->info.change_mask = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -521,6 +521,18 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
spa_hook_list_init(&data.hooks);
|
spa_hook_list_init(&data.hooks);
|
||||||
|
|
||||||
|
data.info = SPA_PORT_INFO_INIT();
|
||||||
|
data.info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||||
|
data.info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||||
|
data.info.change_mask = SPA_PORT_CHANGE_MASK_PARAMS;
|
||||||
|
data.params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||||
|
data.params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||||
|
data.params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||||
|
data.params[3] = SPA_PARAM_INFO(SPA_PARAM_Buffers, SPA_PARAM_INFO_READ);
|
||||||
|
data.params[4] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
|
||||||
|
data.info.params = data.params;
|
||||||
|
data.info.n_params = 5;
|
||||||
|
|
||||||
reset_props(&data.props);
|
reset_props(&data.props);
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue