mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-21 05:33:49 -04:00
gst: refactor some of the param handling
Clear the caps when the param is NULL.
This commit is contained in:
parent
2bd85e08cf
commit
1fe498560b
1 changed files with 20 additions and 7 deletions
|
|
@ -1001,17 +1001,18 @@ connect_error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_param_changed (void *data, uint32_t id,
|
handle_format_change (GstPipeWireSrc *pwsrc,
|
||||||
const struct spa_pod *param)
|
const struct spa_pod *param)
|
||||||
{
|
{
|
||||||
GstPipeWireSrc *pwsrc = data;
|
|
||||||
|
|
||||||
if (param == NULL || id != SPA_PARAM_Format) {
|
|
||||||
GST_DEBUG_OBJECT (pwsrc, "clear format");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pwsrc->caps)
|
if (pwsrc->caps)
|
||||||
gst_caps_unref(pwsrc->caps);
|
gst_caps_unref(pwsrc->caps);
|
||||||
|
if (param == NULL) {
|
||||||
|
GST_DEBUG_OBJECT (pwsrc, "clear format");
|
||||||
|
pwsrc->caps = NULL;
|
||||||
|
pwsrc->negotiated = FALSE;
|
||||||
|
pwsrc->is_video = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
pwsrc->caps = gst_caps_from_format (param);
|
pwsrc->caps = gst_caps_from_format (param);
|
||||||
|
|
||||||
if (pwsrc->caps && gst_caps_is_fixed (pwsrc->caps)) {
|
if (pwsrc->caps && gst_caps_is_fixed (pwsrc->caps)) {
|
||||||
|
|
@ -1093,6 +1094,18 @@ on_param_changed (void *data, uint32_t id,
|
||||||
pw_thread_loop_signal (pwsrc->core->loop, FALSE);
|
pw_thread_loop_signal (pwsrc->core->loop, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_param_changed (void *data, uint32_t id,
|
||||||
|
const struct spa_pod *param)
|
||||||
|
{
|
||||||
|
GstPipeWireSrc *pwsrc = data;
|
||||||
|
switch (id) {
|
||||||
|
case SPA_PARAM_Format:
|
||||||
|
handle_format_change(pwsrc, param);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_pipewire_src_unlock (GstBaseSrc * basesrc)
|
gst_pipewire_src_unlock (GstBaseSrc * basesrc)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue