[vlc-devel] [PATCH 4/5] video_output: allow changing the interlacing mode while locked
Steve Lhomme
robux4 at ycbcr.xyz
Fri Nov 6 15:32:31 CET 2020
---
src/video_output/interlacing.c | 11 ++++++-----
src/video_output/video_output.c | 8 +++++---
src/video_output/vout_internal.h | 2 +-
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 2d52a7e04bf..e6fe8d23b4e 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -61,7 +61,7 @@ static bool DeinterlaceIsModeValid(const char *mode)
return false;
}
-static int ChangeInterlacing(vout_thread_t *vout)
+static int ChangeInterlacing(vout_thread_t *vout, bool filter_locked)
{
vout_threadsys_t *p_sys = container_of(vout, vout_threadsys_t, obj);
vout_thread_private_t *sys = &p_sys->private;
@@ -79,7 +79,8 @@ static int ChangeInterlacing(vout_thread_t *vout)
var_SetString(vout, "sout-deinterlace-mode", mode);
msg_Dbg(vout, "deinterlace %d, mode %s, is_needed %d", deinterlace_state, mode, is_needed);
- vout_ControlChangeInterlacing(vout, deinterlace_state != 0 && (is_needed || deinterlace_state >= 0));
+ vout_ControlChangeInterlacing(vout, deinterlace_state != 0 && (is_needed || deinterlace_state >= 0),
+ filter_locked);
/* */
free(old);
@@ -93,7 +94,7 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(data);
vout_thread_t *vout = (vout_thread_t *)object;
- return ChangeInterlacing(vout);
+ return ChangeInterlacing(vout, false);
}
void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
@@ -163,7 +164,7 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys
void vout_ReinitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
{
sys->interlacing.is_interlaced = false;
- ChangeInterlacing(vout);
+ ChangeInterlacing(vout, false);
}
void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, bool is_interlaced)
@@ -178,7 +179,7 @@ void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, b
msg_Dbg(vout, "Detected %s video",
is_interlaced ? "interlaced" : "progressive");
sys->interlacing.is_interlaced = is_interlaced;
- ChangeInterlacing(vout);
+ ChangeInterlacing(vout, false);
}
if (is_interlaced)
sys->interlacing.date = vlc_tick_now();
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f3a426dc1e6..0a71457d4f9 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -782,13 +782,15 @@ void vout_ControlChangeFilters(vout_thread_t *vout, const char *filters)
vlc_mutex_unlock(&sys->filter.lock);
}
-void vout_ControlChangeInterlacing(vout_thread_t *vout, bool set)
+void vout_ControlChangeInterlacing(vout_thread_t *vout, bool set, bool filter_locked)
{
vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
assert(!sys->dummy);
- vlc_mutex_lock(&sys->filter.lock);
+ if (!filter_locked)
+ vlc_mutex_lock(&sys->filter.lock);
sys->filter.new_interlaced = set;
- vlc_mutex_unlock(&sys->filter.lock);
+ if (!filter_locked)
+ vlc_mutex_unlock(&sys->filter.lock);
}
void vout_ControlChangeSubSources(vout_thread_t *vout, const char *filters)
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index ef92f1c8892..02a82dc5626 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -121,7 +121,7 @@ void vout_ChangeCropRatio(vout_thread_t *, unsigned num, unsigned den);
void vout_ChangeCropWindow(vout_thread_t *, int x, int y, int width, int height);
void vout_ChangeCropBorder(vout_thread_t *, int left, int top, int right, int bottom);
void vout_ControlChangeFilters(vout_thread_t *, const char *);
-void vout_ControlChangeInterlacing(vout_thread_t *, bool);
+void vout_ControlChangeInterlacing(vout_thread_t *, bool, bool filter_locked);
void vout_ControlChangeSubSources(vout_thread_t *, const char *);
void vout_ControlChangeSubFilters(vout_thread_t *, const char *);
void vout_ChangeSpuChannelMargin(vout_thread_t *, enum vlc_vout_order order, int);
--
2.26.2
More information about the vlc-devel
mailing list