[vlc-devel] [PATCH 3/5] interlacing: get rid of the internal "deinterlace-needed" variable
Steve Lhomme
robux4 at ycbcr.xyz
Fri Nov 6 15:32:30 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 | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 0f9a16956f1..2d52a7e04bf 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_threadsys_t *p_sys = container_of(vout, vout_threadsys_t, obj);
+ vout_thread_private_t *sys = &p_sys->private;
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->interlacing.is_interlaced;
if (!mode || !DeinterlaceIsModeValid(mode))
{
free(mode);
@@ -90,6 +87,15 @@ 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_thread_private_t *sys)
{
vlc_value_t val;
@@ -133,9 +139,6 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys
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;
@@ -160,7 +163,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;
- var_SetBool(vout, "deinterlace-needed", false);
+ ChangeInterlacing(vout);
}
void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, bool is_interlaced)
@@ -174,8 +177,8 @@ void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, b
{
msg_Dbg(vout, "Detected %s video",
is_interlaced ? "interlaced" : "progressive");
- var_SetBool(vout, "deinterlace-needed", is_interlaced);
sys->interlacing.is_interlaced = is_interlaced;
+ ChangeInterlacing(vout);
}
if (is_interlaced)
sys->interlacing.date = vlc_tick_now();
--
2.26.2
More information about the vlc-devel
mailing list