mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
tagstruct: Allow NULL proplist with pa_tagstruct_get_proplist().
module-tunnel doesn't care about the proplist contents, so pa_tagstruct_get_proplist() is only used for removing the data from the tagstruct buffer. In that case it's more convenient to just pass NULL as the proplist argument.
This commit is contained in:
parent
e17f18d89a
commit
1edb4a470b
2 changed files with 8 additions and 24 deletions
|
|
@ -1065,13 +1065,10 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
|
|||
pa_cvolume volume;
|
||||
pa_bool_t mute;
|
||||
pa_usec_t latency;
|
||||
pa_proplist *pl;
|
||||
|
||||
pa_assert(pd);
|
||||
pa_assert(u);
|
||||
|
||||
pl = pa_proplist_new();
|
||||
|
||||
if (command != PA_COMMAND_REPLY) {
|
||||
if (command == PA_COMMAND_ERROR)
|
||||
pa_log("Failed to get info.");
|
||||
|
|
@ -1101,7 +1098,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
|
|||
if (u->version >= 13) {
|
||||
pa_usec_t configured_latency;
|
||||
|
||||
if (pa_tagstruct_get_proplist(t, pl) < 0 ||
|
||||
if (pa_tagstruct_get_proplist(t, NULL) < 0 ||
|
||||
pa_tagstruct_get_usec(t, &configured_latency) < 0) {
|
||||
|
||||
pa_log("Parse failure");
|
||||
|
|
@ -1134,8 +1131,6 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
|
|||
goto fail;
|
||||
}
|
||||
|
||||
pa_proplist_free(pl);
|
||||
|
||||
if (!u->sink_name || !pa_streq(name, u->sink_name))
|
||||
return;
|
||||
|
||||
|
|
@ -1148,7 +1143,6 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
|
|||
|
||||
fail:
|
||||
pa_module_unload_request(u->module, TRUE);
|
||||
pa_proplist_free(pl);
|
||||
}
|
||||
|
||||
/* Called from main context */
|
||||
|
|
@ -1161,14 +1155,11 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag
|
|||
pa_sample_spec sample_spec;
|
||||
pa_channel_map channel_map;
|
||||
pa_cvolume volume;
|
||||
pa_proplist *pl;
|
||||
pa_bool_t b;
|
||||
|
||||
pa_assert(pd);
|
||||
pa_assert(u);
|
||||
|
||||
pl = pa_proplist_new();
|
||||
|
||||
if (command != PA_COMMAND_REPLY) {
|
||||
if (command == PA_COMMAND_ERROR)
|
||||
pa_log("Failed to get info.");
|
||||
|
|
@ -1203,7 +1194,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag
|
|||
}
|
||||
|
||||
if (u->version >= 13) {
|
||||
if (pa_tagstruct_get_proplist(t, pl) < 0) {
|
||||
if (pa_tagstruct_get_proplist(t, NULL) < 0) {
|
||||
|
||||
pa_log("Parse failure");
|
||||
goto fail;
|
||||
|
|
@ -1243,8 +1234,6 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag
|
|||
goto fail;
|
||||
}
|
||||
|
||||
pa_proplist_free(pl);
|
||||
|
||||
if (idx != u->device_index)
|
||||
return;
|
||||
|
||||
|
|
@ -1263,7 +1252,6 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag
|
|||
|
||||
fail:
|
||||
pa_module_unload_request(u->module, TRUE);
|
||||
pa_proplist_free(pl);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -1278,13 +1266,10 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
|
|||
pa_cvolume volume;
|
||||
pa_bool_t mute;
|
||||
pa_usec_t latency, configured_latency;
|
||||
pa_proplist *pl;
|
||||
|
||||
pa_assert(pd);
|
||||
pa_assert(u);
|
||||
|
||||
pl = pa_proplist_new();
|
||||
|
||||
if (command != PA_COMMAND_REPLY) {
|
||||
if (command == PA_COMMAND_ERROR)
|
||||
pa_log("Failed to get info.");
|
||||
|
|
@ -1312,7 +1297,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
|
|||
}
|
||||
|
||||
if (u->version >= 13) {
|
||||
if (pa_tagstruct_get_proplist(t, pl) < 0 ||
|
||||
if (pa_tagstruct_get_proplist(t, NULL) < 0 ||
|
||||
pa_tagstruct_get_usec(t, &configured_latency) < 0) {
|
||||
|
||||
pa_log("Parse failure");
|
||||
|
|
@ -1345,8 +1330,6 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
|
|||
goto fail;
|
||||
}
|
||||
|
||||
pa_proplist_free(pl);
|
||||
|
||||
if (!u->source_name || !pa_streq(name, u->source_name))
|
||||
return;
|
||||
|
||||
|
|
@ -1359,7 +1342,6 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
|
|||
|
||||
fail:
|
||||
pa_module_unload_request(u->module, TRUE);
|
||||
pa_proplist_free(pl);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -602,7 +602,6 @@ int pa_tagstruct_get_proplist(pa_tagstruct *t, pa_proplist *p) {
|
|||
size_t saved_rindex;
|
||||
|
||||
pa_assert(t);
|
||||
pa_assert(p);
|
||||
|
||||
if (t->rindex+1 > t->length)
|
||||
return -1;
|
||||
|
|
@ -624,6 +623,9 @@ int pa_tagstruct_get_proplist(pa_tagstruct *t, pa_proplist *p) {
|
|||
if (!k)
|
||||
break;
|
||||
|
||||
if (!pa_proplist_key_valid(k))
|
||||
goto fail;
|
||||
|
||||
if (pa_tagstruct_getu32(t, &length) < 0)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -633,8 +635,8 @@ int pa_tagstruct_get_proplist(pa_tagstruct *t, pa_proplist *p) {
|
|||
if (pa_tagstruct_get_arbitrary(t, &d, length) < 0)
|
||||
goto fail;
|
||||
|
||||
if (pa_proplist_set(p, k, d, length) < 0)
|
||||
goto fail;
|
||||
if (p)
|
||||
pa_assert_se(pa_proplist_set(p, k, d, length) >= 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue