[vlc-commits] vout: move some shared fields in a separate vout_thread_private_t structure
Steve Lhomme
git at videolan.org
Fri Jul 17 08:18:16 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jul 16 10:07:39 2020 +0200| [39ff324a217038bf69123c6948144b38add0998c] | committer: Steve Lhomme
vout: move some shared fields in a separate vout_thread_private_t structure
The internal call definitions using vout_thread_private_t are moved to
vout_private.h as well.
The object and storage structure are now separated for these calls.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39ff324a217038bf69123c6948144b38add0998c
---
po/POTFILES.in | 1 +
src/Makefile.am | 2 +-
src/video_output/interlacing.c | 12 +++-----
src/video_output/interlacing.h | 30 --------------------
src/video_output/video_output.c | 32 +++++++++++-----------
src/video_output/vout_internal.h | 22 ++-------------
src/video_output/vout_private.h | 59 ++++++++++++++++++++++++++++++++++++++++
src/video_output/vout_wrapper.c | 7 ++---
8 files changed, 86 insertions(+), 79 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 35fe3ec778..5a39007f79 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -130,6 +130,7 @@ src/video_output/video_text.c
src/video_output/video_widgets.c
src/video_output/vout_internal.h
src/video_output/vout_intf.c
+src/video_output/vout_private.h
src/video_output/vout_subpictures.c
src/win32/thread.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 9e088c1fd9..9e7c2931d2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -313,7 +313,6 @@ libvlccore_la_SOURCES = \
video_output/inhibit.c \
video_output/inhibit.h \
video_output/interlacing.c \
- video_output/interlacing.h \
video_output/snapshot.c \
video_output/snapshot.h \
video_output/statistic.h \
@@ -329,6 +328,7 @@ libvlccore_la_SOURCES = \
video_output/opengl.c \
video_output/vout_intf.c \
video_output/vout_internal.h \
+ video_output/vout_private.h \
video_output/vout_wrapper.c \
network/getaddrinfo.c \
network/http_auth.c \
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 6f5d4e9f24..da2845abb5 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -28,7 +28,6 @@
#include <vlc_common.h>
#include <vlc_vout.h>
-#include "interlacing.h"
#include "vout_internal.h"
/*****************************************************************************
@@ -90,10 +89,9 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
return VLC_SUCCESS;
}
-void vout_InitInterlacingSupport(vout_thread_t *vout)
+void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
{
vlc_value_t val;
- vout_thread_sys_t *sys = vout->p;
msg_Dbg(vout, "Deinterlacing available");
@@ -158,17 +156,15 @@ void vout_InitInterlacingSupport(vout_thread_t *vout)
sys->interlacing.is_interlaced = false;
}
-void vout_ReinitInterlacingSupport(vout_thread_t *vout)
+void vout_ReinitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
{
- vout_thread_sys_t *sys = vout->p;
sys->interlacing.is_interlaced = false;
var_SetBool(vout, "deinterlace-needed", false);
}
-void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
+void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, bool is_interlaced)
{
- vout_thread_sys_t *sys = vout->p;
- /* Wait 30s before quiting interlacing mode */
+ /* Wait 30s before quiting interlacing mode */
const int interlacing_change = (!!is_interlaced)
- (!!sys->interlacing.is_interlaced);
if (interlacing_change == 1 ||
diff --git a/src/video_output/interlacing.h b/src/video_output/interlacing.h
deleted file mode 100644
index c8b4b65fe5..0000000000
--- a/src/video_output/interlacing.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * interlacing.h: Interlacing related helpers
- *****************************************************************************
- * Copyright (C) 2010 Laurent Aimar
- *
- * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLC_VOUT_INTERLACING_H
-#define LIBVLC_VOUT_INTERLACING_H
-
-void vout_InitInterlacingSupport(vout_thread_t *);
-void vout_ReinitInterlacingSupport(vout_thread_t *);
-void vout_SetInterlacingState(vout_thread_t *, bool is_interlaced);
-
-#endif
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f72f59df26..a772fa1c10 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -51,7 +51,6 @@
#include <libvlc.h>
#include "vout_internal.h"
-#include "interlacing.h"
#include "display.h"
#include "snapshot.h"
#include "window.h"
@@ -336,7 +335,7 @@ picture_t *vout_GetPicture(vout_thread_t *vout)
{
vout_thread_sys_t *sys = vout->p;
assert(!sys->dummy);
- picture_t *picture = picture_pool_Wait(sys->display_pool);
+ picture_t *picture = picture_pool_Wait(sys->private.display_pool);
if (likely(picture != NULL)) {
picture_Reset(picture);
video_format_CopyCropAr(&picture->format, &sys->original);
@@ -728,7 +727,7 @@ static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
vout_thread_t *vout = filter->owner.sys;
vout_thread_sys_t *sys = vout->p;
- picture_t *picture = picture_pool_Get(sys->private_pool);
+ picture_t *picture = picture_pool_Get(sys->private.private_pool);
if (picture) {
picture_Reset(picture);
video_format_CopyCropAr(&picture->format, &filter->fmt_out.video);
@@ -794,9 +793,9 @@ static void ThreadChangeFilters(vout_thread_t *vout,
vlc_array_init(&array_interactive);
if (new_deinterlace != NULL)
- sys->interlacing.has_deint = *new_deinterlace;
+ sys->private.interlacing.has_deint = *new_deinterlace;
- if (sys->interlacing.has_deint)
+ if (sys->private.interlacing.has_deint)
{
vout_filter_t *e = malloc(sizeof(*e));
@@ -1182,7 +1181,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
picture_t *snap_pic = todisplay;
if (do_early_spu && subpic) {
if (sys->spu_blend) {
- picture_t *blent = picture_pool_Get(sys->private_pool);
+ picture_t *blent = picture_pool_Get(sys->private.private_pool);
if (blent) {
video_format_CopyCropAr(&blent->format, &filtered->format);
picture_Copy(blent, filtered);
@@ -1578,8 +1577,8 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
vlc_mouse_Init(&sys->mouse);
sys->decoder_fifo = picture_fifo_New();
- sys->display_pool = NULL;
- sys->private_pool = NULL;
+ sys->private.display_pool = NULL;
+ sys->private.private_pool = NULL;
sys->filter.configuration = NULL;
video_format_Copy(&sys->filter.src_fmt, &sys->original);
@@ -1647,7 +1646,8 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
dcfg.window_props.width = sys->window_width;
dcfg.window_props.height = sys->window_height;
- sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg, &sys->original, vctx);
+ sys->display = vout_OpenWrapper(vout, &sys->private, sys->splitter_name, &dcfg,
+ &sys->original, vctx);
if (sys->display == NULL) {
vlc_mutex_unlock(&sys->display_lock);
goto error;
@@ -1659,7 +1659,7 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
vout_SetDisplayAspect(sys->display, num, den);
vlc_mutex_unlock(&sys->display_lock);
- assert(sys->display_pool != NULL && sys->private_pool != NULL);
+ assert(sys->private.display_pool != NULL && sys->private.private_pool != NULL);
sys->displayed.current = NULL;
sys->displayed.next = NULL;
@@ -1749,7 +1749,7 @@ static void *Thread(void *object)
const bool picture_interlaced = sys->displayed.is_interlaced;
- vout_SetInterlacingState(vout, picture_interlaced);
+ vout_SetInterlacingState(vout, &sys->private, picture_interlaced);
}
}
@@ -1763,11 +1763,11 @@ static void vout_ReleaseDisplay(vout_thread_t *vout)
filter_DeleteBlend(sys->spu_blend);
/* Destroy the rendering display */
- if (sys->display_pool != NULL)
+ if (sys->private.display_pool != NULL)
vout_FlushUnlocked(vout, true, INT64_MAX);
vlc_mutex_lock(&sys->display_lock);
- vout_CloseWrapper(vout, sys->display);
+ vout_CloseWrapper(vout, &sys->private, sys->display);
sys->display = NULL;
vlc_mutex_unlock(&sys->display_lock);
@@ -1788,7 +1788,7 @@ static void vout_ReleaseDisplay(vout_thread_t *vout)
picture_fifo_Delete(sys->decoder_fifo);
sys->decoder_fifo = NULL;
}
- assert(sys->display_pool == NULL);
+ assert(sys->private.display_pool == NULL);
if (sys->mouse_event)
sys->mouse_event(NULL, sys->mouse_opaque);
@@ -1956,7 +1956,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);
+ vout_InitInterlacingSupport(vout, &sys->private);
sys->is_late_dropped = var_InheritBool(vout, "drop-late-frames");
@@ -2082,7 +2082,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
if (sys->display != NULL)
vout_StopDisplay(vout);
- vout_ReinitInterlacingSupport(vout);
+ vout_ReinitInterlacingSupport(vout, &sys->private);
sys->original = original;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 106c48ca0d..6540efb4df 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -33,6 +33,7 @@
#include "chrono.h"
#include "../clock/clock.h"
#include "../input/input_internal.h"
+#include "vout_private.h"
/* It should be high enough to absorbe jitter due to difficult picture(s)
* to decode but not too high as memory is not that cheap.
@@ -54,18 +55,14 @@ typedef struct {
} vout_configuration_t;
#include "control.h"
-struct vout_snapshot;
-
-enum vout_crop_mode {
- VOUT_CROP_NONE, VOUT_CROP_RATIO, VOUT_CROP_WINDOW, VOUT_CROP_BORDER,
-};
-
/**
* Video output thread private structure
*/
typedef struct vout_thread_sys_t vout_thread_sys_t;
struct vout_thread_sys_t
{
+ vout_thread_private_t private;
+
bool dummy;
/* Splitter module if used */
@@ -146,12 +143,6 @@ struct vout_thread_sys_t
int position;
} title;
- struct {
- bool is_interlaced;
- bool has_deint;
- vlc_tick_t date;
- } interlacing;
-
/* */
bool is_late_dropped;
@@ -182,8 +173,6 @@ struct vout_thread_sys_t
vout_display_t *display;
vlc_mutex_t display_lock;
- picture_pool_t *private_pool;
- picture_pool_t *display_pool;
picture_fifo_t *decoder_fifo;
vout_chrono_t render; /**< picture render time estimator */
@@ -266,11 +255,6 @@ void vout_IntfInit( vout_thread_t * );
void vout_IntfReinit( vout_thread_t * );
void vout_IntfDeinit(vlc_object_t *);
-/* */
-vout_display_t *vout_OpenWrapper(vout_thread_t *, const char *,
- const vout_display_cfg_t *, video_format_t *, vlc_video_context *);
-void vout_CloseWrapper(vout_thread_t *, vout_display_t *vd);
-
/* */
ssize_t vout_RegisterSubpictureChannelInternal( vout_thread_t *,
vlc_clock_t *clock,
diff --git a/src/video_output/vout_private.h b/src/video_output/vout_private.h
new file mode 100644
index 0000000000..261dcc30fe
--- /dev/null
+++ b/src/video_output/vout_private.h
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * vout_private.h : Internal vout definitions
+ *****************************************************************************
+ * Copyright (C) 2008-2018 VLC authors and VideoLAN
+ * Copyright (C) 2008 Laurent Aimar
+ *
+ * Authors: Laurent Aimar < fenrir _AT_ videolan _DOT_ org >
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLC_VOUT_PRIVATE_H
+#define LIBVLC_VOUT_PRIVATE_H 1
+
+#include <vlc_picture_fifo.h>
+#include <vlc_picture_pool.h>
+#include <vlc_vout_display.h>
+
+typedef struct vout_thread_private_t vout_thread_private_t;
+
+enum vout_crop_mode {
+ VOUT_CROP_NONE, VOUT_CROP_RATIO, VOUT_CROP_WINDOW, VOUT_CROP_BORDER,
+};
+
+/* */
+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;
+};
+
+/* */
+vout_display_t *vout_OpenWrapper(vout_thread_t *, vout_thread_private_t *, const char *,
+ 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);
+
+#endif // LIBVLC_VOUT_PRIVATE_H
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 2c2d896f5a..1cb74ecfb4 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -54,11 +54,10 @@ static void VoutViewpointMoved(void *sys, const vlc_viewpoint_t *vp)
/*****************************************************************************
*
*****************************************************************************/
-vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
+vout_display_t *vout_OpenWrapper(vout_thread_t *vout, vout_thread_private_t *sys,
const char *splitter_name, const vout_display_cfg_t *cfg,
video_format_t *fmt, vlc_video_context *vctx)
{
- vout_thread_sys_t *sys = vout->p;
vout_display_t *vd;
vout_display_owner_t owner = {
.viewpoint_moved = VoutViewpointMoved, .sys = vout,
@@ -128,10 +127,8 @@ error:
/*****************************************************************************
*
*****************************************************************************/
-void vout_CloseWrapper(vout_thread_t *vout, vout_display_t *vd)
+void vout_CloseWrapper(vout_thread_t *vout, vout_thread_private_t *sys, vout_display_t *vd)
{
- vout_thread_sys_t *sys = vout->p;
-
assert(sys->display_pool && sys->private_pool);
picture_pool_Release(sys->private_pool);
More information about the vlc-commits
mailing list