[vlc-devel] [PATCH v2 2/6] video_output: use a separate structure for the deinterlacing state
Steve Lhomme
robux4 at ycbcr.xyz
Mon Nov 9 10:32:31 CET 2020
---
src/video_output/interlacing.c | 22 +++++++++++-----------
src/video_output/video_output.c | 14 ++++++++------
src/video_output/vout_private.h | 18 +++++++++---------
3 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 0f9a16956f1..bb2f1341eac 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -90,13 +90,13 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
return VLC_SUCCESS;
}
-void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
+void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_interlacing_t *sys)
{
vlc_value_t val;
msg_Dbg(vout, "Deinterlacing available");
- sys->interlacing.has_deint = false;
+ sys->has_deint = false;
/* Create the configuration variables */
/* */
@@ -139,7 +139,7 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys
/* Override the initial value from filters if present */
char *filter_mode = NULL;
- if (sys->interlacing.has_deint)
+ if (sys->has_deint)
filter_mode = var_CreateGetNonEmptyString(vout, "sout-deinterlace-mode");
if (filter_mode) {
deinterlace_state = 1;
@@ -154,29 +154,29 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys
var_SetInteger(vout, "deinterlace", deinterlace_state);
free(deinterlace_mode);
- sys->interlacing.is_interlaced = false;
+ sys->is_interlaced = false;
}
-void vout_ReinitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
+void vout_ReinitInterlacingSupport(vout_thread_t *vout, vout_thread_interlacing_t *sys)
{
- sys->interlacing.is_interlaced = false;
+ sys->is_interlaced = false;
var_SetBool(vout, "deinterlace-needed", false);
}
-void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, bool is_interlaced)
+void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_interlacing_t *sys, bool is_interlaced)
{
/* Wait 30s before quiting interlacing mode */
const int interlacing_change = (!!is_interlaced)
- - (!!sys->interlacing.is_interlaced);
+ - (!!sys->is_interlaced);
if (interlacing_change == 1 ||
(interlacing_change == -1 &&
- sys->interlacing.date + VLC_TICK_FROM_SEC(30) < vlc_tick_now()))
+ sys->date + VLC_TICK_FROM_SEC(30) < vlc_tick_now()))
{
msg_Dbg(vout, "Detected %s video",
is_interlaced ? "interlaced" : "progressive");
var_SetBool(vout, "deinterlace-needed", is_interlaced);
- sys->interlacing.is_interlaced = is_interlaced;
+ sys->is_interlaced = is_interlaced;
}
if (is_interlaced)
- sys->interlacing.date = vlc_tick_now();
+ sys->date = vlc_tick_now();
}
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index fa68a54a8f7..4f87155225a 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -66,6 +66,8 @@ typedef struct vout_thread_sys_t
{
struct vout_thread_t obj;
+ vout_thread_interlacing_t interlacing;
+
vout_thread_private_t private;
bool dummy;
@@ -962,7 +964,7 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout)
vlc_array_init(&array_static);
vlc_array_init(&array_interactive);
- if (sys->private.interlacing.has_deint)
+ if (sys->interlacing.has_deint)
{
vout_filter_t *e = malloc(sizeof(*e));
@@ -1466,9 +1468,9 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
vlc_mutex_lock(&sys->filter.lock);
if (sys->filter.changed ||
- sys->private.interlacing.has_deint != sys->filter.new_interlaced)
+ sys->interlacing.has_deint != sys->filter.new_interlaced)
{
- sys->private.interlacing.has_deint = sys->filter.new_interlaced;
+ sys->interlacing.has_deint = sys->filter.new_interlaced;
ThreadChangeFilters(vout);
}
vlc_mutex_unlock(&sys->filter.lock);
@@ -1916,7 +1918,7 @@ static void *Thread(void *object)
const bool picture_interlaced = sys->displayed.is_interlaced;
- vout_SetInterlacingState(&vout->obj, &sys->private, picture_interlaced);
+ vout_SetInterlacingState(&vout->obj, &sys->interlacing, picture_interlaced);
}
}
@@ -2124,7 +2126,7 @@ vout_thread_t *vout_Create(vlc_object_t *object)
sys->title.timeout = var_InheritInteger(vout, "video-title-timeout");
sys->title.position = var_InheritInteger(vout, "video-title-position");
- vout_InitInterlacingSupport(vout, &sys->private);
+ vout_InitInterlacingSupport(vout, &sys->interlacing);
sys->is_late_dropped = var_InheritBool(vout, "drop-late-frames");
@@ -2291,7 +2293,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
if (sys->display != NULL)
vout_StopDisplay(cfg->vout);
- vout_ReinitInterlacingSupport(cfg->vout, &sys->private);
+ vout_ReinitInterlacingSupport(cfg->vout, &sys->interlacing);
sys->original = original;
diff --git a/src/video_output/vout_private.h b/src/video_output/vout_private.h
index 5e8c58dabe7..ff983813e91 100644
--- a/src/video_output/vout_private.h
+++ b/src/video_output/vout_private.h
@@ -30,15 +30,15 @@
typedef struct vout_thread_private_t vout_thread_private_t;
+typedef struct {
+ bool is_interlaced;
+ bool has_deint;
+ vlc_tick_t date;
+} vout_thread_interlacing_t;
+
/* */
struct vout_thread_private_t
{
- struct {
- bool is_interlaced;
- bool has_deint;
- vlc_tick_t date;
- } interlacing;
-
picture_pool_t *private_pool;
picture_pool_t *display_pool;
};
@@ -48,8 +48,8 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *, vout_thread_private_t *, const
const vout_display_cfg_t *, video_format_t *, vlc_video_context *);
void vout_CloseWrapper(vout_thread_t *, vout_thread_private_t *, vout_display_t *vd);
-void vout_InitInterlacingSupport(vout_thread_t *, vout_thread_private_t *);
-void vout_ReinitInterlacingSupport(vout_thread_t *, vout_thread_private_t *);
-void vout_SetInterlacingState(vout_thread_t *, vout_thread_private_t *, bool is_interlaced);
+void vout_InitInterlacingSupport(vout_thread_t *, vout_thread_interlacing_t *);
+void vout_ReinitInterlacingSupport(vout_thread_t *, vout_thread_interlacing_t *);
+void vout_SetInterlacingState(vout_thread_t *, vout_thread_interlacing_t *, bool is_interlaced);
#endif // LIBVLC_VOUT_PRIVATE_H
--
2.26.2
More information about the vlc-devel
mailing list