mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pulse-server: place stream media.* keys as Tag
This commit is contained in:
parent
b3f8df6dfc
commit
6d0613bc9a
3 changed files with 41 additions and 1 deletions
|
|
@ -1820,6 +1820,8 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
|
||||||
PW_STREAM_FLAG_MAP_BUFFERS,
|
PW_STREAM_FLAG_MAP_BUFFERS,
|
||||||
params, n_params);
|
params, n_params);
|
||||||
|
|
||||||
|
stream_update_tag_param(stream);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_errno:
|
error_errno:
|
||||||
|
|
@ -3215,7 +3217,8 @@ static int do_update_proplist(struct client *client, uint32_t command, uint32_t
|
||||||
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
|
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
pw_stream_update_properties(stream->stream, &props->dict);
|
if (pw_stream_update_properties(stream->stream, &props->dict) > 0)
|
||||||
|
stream_update_tag_param(stream);
|
||||||
} else {
|
} else {
|
||||||
if (pw_properties_update(client->props, &props->dict) > 0) {
|
if (pw_properties_update(client->props, &props->dict) > 0) {
|
||||||
client_update_quirks(client);
|
client_update_quirks(client);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/utils/ringbuffer.h>
|
#include <spa/utils/ringbuffer.h>
|
||||||
|
#include <spa/pod/dynamic.h>
|
||||||
|
#include <spa/param/tag-utils.h>
|
||||||
|
|
||||||
#include <pipewire/log.h>
|
#include <pipewire/log.h>
|
||||||
#include <pipewire/loop.h>
|
#include <pipewire/loop.h>
|
||||||
#include <pipewire/map.h>
|
#include <pipewire/map.h>
|
||||||
|
|
@ -412,3 +415,36 @@ int stream_send_moved(struct stream *stream, uint32_t peer_index, const char *pe
|
||||||
}
|
}
|
||||||
return client_queue_message(client, reply);
|
return client_queue_message(client, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int stream_update_tag_param(struct stream *stream)
|
||||||
|
{
|
||||||
|
struct spa_pod_dynamic_builder b;
|
||||||
|
const struct pw_properties *props = pw_stream_get_properties(stream->stream);
|
||||||
|
const struct spa_pod *param[1];
|
||||||
|
struct spa_dict_item items[64];
|
||||||
|
uint32_t i, n_items = 0;
|
||||||
|
uint8_t buffer[4096];
|
||||||
|
|
||||||
|
if (props == NULL)
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
spa_pod_dynamic_builder_init(&b, buffer, sizeof(buffer), 4096);
|
||||||
|
|
||||||
|
for (i = 0; i < props->dict.n_items; i++) {
|
||||||
|
if (n_items < SPA_N_ELEMENTS(items) &&
|
||||||
|
spa_strstartswith(props->dict.items[i].key, "media."))
|
||||||
|
items[n_items++] = props->dict.items[i];
|
||||||
|
}
|
||||||
|
if (n_items > 0) {
|
||||||
|
struct spa_pod_frame f;
|
||||||
|
spa_tag_build_start(&b.b, &f, SPA_PARAM_Tag, SPA_DIRECTION_OUTPUT);
|
||||||
|
spa_tag_build_add_dict(&b.b, &SPA_DICT_INIT(items, n_items));
|
||||||
|
param[0] = spa_tag_build_end(&b.b, &f);
|
||||||
|
} else {
|
||||||
|
param[0] = NULL;
|
||||||
|
}
|
||||||
|
if (param[0] != NULL)
|
||||||
|
pw_stream_update_params(stream->stream, param, 1);
|
||||||
|
spa_pod_dynamic_builder_clean(&b);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,5 +116,6 @@ int stream_send_started(struct stream *stream);
|
||||||
int stream_send_request(struct stream *stream);
|
int stream_send_request(struct stream *stream);
|
||||||
int stream_update_minreq(struct stream *stream, uint32_t minreq);
|
int stream_update_minreq(struct stream *stream, uint32_t minreq);
|
||||||
int stream_send_moved(struct stream *stream, uint32_t peer_index, const char *peer_name);
|
int stream_send_moved(struct stream *stream, uint32_t peer_index, const char *peer_name);
|
||||||
|
int stream_update_tag_param(struct stream *stream);
|
||||||
|
|
||||||
#endif /* PULSER_SERVER_STREAM_H */
|
#endif /* PULSER_SERVER_STREAM_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue