Commit 7d8714d9 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

video_output/vout_subpictures.c: Fix filters appearing and disappearing when...

video_output/vout_subpictures.c: Fix filters appearing and disappearing when loaded for the first time.

The sys->filter_chain_update and sys->source_chain_update interacted with each other, because
the code was not carefull enough on when it is safe to overload 'sub-source' with the value of
'sub-filter'. The 'sub-filter' chain can also be a 'sub-source', but not the otherway around.
parent 93900cd7
...@@ -1372,9 +1372,13 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic) ...@@ -1372,9 +1372,13 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
vlc_mutex_lock(&sys->filter_chain_lock); vlc_mutex_lock(&sys->filter_chain_lock);
if (chain_update) { if (chain_update) {
filter_chain_Reset(sys->filter_chain, NULL, NULL); if (*chain_update) {
filter_chain_Reset(sys->filter_chain, NULL, NULL);
filter_chain_AppendFromString(spu->p->filter_chain, chain_update); filter_chain_AppendFromString(spu->p->filter_chain, chain_update);
}
else if (filter_chain_GetLength(spu->p->filter_chain) > 0)
filter_chain_Reset(sys->filter_chain, NULL, NULL);
/* "sub-source" was formerly "sub-filter", so now the "sub-filter" /* "sub-source" was formerly "sub-filter", so now the "sub-filter"
configuration may contain sub-filters or sub-sources configurations. configuration may contain sub-filters or sub-sources configurations.
...@@ -1383,23 +1387,27 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic) ...@@ -1383,23 +1387,27 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
} }
vlc_mutex_unlock(&sys->filter_chain_lock); vlc_mutex_unlock(&sys->filter_chain_lock);
if (is_left_empty) { if (is_left_empty) {
/* try to use the configuration as a sub-source configuration */ /* try to use the configuration as a sub-source configuration,
but only if there is no 'source_chain_update' value and
vlc_mutex_lock(&sys->lock); if only if 'chain_update' has a value */
if (!sys->source_chain_update || !*sys->source_chain_update) { if (chain_update && *chain_update) {
free(sys->source_chain_update); vlc_mutex_lock(&sys->lock);
sys->source_chain_update = chain_update; if (!sys->source_chain_update && !*sys->source_chain_update) {
chain_update = NULL; free(sys->source_chain_update);
sys->source_chain_update = chain_update;
chain_update = NULL;
}
vlc_mutex_unlock(&sys->lock);
} }
vlc_mutex_unlock(&sys->lock);
} }
free(chain_update); free(chain_update);
/* Run filter chain on the new subpicture */ /* Run filter chain on the new subpicture */
vlc_mutex_lock(&sys->filter_chain_lock);
subpic = filter_chain_SubFilter(spu->p->filter_chain, subpic); subpic = filter_chain_SubFilter(spu->p->filter_chain, subpic);
vlc_mutex_unlock(&sys->filter_chain_lock);
if (!subpic) if (!subpic)
return; return;
...@@ -1440,9 +1448,13 @@ subpicture_t *spu_Render(spu_t *spu, ...@@ -1440,9 +1448,13 @@ subpicture_t *spu_Render(spu_t *spu,
vlc_mutex_lock(&sys->source_chain_lock); vlc_mutex_lock(&sys->source_chain_lock);
if (chain_update) { if (chain_update) {
filter_chain_Reset(sys->source_chain, NULL, NULL); if (*chain_update) {
filter_chain_Reset(sys->source_chain, NULL, NULL);
filter_chain_AppendFromString(spu->p->source_chain, chain_update); filter_chain_AppendFromString(spu->p->source_chain, chain_update);
}
else if (filter_chain_GetLength(spu->p->source_chain) > 0)
filter_chain_Reset(sys->source_chain, NULL, NULL);
free(chain_update); free(chain_update);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment