[vlc-devel] [PATCH v2 4/6] interlacing: get rid of the internal "deinterlace-needed" variable
Steve Lhomme
robux4 at ycbcr.xyz
Mon Nov 9 10:32:33 CET 2020
We can do the same as the callback manually.
The value was always equal to sys->interlacing.is_interlaced.
---
src/video_output/interlacing.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index e98e76bf7ad..e2d3be8d137 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -61,16 +61,13 @@ static bool DeinterlaceIsModeValid(const char *mode)
return false;
}
-static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
- vlc_value_t oldval, vlc_value_t newval, void *data)
+static int ChangeInterlacing(vout_thread_t *vout)
{
- VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(data);
- vout_thread_t *vout = (vout_thread_t *)object;
-
- /* */
+ vout_sys_t *objsys = container_of(vout, vout_sys_t, obj);
+ vout_thread_interlacing_t *sys = &objsys->interlacing;
const int deinterlace_state = var_GetInteger(vout, "deinterlace");
char *mode = var_GetString(vout, "deinterlace-mode");
- const bool is_needed = var_GetBool(vout, "deinterlace-needed");
+ const bool is_needed = sys->is_interlaced;
if (!mode || !DeinterlaceIsModeValid(mode))
{
free(mode);
@@ -90,6 +87,16 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
return VLC_SUCCESS;
}
+static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
+ vlc_value_t oldval, vlc_value_t newval, void *data)
+{
+ VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(data);
+ vout_thread_t *vout = (vout_thread_t *)object;
+
+ /* */
+ return ChangeInterlacing(vout);
+}
+
void vout_InitInterlacingSupport(vout_thread_t *vout)
{
vout_sys_t *objsys = container_of(vout, vout_sys_t, obj);
@@ -135,9 +142,6 @@ void vout_InitInterlacingSupport(vout_thread_t *vout)
val, vlc_gettext(optm->list_text[i]));
}
var_AddCallback(vout, "deinterlace-mode", DeinterlaceCallback, NULL);
- /* */
- var_Create(vout, "deinterlace-needed", VLC_VAR_BOOL);
- var_AddCallback(vout, "deinterlace-needed", DeinterlaceCallback, NULL);
/* Override the initial value from filters if present */
char *filter_mode = NULL;
@@ -164,7 +168,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;
- var_SetBool(vout, "deinterlace-needed", false);
+ ChangeInterlacing(vout);
}
void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
@@ -180,8 +184,8 @@ void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
{
msg_Dbg(vout, "Detected %s video",
is_interlaced ? "interlaced" : "progressive");
- var_SetBool(vout, "deinterlace-needed", is_interlaced);
sys->is_interlaced = is_interlaced;
+ ChangeInterlacing(vout);
}
if (is_interlaced)
sys->date = vlc_tick_now();
--
2.26.2
More information about the vlc-devel
mailing list