[vlc-commits] vout: remove vout_display_state_t
Rémi Denis-Courmont
git at videolan.org
Sun Dec 9 20:45:46 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec 8 19:34:56 2018 +0200| [2b38f17ea648de73d923b9efed3309d59eb1aaf5] | committer: Rémi Denis-Courmont
vout: remove vout_display_state_t
Replace it directly with vout_display_cfg_t.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2b38f17ea648de73d923b9efed3309d59eb1aaf5
---
src/video_output/display.c | 48 +++++++++++++++++++---------------------
src/video_output/display.h | 2 +-
src/video_output/video_output.c | 43 ++++++++++++++++++-----------------
src/video_output/vout_internal.h | 4 ++--
src/video_output/vout_wrapper.c | 10 ++++-----
src/video_output/vout_wrapper.h | 11 ++-------
6 files changed, 54 insertions(+), 64 deletions(-)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 8b727db08a..fc511c8814 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -934,14 +934,14 @@ void vout_SetDisplayViewpoint(vout_display_t *vd,
static vout_display_t *DisplayNew(vout_thread_t *vout,
const video_format_t *source,
- const vout_display_state_t *state,
+ const vout_display_cfg_t *cfg,
const char *module, bool is_splitter,
const vout_display_owner_t *owner_ptr)
{
/* */
vout_display_owner_sys_t *osys = calloc(1, sizeof(*osys));
- osys->cfg = state->cfg;
+ osys->cfg = *cfg;
vout_display_GetDefaultDisplaySize(&osys->cfg.display.width,
&osys->cfg.display.height,
source, &osys->cfg);
@@ -999,12 +999,12 @@ error:
return NULL;
}
-void vout_DeleteDisplay(vout_display_t *vd, vout_display_state_t *state)
+void vout_DeleteDisplay(vout_display_t *vd, vout_display_cfg_t *cfg)
{
vout_display_owner_sys_t *osys = vd->owner.sys;
- if (state != NULL && !osys->is_splitter)
- state->cfg = osys->cfg;
+ if (cfg != NULL && !osys->is_splitter)
+ *cfg = osys->cfg;
VoutDisplayDestroyRender(vd);
if (osys->is_splitter)
@@ -1019,10 +1019,10 @@ void vout_DeleteDisplay(vout_display_t *vd, vout_display_state_t *state)
*****************************************************************************/
vout_display_t *vout_NewDisplay(vout_thread_t *vout,
const video_format_t *source,
- const vout_display_state_t *state,
+ const vout_display_cfg_t *cfg,
const char *module)
{
- return DisplayNew(vout, source, state, module, false, NULL);
+ return DisplayNew(vout, source, cfg, module, false, NULL);
}
/*****************************************************************************
@@ -1169,7 +1169,7 @@ static void SplitterClose(vout_display_t *vd)
vout_display_t *vout_NewSplitter(vout_thread_t *vout,
const video_format_t *source,
- const vout_display_state_t *state,
+ const vout_display_cfg_t *cfg,
const char *module,
const char *splitter_module)
{
@@ -1180,7 +1180,7 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
/* */
vout_display_t *wrapper =
- DisplayNew(vout, source, state, module, true, NULL);
+ DisplayNew(vout, source, cfg, module, true, NULL);
if (!wrapper) {
video_splitter_Delete(splitter);
return NULL;
@@ -1214,35 +1214,33 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
.event = SplitterEvent,
};
const video_splitter_output_t *output = &splitter->p_output[i];
- vout_display_state_t ostate;
vout_window_cfg_t wcfg = {
- .width = state->cfg.display.width,
- .height = state->cfg.display.height,
+ .width = cfg->display.width,
+ .height = cfg->display.height,
.is_decorated = true,
};
+ vout_display_cfg_t ocfg = {
+ .display = cfg->display,
+ .align = { 0, 0 } /* TODO */,
+ .is_display_filled = true,
+ .zoom = { 1, 1 },
+ };
- memset(&ostate, 0, sizeof(ostate));
- ostate.cfg.display = state->cfg.display;
- ostate.cfg.align.horizontal = 0; /* TODO */
- ostate.cfg.align.vertical = 0; /* TODO */
- ostate.cfg.is_display_filled = true;
- ostate.cfg.zoom.num = 1;
- ostate.cfg.zoom.den = 1;
vout_display_GetDefaultDisplaySize(&wcfg.width, &wcfg.height,
- source, &ostate.cfg);
- ostate.cfg.window = vout_display_window_New(vout, &wcfg);
- if (unlikely(ostate.cfg.window == NULL)) {
+ source, &ocfg);
+ ocfg.window = vout_display_window_New(vout, &wcfg);
+ if (unlikely(ocfg.window == NULL)) {
vout_DeleteDisplay(wrapper, NULL);
return NULL;
}
- vout_display_t *vd = DisplayNew(vout, &output->fmt, &ostate,
+ vout_display_t *vd = DisplayNew(vout, &output->fmt, &ocfg,
output->psz_module ? output->psz_module : module,
false, &vdo);
if (!vd) {
vout_DeleteDisplay(wrapper, NULL);
- if (ostate.cfg.window != NULL)
- vout_display_window_Delete(ostate.cfg.window);
+ if (ocfg.window != NULL)
+ vout_display_window_Delete(ocfg.window);
return NULL;
}
TAB_APPEND(sys->count, sys->display, vd);
diff --git a/src/video_output/display.h b/src/video_output/display.h
index f1297b59c5..6566f8f21f 100644
--- a/src/video_output/display.h
+++ b/src/video_output/display.h
@@ -25,7 +25,7 @@
vout_display_t *vout_NewSplitter(vout_thread_t *vout,
const video_format_t *source,
- const vout_display_state_t *state,
+ const vout_display_cfg_t *cfg,
const char *module,
const char *splitter_module);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f2e0a79588..c921643f10 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1422,7 +1422,7 @@ static void ThreadTranslateMouseState(vout_thread_t *vout,
vout_SendDisplayEventMouse(vout, &vid_mouse);
}
-static int ThreadStart(vout_thread_t *vout, vout_display_state_t *state)
+static int ThreadStart(vout_thread_t *vout, vout_display_cfg_t *cfg)
{
vlc_mouse_Init(&vout->p->mouse);
vout->p->decoder_fifo = picture_fifo_New();
@@ -1450,17 +1450,17 @@ static int ThreadStart(vout_thread_t *vout, vout_display_state_t *state)
vout->p->filter.chain_interactive =
filter_chain_NewVideo( vout, true, &owner );
- vout_display_state_t state_default;
- if (!state) {
- VoutGetDisplayCfg(vout, &state_default.cfg);
- state = &state_default;
+ vout_display_cfg_t cfg_default;
+ if (cfg == NULL) {
+ VoutGetDisplayCfg(vout, &cfg_default);
+ cfg = &cfg_default;
}
- if (vout_OpenWrapper(vout, vout->p->splitter_name, state))
+ if (vout_OpenWrapper(vout, vout->p->splitter_name, cfg))
goto error;
if (vout_InitWrapper(vout))
{
- vout_CloseWrapper(vout, state);
+ vout_CloseWrapper(vout, cfg);
goto error;
}
assert(vout->p->decoder_pool && vout->p->private_pool);
@@ -1494,7 +1494,7 @@ error:
return VLC_EGENERIC;
}
-static void ThreadStop(vout_thread_t *vout, vout_display_state_t *state)
+static void ThreadStop(vout_thread_t *vout, vout_display_cfg_t *cfg)
{
if (vout->p->spu_blend)
filter_DeleteBlend(vout->p->spu_blend);
@@ -1505,7 +1505,7 @@ static void ThreadStop(vout_thread_t *vout, vout_display_state_t *state)
ThreadFlush(vout, true, INT64_MAX);
vout_EndWrapper(vout);
}
- vout_CloseWrapper(vout, state);
+ vout_CloseWrapper(vout, cfg);
}
/* Destroy the video filters */
@@ -1559,35 +1559,34 @@ static int ThreadReinit(vout_thread_t *vout,
msg_Warn(vout, "DPB need to be increased");
}
- vout_display_state_t state;
- memset(&state, 0, sizeof(state));
+ vout_display_cfg_t dcfg = { };
- ThreadStop(vout, &state);
+ ThreadStop(vout, &dcfg);
vout_ReinitInterlacingSupport(vout);
#if defined(_WIN32) || defined(__OS2__)
- if (!state.cfg.is_fullscreen)
+ if (!dcfg.is_fullscreen)
#endif
{
- state.cfg.display.width = 0;
- state.cfg.display.height = 0;
+ dcfg.display.width = 0;
+ dcfg.display.height = 0;
}
/* FIXME current vout "variables" are not in sync here anymore
* and I am not sure what to do */
- if (state.cfg.display.sar.num <= 0 || state.cfg.display.sar.den <= 0) {
- state.cfg.display.sar.num = 1;
- state.cfg.display.sar.den = 1;
+ if (dcfg.display.sar.num <= 0 || dcfg.display.sar.den <= 0) {
+ dcfg.display.sar.num = 1;
+ dcfg.display.sar.den = 1;
}
- if (state.cfg.zoom.num == 0 || state.cfg.zoom.den == 0) {
- state.cfg.zoom.num = 1;
- state.cfg.zoom.den = 1;
+ if (dcfg.zoom.num == 0 || dcfg.zoom.den == 0) {
+ dcfg.zoom.num = 1;
+ dcfg.zoom.den = 1;
}
vout->p->original = original;
vout->p->dpb_size = cfg->dpb_size;
- if (ThreadStart(vout, &state))
+ if (ThreadStart(vout, &dcfg))
return VLC_EGENERIC;
return VLC_SUCCESS;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 189d32e9ab..5abf91e744 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -214,8 +214,8 @@ void vout_IntfInit( vout_thread_t * );
void vout_IntfReinit( vout_thread_t * );
/* */
-int vout_OpenWrapper (vout_thread_t *, const char *, const vout_display_state_t *);
-void vout_CloseWrapper(vout_thread_t *, vout_display_state_t *);
+int vout_OpenWrapper (vout_thread_t *, const char *, const vout_display_cfg_t *);
+void vout_CloseWrapper(vout_thread_t *, vout_display_cfg_t *);
int vout_InitWrapper(vout_thread_t *);
void vout_EndWrapper(vout_thread_t *);
void vout_ManageWrapper(vout_thread_t *);
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 47637c15af..3f90285bc5 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -47,7 +47,7 @@ static int Forward(vlc_object_t *, char const *,
*
*****************************************************************************/
int vout_OpenWrapper(vout_thread_t *vout,
- const char *splitter_name, const vout_display_state_t *state)
+ const char *splitter_name, const vout_display_cfg_t *cfg)
{
vout_thread_sys_t *sys = vout->p;
msg_Dbg(vout, "Opening vout display wrapper");
@@ -56,9 +56,9 @@ int vout_OpenWrapper(vout_thread_t *vout,
char *modlist = var_InheritString(vout, "vout");
if (splitter_name)
- sys->display.vd = vout_NewSplitter(vout, &vout->p->original, state, modlist, splitter_name);
+ sys->display.vd = vout_NewSplitter(vout, &vout->p->original, cfg, modlist, splitter_name);
else
- sys->display.vd = vout_NewDisplay(vout, &vout->p->original, state, modlist);
+ sys->display.vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist);
free(modlist);
if (!sys->display.vd)
@@ -79,7 +79,7 @@ int vout_OpenWrapper(vout_thread_t *vout,
/*****************************************************************************
*
*****************************************************************************/
-void vout_CloseWrapper(vout_thread_t *vout, vout_display_state_t *state)
+void vout_CloseWrapper(vout_thread_t *vout, vout_display_cfg_t *cfg)
{
vout_thread_sys_t *sys = vout->p;
@@ -88,7 +88,7 @@ void vout_CloseWrapper(vout_thread_t *vout, vout_display_state_t *state)
#endif
sys->decoder_pool = NULL; /* FIXME remove */
- vout_DeleteDisplay(sys->display.vd, state);
+ vout_DeleteDisplay(sys->display.vd, cfg);
}
/*****************************************************************************
diff --git a/src/video_output/vout_wrapper.h b/src/video_output/vout_wrapper.h
index 5a422e4f73..7f57e2cbb7 100644
--- a/src/video_output/vout_wrapper.h
+++ b/src/video_output/vout_wrapper.h
@@ -59,21 +59,14 @@ static inline void vout_display_Display(vout_display_t *vd, picture_t *picture)
}
/**
- * It holds a state for a vout display.
- */
-typedef struct {
- vout_display_cfg_t cfg;
-} vout_display_state_t;
-
-/**
* It creates a vout managed display.
*/
vout_display_t *vout_NewDisplay( vout_thread_t *, const video_format_t *,
- const vout_display_state_t *, const char *module);
+ const vout_display_cfg_t *, const char *module);
/**
* It destroy a vout managed display.
*/
-void vout_DeleteDisplay(vout_display_t *, vout_display_state_t *);
+void vout_DeleteDisplay(vout_display_t *, vout_display_cfg_t *);
bool vout_IsDisplayFiltered(vout_display_t *);
picture_t * vout_FilterDisplay(vout_display_t *, picture_t *);
void vout_FilterFlush(vout_display_t *);
More information about the vlc-commits
mailing list