• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Pipewireパッケージ(ちょっと変更)


Commit MetaInfo

Revision0da572474fb1541bb1b880aa7a6f1b5fea8312e9 (tree)
Zeit2023-09-07 22:54:28
AutorWim Taymans <wtaymans@redh...>
CommiterWim Taymans

Log Message

modules: forward tag param

Ändern Zusammenfassung

Diff

--- a/src/modules/module-filter-chain.c
+++ b/src/modules/module-filter-chain.c
@@ -20,6 +20,7 @@
2020 #include <spa/utils/json.h>
2121 #include <spa/support/cpu.h>
2222 #include <spa/param/latency-utils.h>
23+#include <spa/param/tag-utils.h>
2324 #include <spa/pod/dynamic.h>
2425 #include <spa/debug/types.h>
2526
@@ -1109,7 +1110,7 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param
11091110 struct spa_pod_builder b;
11101111 const struct spa_pod *params[1];
11111112
1112- if (spa_latency_parse(param, &latency) < 0)
1113+ if (param == NULL || spa_latency_parse(param, &latency) < 0)
11131114 return;
11141115
11151116 spa_pod_builder_init(&b, buffer, sizeof(buffer));
@@ -1121,6 +1122,21 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param
11211122 pw_stream_update_params(impl->playback, params, 1);
11221123 }
11231124
1125+static void param_tag_changed(struct impl *impl, const struct spa_pod *param)
1126+{
1127+ struct spa_tag_info tag;
1128+ const struct spa_pod *params[1] = { param };
1129+ void *state = NULL;
1130+
1131+ if (param == 0 || spa_tag_parse(param, &tag, &state) < 0)
1132+ return;
1133+
1134+ if (tag.direction == SPA_DIRECTION_INPUT)
1135+ pw_stream_update_params(impl->capture, params, 1);
1136+ else
1137+ pw_stream_update_params(impl->playback, params, 1);
1138+}
1139+
11241140 static void state_changed(void *data, enum pw_stream_state old,
11251141 enum pw_stream_state state, const char *error)
11261142 {
@@ -1208,6 +1224,9 @@ static void param_changed(void *data, uint32_t id, const struct spa_pod *param)
12081224 case SPA_PARAM_Latency:
12091225 param_latency_changed(impl, param);
12101226 break;
1227+ case SPA_PARAM_Tag:
1228+ param_tag_changed(impl, param);
1229+ break;
12111230 }
12121231 return;
12131232
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -171,13 +171,11 @@ struct impl {
171171 struct pw_stream *capture;
172172 struct spa_hook capture_listener;
173173 struct spa_audio_info_raw capture_info;
174- struct spa_latency_info capture_latency;
175174
176175 struct pw_properties *playback_props;
177176 struct pw_stream *playback;
178177 struct spa_hook playback_listener;
179178 struct spa_audio_info_raw playback_info;
180- struct spa_latency_info playback_latency;
181179
182180 unsigned int do_disconnect:1;
183181 unsigned int recalc_delay:1;
@@ -317,18 +315,16 @@ static void playback_process(void *d)
317315 }
318316
319317 static void param_latency_changed(struct impl *impl, const struct spa_pod *param,
320- struct spa_latency_info *info, struct pw_stream *other)
318+ struct pw_stream *other)
321319 {
322320 struct spa_latency_info latency;
323321 uint8_t buffer[1024];
324322 struct spa_pod_builder b;
325323 const struct spa_pod *params[1];
326324
327- if (spa_latency_parse(param, &latency) < 0)
325+ if (param == NULL || spa_latency_parse(param, &latency) < 0)
328326 return;
329327
330- *info = latency;
331-
332328 spa_pod_builder_init(&b, buffer, sizeof(buffer));
333329 params[0] = spa_latency_build(&b, SPA_PARAM_Latency, &latency);
334330 pw_stream_update_params(other, params, 1);
@@ -336,6 +332,15 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param
336332 impl->recalc_delay = true;
337333 }
338334
335+static void param_tag_changed(struct impl *impl, const struct spa_pod *param,
336+ struct pw_stream *other)
337+{
338+ const struct spa_pod *params[1] = { param };
339+ if (param == NULL)
340+ return;
341+ pw_stream_update_params(other, params, 1);
342+}
343+
339344 static void recalculate_buffer(struct impl *impl)
340345 {
341346 if (impl->target_delay > 0.0f) {
@@ -414,7 +419,10 @@ static void capture_param_changed(void *data, uint32_t id, const struct spa_pod
414419 break;
415420 }
416421 case SPA_PARAM_Latency:
417- param_latency_changed(impl, param, &impl->capture_latency, impl->playback);
422+ param_latency_changed(impl, param, impl->playback);
423+ break;
424+ case SPA_PARAM_Tag:
425+ param_tag_changed(impl, param, impl->playback);
418426 break;
419427 }
420428 }
@@ -453,7 +461,10 @@ static void playback_param_changed(void *data, uint32_t id, const struct spa_pod
453461
454462 switch (id) {
455463 case SPA_PARAM_Latency:
456- param_latency_changed(impl, param, &impl->playback_latency, impl->capture);
464+ param_latency_changed(impl, param, impl->capture);
465+ break;
466+ case SPA_PARAM_Tag:
467+ param_tag_changed(impl, param, impl->capture);
457468 break;
458469 }
459470 }