[vlc-devel] [PATCH v2 5/6] video_output: allow changing the interlacing mode while locked
Steve Lhomme
robux4 at ycbcr.xyz
Mon Nov 9 10:32:34 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 e2d3be8d137..76ffe26d32c 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_sys_t *objsys = container_of(vout, vout_sys_t, obj);
vout_thread_interlacing_t *sys = &objsys->interlacing;
@@ -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);
@@ -94,7 +95,7 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
vout_thread_t *vout = (vout_thread_t *)object;
/* */
- return ChangeInterlacing(vout);
+ return ChangeInterlacing(vout, false);
}
void vout_InitInterlacingSupport(vout_thread_t *vout)
@@ -168,7 +169,7 @@ void vout_ReinitInterlacingSupport(vout_thread_t *vout)
vout_sys_t *objsys = container_of(vout, vout_sys_t, obj);
vout_thread_interlacing_t *sys = &objsys->interlacing;
sys->is_interlaced = false;
- ChangeInterlacing(vout);
+ ChangeInterlacing(vout, false);
}
void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
@@ -185,7 +186,7 @@ void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
msg_Dbg(vout, "Detected %s video",
is_interlaced ? "interlaced" : "progressive");
sys->is_interlaced = is_interlaced;
- ChangeInterlacing(vout);
+ ChangeInterlacing(vout, false);
}
if (is_interlaced)
sys->date = vlc_tick_now();
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 8ee65876807..8238ef3d0a9 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -784,13 +784,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