[vlc-commits] video_output: allow changing the interlacing mode while locked
Steve Lhomme
git at videolan.org
Fri Nov 13 16:52:55 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov 6 13:58:22 2020 +0100| [9591771a6bb06ab16c9b96a14002e8ac8b648ae3] | committer: Steve Lhomme
video_output: allow changing the interlacing mode while locked
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9591771a6bb06ab16c9b96a14002e8ac8b648ae3
---
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 406891d877..8bd3170a5f 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -66,7 +66,7 @@ static inline vout_thread_interlacing_t *vout_to_interlacing(vout_thread_t *vout
return &container_of(vout, vout_sys_t, obj)->interlacing;
}
-static int ChangeInterlacing(vout_thread_t *vout)
+static int ChangeInterlacing(vout_thread_t *vout, bool filter_locked)
{
vout_thread_interlacing_t *sys = vout_to_interlacing(vout);
const int deinterlace_state = var_GetInteger(vout, "deinterlace");
@@ -83,7 +83,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);
@@ -98,7 +99,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)
@@ -170,7 +171,7 @@ void vout_ReinitInterlacingSupport(vout_thread_t *vout)
{
vout_thread_interlacing_t *sys = vout_to_interlacing(vout);
sys->is_interlaced = false;
- ChangeInterlacing(vout);
+ ChangeInterlacing(vout, false);
}
void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
@@ -186,7 +187,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 6befd49832..203a2266a7 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 ef92f1c889..02a82dc562 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);
More information about the vlc-commits
mailing list