Rémi Denis-Courmont
2018-12-09 19:45:59 UTC
vlc | branch: master | Rémi Denis-Courmont <***@remlab.net> | Sun Dec 9 12:50:59 2018 +0200| [706d291795ca4f5740757ec7bd65af7a6bd86dd1] | committer: Rémi Denis-Courmont
vout: merge vout_OpenWrapper() and vout_InitWrapper()
src/video_output/video_output.c | 5 -----
src/video_output/vout_internal.h | 3 +--
src/video_output/vout_wrapper.c | 45 ++++++++++++++++++----------------------
3 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 591b648a03..0fa136b454 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1449,11 +1449,6 @@ static int ThreadStart(vout_thread_t *vout, vout_display_cfg_t *cfg)
if (vout_OpenWrapper(vout, vout->p->splitter_name, cfg))
goto error;
- if (vout_InitWrapper(vout))
- {
- vout_CloseWrapper(vout, cfg);
- goto error;
- }
assert(vout->p->decoder_pool && vout->p->private_pool);
vout->p->displayed.current = NULL;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 5abf91e744..a696549425 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -214,9 +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_cfg_t *);
+int vout_OpenWrapper(vout_thread_t *, const char *, 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 102370c6b2..c151d42391 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -58,43 +58,27 @@ static void NoDrInit(vout_thread_sys_t *sys)
*
*****************************************************************************/
int vout_OpenWrapper(vout_thread_t *vout,
- const char *splitter_name, const vout_display_cfg_t *cfg)
+ const char *splitter_name, vout_display_cfg_t *cfg)
{
vout_thread_sys_t *sys = vout->p;
+ vout_display_t *vd;
+
msg_Dbg(vout, "Opening vout display wrapper");
/* */
char *modlist = var_InheritString(vout, "vout");
if (splitter_name)
- sys->display.vd = vout_NewSplitter(vout, &vout->p->original, cfg, modlist, splitter_name);
+ vd = vout_NewSplitter(vout, &vout->p->original, cfg, modlist, splitter_name);
else
- sys->display.vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist);
+ vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist);
free(modlist);
- if (!sys->display.vd)
+ if (vd == NULL)
return VLC_EGENERIC;
- /* */
-#ifdef _WIN32
- var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
- var_AddCallback(vout, "video-wallpaper", Forward, NULL);
-#endif
-
- /* */
sys->decoder_pool = NULL;
- return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- *
- *****************************************************************************/
-int vout_InitWrapper(vout_thread_t *vout)
-{
- vout_thread_sys_t *sys = vout->p;
- vout_display_t *vd = sys->display.vd;
-
sys->display.use_dr = !vout_IsDisplayFiltered(vd);
const bool allow_dr = !vd->info.has_pictures_invalid && !vd->info.is_slow && sys->display.use_dr;
const unsigned private_picture = 4; /* XXX 3 for filter, 1 for SPU */
@@ -107,7 +91,7 @@ int vout_InitWrapper(vout_thread_t *vout)
reserved_picture + decoder_picture) : 3;
picture_pool_t *display_pool = vout_display_Pool(vd, display_pool_size);
if (display_pool == NULL)
- return VLC_EGENERIC;
+ goto error;
#ifndef NDEBUG
if ( picture_pool_GetSize(display_pool) < display_pool_size )
@@ -126,7 +110,7 @@ int vout_InitWrapper(vout_thread_t *vout)
__MAX(VOUT_MAX_PICTURES,
reserved_picture + decoder_picture - DISPLAY_PICTURE_COUNT));
if (!sys->decoder_pool)
- return VLC_EGENERIC;
+ goto error;
if (allow_dr) {
msg_Warn(vout, "Not enough direct buffers, using system memory");
sys->dpb_size = 0;
@@ -141,9 +125,20 @@ int vout_InitWrapper(vout_thread_t *vout)
if (sys->decoder_pool != sys->display_pool)
picture_pool_Release(sys->decoder_pool);
sys->display_pool = sys->decoder_pool = NULL;
- return VLC_EGENERIC;
+ goto error;
}
+
+ sys->display.vd = vd;
+
+#ifdef _WIN32
+ var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
+ var_AddCallback(vout, "video-wallpaper", Forward, NULL);
+#endif
return VLC_SUCCESS;
+
+error:
+ vout_DeleteDisplay(vd, cfg);
+ return VLC_EGENERIC;
}
/*****************************************************************************
vout: merge vout_OpenWrapper() and vout_InitWrapper()
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=706d291795ca4f5740757ec7bd65af7a6bd86dd1
---src/video_output/video_output.c | 5 -----
src/video_output/vout_internal.h | 3 +--
src/video_output/vout_wrapper.c | 45 ++++++++++++++++++----------------------
3 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 591b648a03..0fa136b454 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1449,11 +1449,6 @@ static int ThreadStart(vout_thread_t *vout, vout_display_cfg_t *cfg)
if (vout_OpenWrapper(vout, vout->p->splitter_name, cfg))
goto error;
- if (vout_InitWrapper(vout))
- {
- vout_CloseWrapper(vout, cfg);
- goto error;
- }
assert(vout->p->decoder_pool && vout->p->private_pool);
vout->p->displayed.current = NULL;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 5abf91e744..a696549425 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -214,9 +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_cfg_t *);
+int vout_OpenWrapper(vout_thread_t *, const char *, 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 102370c6b2..c151d42391 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -58,43 +58,27 @@ static void NoDrInit(vout_thread_sys_t *sys)
*
*****************************************************************************/
int vout_OpenWrapper(vout_thread_t *vout,
- const char *splitter_name, const vout_display_cfg_t *cfg)
+ const char *splitter_name, vout_display_cfg_t *cfg)
{
vout_thread_sys_t *sys = vout->p;
+ vout_display_t *vd;
+
msg_Dbg(vout, "Opening vout display wrapper");
/* */
char *modlist = var_InheritString(vout, "vout");
if (splitter_name)
- sys->display.vd = vout_NewSplitter(vout, &vout->p->original, cfg, modlist, splitter_name);
+ vd = vout_NewSplitter(vout, &vout->p->original, cfg, modlist, splitter_name);
else
- sys->display.vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist);
+ vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist);
free(modlist);
- if (!sys->display.vd)
+ if (vd == NULL)
return VLC_EGENERIC;
- /* */
-#ifdef _WIN32
- var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
- var_AddCallback(vout, "video-wallpaper", Forward, NULL);
-#endif
-
- /* */
sys->decoder_pool = NULL;
- return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- *
- *****************************************************************************/
-int vout_InitWrapper(vout_thread_t *vout)
-{
- vout_thread_sys_t *sys = vout->p;
- vout_display_t *vd = sys->display.vd;
-
sys->display.use_dr = !vout_IsDisplayFiltered(vd);
const bool allow_dr = !vd->info.has_pictures_invalid && !vd->info.is_slow && sys->display.use_dr;
const unsigned private_picture = 4; /* XXX 3 for filter, 1 for SPU */
@@ -107,7 +91,7 @@ int vout_InitWrapper(vout_thread_t *vout)
reserved_picture + decoder_picture) : 3;
picture_pool_t *display_pool = vout_display_Pool(vd, display_pool_size);
if (display_pool == NULL)
- return VLC_EGENERIC;
+ goto error;
#ifndef NDEBUG
if ( picture_pool_GetSize(display_pool) < display_pool_size )
@@ -126,7 +110,7 @@ int vout_InitWrapper(vout_thread_t *vout)
__MAX(VOUT_MAX_PICTURES,
reserved_picture + decoder_picture - DISPLAY_PICTURE_COUNT));
if (!sys->decoder_pool)
- return VLC_EGENERIC;
+ goto error;
if (allow_dr) {
msg_Warn(vout, "Not enough direct buffers, using system memory");
sys->dpb_size = 0;
@@ -141,9 +125,20 @@ int vout_InitWrapper(vout_thread_t *vout)
if (sys->decoder_pool != sys->display_pool)
picture_pool_Release(sys->decoder_pool);
sys->display_pool = sys->decoder_pool = NULL;
- return VLC_EGENERIC;
+ goto error;
}
+
+ sys->display.vd = vd;
+
+#ifdef _WIN32
+ var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
+ var_AddCallback(vout, "video-wallpaper", Forward, NULL);
+#endif
return VLC_SUCCESS;
+
+error:
+ vout_DeleteDisplay(vd, cfg);
+ return VLC_EGENERIC;
}
/*****************************************************************************