mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: libcamera: source: port_set_format(): remove goto
Remove the `done` label by moving things into the `format != nullptr` branch.
(cherry picked from commit 47ee86938b)
This commit is contained in:
parent
d76fee1353
commit
ef09f436b3
1 changed files with 16 additions and 17 deletions
|
|
@ -1812,9 +1812,6 @@ next:
|
|||
int port_set_format(struct impl *impl, struct port *port,
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct spa_video_info info;
|
||||
int res;
|
||||
|
||||
if (format == nullptr) {
|
||||
if (!port->current_format)
|
||||
return 0;
|
||||
|
|
@ -1824,9 +1821,12 @@ int port_set_format(struct impl *impl, struct port *port,
|
|||
port->current_format.reset();
|
||||
|
||||
spa_libcamera_close(impl);
|
||||
goto done;
|
||||
} else {
|
||||
spa_video_info info;
|
||||
int res;
|
||||
|
||||
spa_zero(info);
|
||||
|
||||
if ((res = spa_format_parse(format, &info.media_type, &info.media_subtype)) < 0)
|
||||
return res;
|
||||
|
||||
|
|
@ -1875,21 +1875,20 @@ int port_set_format(struct impl *impl, struct port *port,
|
|||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (port->current_format && !(flags & SPA_NODE_PARAM_FLAG_TEST_ONLY)) {
|
||||
spa_libcamera_use_buffers(impl, port, nullptr, 0);
|
||||
port->current_format.reset();
|
||||
}
|
||||
|
||||
if (spa_libcamera_set_format(impl, port, &info, flags & SPA_NODE_PARAM_FLAG_TEST_ONLY) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!(flags & SPA_NODE_PARAM_FLAG_TEST_ONLY)) {
|
||||
port->current_format = info;
|
||||
}
|
||||
}
|
||||
|
||||
if (port->current_format && !(flags & SPA_NODE_PARAM_FLAG_TEST_ONLY)) {
|
||||
spa_libcamera_use_buffers(impl, port, nullptr, 0);
|
||||
port->current_format.reset();
|
||||
}
|
||||
|
||||
if (spa_libcamera_set_format(impl, port, &info, flags & SPA_NODE_PARAM_FLAG_TEST_ONLY) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!(flags & SPA_NODE_PARAM_FLAG_TEST_ONLY)) {
|
||||
port->current_format = info;
|
||||
}
|
||||
|
||||
done:
|
||||
impl->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS;
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
if (port->current_format) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue