[vlc-commits] vout: change "vout display" activate/deactivate callbacks.
Thomas Guillem
git at videolan.org
Tue Nov 27 17:24:20 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Oct 28 12:11:27 2018 +0100| [1aa83e2cfab4a0e9f02b5a5250e681f7f2799df5] | committer: Thomas Guillem
vout: change "vout display" activate/deactivate callbacks.
Pass, vd, cfg, fmtp and video_context (that will be used for the future VOUT
push model).
During the transition, vd->cfg and vd->fmt are still valid (but they will be
removed).
vd->fmt is only used directly from the pf_pool callback. This callback will be
removed too.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1aa83e2cfab4a0e9f02b5a5250e681f7f2799df5
---
include/vlc_vout_display.h | 23 +++++++++++++++++++++++
modules/hw/mmal/vout.c | 13 +++++++------
modules/hw/vdpau/display.c | 19 +++++++++----------
modules/video_output/android/display.c | 29 +++++++++++++----------------
modules/video_output/caopengllayer.m | 16 +++++++---------
modules/video_output/fb.c | 19 +++++++++----------
modules/video_output/flaschen.c | 14 +++++++-------
modules/video_output/ios.m | 25 ++++++++++++-------------
modules/video_output/kms.c | 28 +++++++++-------------------
modules/video_output/kva.c | 29 ++++++++++++++++++++++-------
modules/video_output/macosx.m | 21 ++++++++++-----------
modules/video_output/opengl/display.c | 15 +++++++--------
modules/video_output/vdummy.c | 27 +++++++++++++++------------
modules/video_output/vmem.c | 14 +++++++-------
modules/video_output/vulkan/display.c | 12 ++++++------
modules/video_output/wayland/shm.c | 11 ++++-------
modules/video_output/win32/direct3d11.c | 20 ++++++++------------
modules/video_output/win32/direct3d9.c | 17 +++++++----------
modules/video_output/win32/directdraw.c | 14 ++++++--------
modules/video_output/win32/glwin32.c | 18 ++++++++----------
modules/video_output/win32/wingdi.c | 17 +++++++----------
modules/video_output/xcb/x11.c | 21 ++++++++++-----------
modules/video_output/xcb/xvideo.c | 18 +++++++++---------
modules/video_output/yuv.c | 14 +++++++-------
src/video_output/display.c | 26 +++++++++++++++++---------
25 files changed, 246 insertions(+), 234 deletions(-)
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 04b5e78dbd..226d55f782 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -209,6 +209,29 @@ struct vout_display_owner_t {
void (*event)(vout_display_t *, int, va_list);
};
+/**
+ * "vout display" open callback
+ *
+ * @param vd vout display context
+ * @param cfg Initial and current configuration.
+ * @param fmtp By default, it is equal to vd->source except for the aspect
+ * ratio which is undefined(0) and is ignored. It can be changed by the module
+ * to request a different format.
+ * @param context XXX: to be defined.
+ * @return VLC_SUCCESS or a VLC error code
+ */
+typedef int (*vout_display_open_cb)(vout_display_t *vd,
+ const vout_display_cfg_t *cfg,
+ video_format_t *fmtp,
+ vlc_video_context *context);
+
+/**
+ * "vout display" close callback
+ *
+ * @param vd vout display context
+ */
+typedef int (*vout_display_close_cb)(vout_display_t *vd);
+
struct vout_display_t {
struct vlc_common_members obj;
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 2adeca698a..2a19556b4c 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -68,8 +68,9 @@
#define PHASE_OFFSET_TARGET ((double)0.25)
#define PHASE_CHECK_INTERVAL 100
-static int Open(vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin()
set_shortname(N_("MMAL vout"))
@@ -181,10 +182,9 @@ static void dmx_region_delete(struct dmx_region_t *dmx_region,
static void show_background(vout_display_t *vd, bool enable);
static void maintain_phase_sync(vout_display_t *vd);
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
vout_display_sys_t *sys;
uint32_t buffer_pitch, buffer_height;
vout_display_place_t place;
@@ -321,10 +321,11 @@ out:
if (ret != VLC_SUCCESS)
Close(object);
+ (void) context;
return ret;
}
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index 7e5548ffc5..447b0499f1 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -38,8 +38,9 @@
#include "vlc_vdpau.h"
#include "events.h"
-static int Open(vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin()
set_shortname(N_("VDPAU"))
@@ -411,14 +412,12 @@ static int xcb_screen_num(xcb_connection_t *conn, const xcb_screen_t *screen)
return -1;
}
-static int Open(vlc_object_t *obj)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- if (!vlc_xlib_init(obj))
+ if (!vlc_xlib_init(VLC_OBJECT(vd)))
return VLC_EGENERIC;
- vout_display_t *vd = (vout_display_t *)obj;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys = malloc(sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
@@ -436,7 +435,7 @@ static int Open(vlc_object_t *obj)
&sys->vdp, &sys->device);
if (err != VDP_STATUS_OK)
{
- msg_Dbg(obj, "device creation failure: error %d", (int)err);
+ msg_Dbg(vd, "device creation failure: error %d", (int)err);
xcb_disconnect(sys->conn);
free(sys);
return VLC_EGENERIC;
@@ -654,6 +653,7 @@ static int Open(vlc_object_t *obj)
vd->display = Wait;
vd->control = Control;
+ (void) context;
return VLC_SUCCESS;
error:
@@ -663,9 +663,8 @@ error:
return VLC_EGENERIC;
}
-static void Close(vlc_object_t *obj)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys;
vdp_presentation_queue_destroy(sys->vdp, sys->queue);
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 3b9694fb08..2cb5b0d6ca 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -51,9 +51,11 @@
"Force use of a specific chroma for output. Default is RGB32."
#define CFG_PREFIX "android-display-"
-static int Open (vlc_object_t *);
-static int OpenOpaque (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static int OpenOpaque(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
static void SubpicturePrepare(vout_display_t *vd, subpicture_t *subpicture);
vlc_module_begin()
@@ -607,16 +609,13 @@ static int OpenCommon(vout_display_t *vd, const vout_display_cfg_t *cfg,
return VLC_SUCCESS;
error:
- Close(VLC_OBJECT(vd));
+ Close(vd);
return VLC_EGENERIC;
}
-static int Open(vlc_object_t *p_this)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t*)p_this;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
-
if (fmtp->i_chroma == VLC_CODEC_ANDROID_OPAQUE)
return VLC_EGENERIC;
@@ -625,15 +624,13 @@ static int Open(vlc_object_t *p_this)
* 2. gles2 vout failed */
fmtp->projection_mode = PROJECTION_MODE_RECTANGULAR;
+ (void) context;
return OpenCommon(vd, cfg, fmtp);
}
-static int OpenOpaque(vlc_object_t *p_this)
+static int OpenOpaque(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t*)p_this;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
-
if (fmtp->i_chroma != VLC_CODEC_ANDROID_OPAQUE)
return VLC_EGENERIC;
@@ -645,6 +642,7 @@ static int OpenOpaque(vlc_object_t *p_this)
return VLC_EGENERIC;
}
+ (void) context;
return OpenCommon(vd, cfg, fmtp);
}
@@ -690,9 +688,8 @@ end:
}
}
-static void Close(vlc_object_t *p_this)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)p_this;
vout_display_sys_t *sys = vd->sys;
/* Check if SPU regions have been properly cleared, and clear them if they
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index d821d40a5b..8170b2d0de 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -48,8 +48,9 @@
/*****************************************************************************
* Vout interface
*****************************************************************************/
-static int Open (vlc_object_t *);
-static void Close (vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin()
set_description(N_("Core Animation OpenGL Layer (Mac OS X)"))
@@ -110,11 +111,9 @@ struct gl_sys
/*****************************************************************************
* Open: This function allocates and initializes the OpenGL vout method.
*****************************************************************************/
-static int Open (vlc_object_t *p_this)
+static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)p_this;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmt = &vd->fmt;
vout_display_sys_t *sys;
if (cfg->window->type != VOUT_WINDOW_TYPE_NSOBJECT)
@@ -225,14 +224,13 @@ static int Open (vlc_object_t *p_this)
return VLC_SUCCESS;
bailout:
- Close(p_this);
+ Close(vd);
return VLC_EGENERIC;
}
}
-static void Close (vlc_object_t *p_this)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)p_this;
vout_display_sys_t *sys = vd->sys;
if (sys->cgLayer) {
diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index f3da704840..38b7974cbf 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -73,8 +73,9 @@
#define CHROMA_TEXT N_("Image format (default RGB)")
#define CHROMA_LONGTEXT N_("Chroma fourcc used by the framebuffer. Default is RGB since the fb device has no way to report its chroma.")
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin ()
set_shortname("Framebuffer")
@@ -170,11 +171,9 @@ static void ClearScreen(vout_display_sys_t *sys)
/**
* This function allocates and initializes a FB vout method.
*/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
if (vout_display_cfg_IsWindowed(cfg))
@@ -252,7 +251,7 @@ static int Open(vlc_object_t *object)
sys->pool = NULL;
if (OpenDisplay(vd, force_resolution)) {
- Close(VLC_OBJECT(vd));
+ Close(vd);
return VLC_EGENERIC;
}
@@ -284,7 +283,7 @@ static int Open(vlc_object_t *object)
break;
default:
msg_Err(vd, "unknown screendepth %i", sys->var_info.bits_per_pixel);
- Close(VLC_OBJECT(vd));
+ Close(vd);
return VLC_EGENERIC;
}
if (sys->var_info.bits_per_pixel != 8) {
@@ -307,15 +306,15 @@ static int Open(vlc_object_t *object)
vd->display = Display;
vd->control = Control;
+ (void) context;
return VLC_SUCCESS;
}
/**
* Terminate an output method created by Open
*/
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->pool)
diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index 565b88c894..a87d8ed103 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -54,8 +54,9 @@
#define T_HEIGHT N_("Height")
#define LT_HEIGHT N_("Video height")
-static int Open( vlc_object_t * );
-static void Close( vlc_object_t * );
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin ()
set_shortname( N_("Flaschen") )
@@ -87,10 +88,9 @@ static int Control(vout_display_t *, int, va_list);
/*****************************************************************************
* Open: activates flaschen vout display method
*****************************************************************************/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
int fd;
const unsigned port = 1337;
@@ -148,12 +148,12 @@ static int Open(vlc_object_t *object)
vd->display = Display;
vd->control = Control;
+ (void) cfg; (void) context;
return VLC_SUCCESS;
}
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->pool)
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index cfb7840134..45041bfb3a 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -30,11 +30,13 @@
* Preamble
*****************************************************************************/
+#if 0
#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import <QuartzCore/QuartzCore.h>
+#endif
#import <dlfcn.h>
#ifdef HAVE_CONFIG_H
@@ -51,8 +53,9 @@
/**
* Forward declarations
*/
-static int Open(vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context);
+static void Close(vout_display_t *vd);
static picture_pool_t* PicturePool(vout_display_t *, unsigned);
static void PictureRender(vout_display_t *, picture_t *, subpicture_t *, vlc_tick_t);
@@ -142,12 +145,9 @@ static void *OurGetProcAddress(vlc_gl_t *gl, const char *name)
return dlsym(RTLD_DEFAULT, name);
}
-static int Open(vlc_object_t *this)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)this;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmt = &vd->fmt;
-
if (vout_display_cfg_IsWindowed(cfg))
return VLC_EGENERIC;
@@ -179,12 +179,12 @@ static int Open(vlc_object_t *this)
const vlc_fourcc_t *subpicture_chromas;
sys->embed = cfg->window;
- sys->gl = vlc_object_create(this, sizeof(*sys->gl));
+ sys->gl = vlc_object_create(vd, sizeof(*sys->gl));
if (!sys->gl)
goto bailout;
struct gl_sys *glsys = sys->gl->sys =
- vlc_obj_malloc(this, sizeof(struct gl_sys));
+ vlc_obj_malloc(VLC_OBJECT(vd), sizeof(struct gl_sys));
if (unlikely(!sys->gl->sys))
goto bailout;
glsys->glESView = sys->glESView;
@@ -223,21 +223,20 @@ static int Open(vlc_object_t *this)
return VLC_SUCCESS;
bailout:
- Close(this);
+ Close(vd);
return VLC_EGENERIC;
}
}
-static void Close (vlc_object_t *this)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)this;
vout_display_sys_t *sys = vd->sys;
@autoreleasepool {
BOOL flushed = NO;
if (sys->gl != NULL) {
struct gl_sys *glsys = sys->gl->sys;
- msg_Dbg(this, "deleting display");
+ msg_Dbg(vd, "deleting display");
if (likely(glsys->vgl))
{
diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index 80733c576a..1cce937330 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -674,7 +674,10 @@ static void Display(vout_display_t *vd, picture_t *picture)
}
-static void CloseDisplay(vout_display_t *vd)
+/**
+ * Terminate an output method created by Open
+ */
+static void Close(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
@@ -685,26 +688,12 @@ static void CloseDisplay(vout_display_t *vd)
drmDropMaster(sys->drm_fd);
}
-
-/**
- * Terminate an output method created by Open
- */
-static void Close(vlc_object_t *object)
-{
- vout_display_t *vd = (vout_display_t *)object;
-
- CloseDisplay(vd);
-}
-
-
/**
* This function allocates and initializes a KMS vout method.
*/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
vlc_fourcc_t local_vlc_chroma;
uint32_t local_drm_chroma;
@@ -717,7 +706,7 @@ static int Open(vlc_object_t *object)
/*
* Allocate instance and initialize some members
*/
- vd->sys = sys = vlc_obj_calloc(object, 1, sizeof(*sys));
+ vd->sys = sys = vlc_obj_calloc(VLC_OBJECT(vd), 1, sizeof(*sys));
if (!sys)
return VLC_ENOMEM;
@@ -758,7 +747,7 @@ static int Open(vlc_object_t *object)
}
if (OpenDisplay(vd) != VLC_SUCCESS) {
- Close(VLC_OBJECT(vd));
+ Close(vd);
return VLC_EGENERIC;
}
@@ -775,6 +764,7 @@ static int Open(vlc_object_t *object)
vd->control = Control;
vout_window_ReportSize(cfg->window, sys->width, sys->height);
+ (void) context;
return VLC_SUCCESS;
}
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index cf20a200a0..59cde2eb43 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -43,7 +43,8 @@
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-static int Open ( vlc_object_t * );
+static int Open ( vout_display_t *, const vout_display_cfg_t *,
+ video_format_t *, vlc_video_context * );
static void Close( vlc_object_t * );
#define KVA_FIXT23_TEXT N_( \
@@ -142,12 +143,20 @@ static MRESULT EXPENTRY WndProc ( HWND, ULONG, MPARAM, MPARAM );
static const char *psz_video_mode[ 4 ] = {"DIVE", "WarpOverlay!", "SNAP",
"VMAN"};
+struct open_init
+{
+ vout_display_t *vd;
+ const vout_display_cfg_t *cfg;
+ video_format_t *fmtp;
+};
+
static void PMThread( void *arg )
{
- vout_display_t *vd = ( vout_display_t * )arg;
+ struct open_init *init = ( struct open_init * )arg;
+ vout_display_t *vd = init->vd;
vout_display_sys_t * sys = vd->sys;
- const vout_display_cfg_t * cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
+ const vout_display_cfg_t * cfg = init->cfg;
+ video_format_t *fmtp = init->fmtp;
ULONG i_frame_flags;
QMSG qm;
char *psz_mode;
@@ -317,10 +326,16 @@ exit_frame :
/**
* This function initializes KVA vout method.
*/
-static int Open ( vlc_object_t *object )
+static int Open ( vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context )
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ struct open_init init = {
+ .vd = vd,
+ .cfg = cfg,
+ .fmtp = fmtp,
+ };
+ VLC_UNUSED(context);
vd->sys = sys = calloc( 1, sizeof( *sys ));
if( !sys )
@@ -328,7 +343,7 @@ static int Open ( vlc_object_t *object )
DosCreateEventSem( NULL, &sys->ack_event, 0, FALSE );
- sys->tid = _beginthread( PMThread, NULL, 1024 * 1024, vd );
+ sys->tid = _beginthread( PMThread, NULL, 1024 * 1024, &init );
DosWaitEventSem( sys->ack_event, SEM_INDEFINITE_WAIT );
if( sys->i_result != VLC_SUCCESS )
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 7ead67d722..f33e823391 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -52,8 +52,9 @@
/**
* Forward declarations
*/
-static int Open (vlc_object_t *);
-static void Close (vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context);
+static void Close(vout_display_t *vd);
static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count);
static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *subpicture,
@@ -130,11 +131,9 @@ static void *OurGetProcAddress(vlc_gl_t *gl, const char *name)
return dlsym(RTLD_DEFAULT, name);
}
-static int Open (vlc_object_t *this)
+static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)this;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmt = &vd->fmt;
vout_display_sys_t *sys = calloc (1, sizeof(*sys));
if (cfg->window->type != VOUT_WINDOW_TYPE_NSOBJECT)
@@ -146,7 +145,7 @@ static int Open (vlc_object_t *this)
@autoreleasepool {
if (!CGDisplayUsesOpenGLAcceleration (kCGDirectMainDisplay))
- msg_Err (this, "no OpenGL hardware acceleration found. this can lead to slow output and unexpected results");
+ msg_Err (vd, "no OpenGL hardware acceleration found. this can lead to slow output and unexpected results");
vd->sys = sys;
sys->pool = NULL;
@@ -204,7 +203,7 @@ static int Open (vlc_object_t *this)
}
/* Initialize common OpenGL video display */
- sys->gl = vlc_object_create(this, sizeof(*sys->gl));
+ sys->gl = vlc_object_create(vd, sizeof(*sys->gl));
if( unlikely( !sys->gl ) )
goto error;
@@ -256,17 +255,17 @@ static int Open (vlc_object_t *this)
/* */
vout_window_ReportSize(sys->embed, fmt->i_visible_width, fmt->i_visible_height);
+ (void) context;
return VLC_SUCCESS;
error:
- Close(this);
+ Close(vd);
return VLC_EGENERIC;
}
}
-void Close (vlc_object_t *this)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)this;
vout_display_sys_t *sys = vd->sys;
@autoreleasepool {
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 7ba6e61bf3..7cc3c94b48 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -34,8 +34,9 @@
#include "vout_helper.h"
/* Plugin callbacks */
-static int Open (vlc_object_t *);
-static void Close (vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
#define GL_TEXT N_("OpenGL extension")
#define GLES2_TEXT N_("OpenGL ES 2 extension")
@@ -85,11 +86,9 @@ static int Control (vout_display_t *, int, va_list);
/**
* Allocates a surface and an OpenGL context for video output.
*/
-static int Open (vlc_object_t *obj)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)obj;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmt = &vd->fmt;
vout_display_sys_t *sys = malloc (sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
@@ -160,14 +159,14 @@ error:
vlc_gl_Release (sys->gl);
free (sys);
return VLC_EGENERIC;
+ (void) context;
}
/**
* Destroys the OpenGL context.
*/
-static void Close (vlc_object_t *obj)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys;
vlc_gl_t *gl = sys->gl;
diff --git a/modules/video_output/vdummy.c b/modules/video_output/vdummy.c
index deef545f89..0d54b775aa 100644
--- a/modules/video_output/vdummy.c
+++ b/modules/video_output/vdummy.c
@@ -39,9 +39,11 @@
"format instead of trying to improve performances by using the most " \
"efficient one.")
-static int OpenDummy( vlc_object_t * );
-static int OpenStats( vlc_object_t * );
-static void Close( vlc_object_t * );
+static int OpenDummy(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static int OpenStats(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin ()
set_shortname( N_("Dummy") )
@@ -75,11 +77,9 @@ static int Control(vout_display_t *, int, va_list);
/*****************************************************************************
* OpenVideo: activates dummy vout display method
*****************************************************************************/
-static int Open(vlc_object_t *object,
+static int Open(vout_display_t *vd, video_format_t *fmt,
void (*display)(vout_display_t *, picture_t *))
{
- vout_display_t *vd = (vout_display_t *)object;
- video_format_t *fmt = &vd->fmt;
vout_display_sys_t *sys;
vd->sys = sys = calloc(1, sizeof(*sys));
@@ -106,19 +106,22 @@ static int Open(vlc_object_t *object,
return VLC_SUCCESS;
}
-static int OpenDummy(vlc_object_t *object)
+static int OpenDummy(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- return Open(object, NULL);
+ (void) cfg; (void) context;
+ return Open(vd, fmtp, NULL);
}
-static int OpenStats(vlc_object_t *object)
+static int OpenStats(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- return Open(object, DisplayStat);
+ (void) cfg; (void) context;
+ return Open(vd, fmtp, DisplayStat);
}
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->pool)
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 5fc337f5c7..9edfab51eb 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -52,8 +52,9 @@
#define LT_CHROMA N_("Output chroma for the memory image as a 4-character " \
"string, eg. \"RV32\".")
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin()
set_description(N_("Video memory output"))
@@ -114,10 +115,9 @@ static int Control(vout_display_t *, int, va_list);
*****************************************************************************
* This function allocates and initializes a vout method.
*****************************************************************************/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys = malloc(sizeof(*sys));
if (unlikely(!sys))
return VLC_ENOMEM;
@@ -218,12 +218,12 @@ static int Open(vlc_object_t *object)
vd->display = Display;
vd->control = Control;
+ (void) cfg; (void) context;
return VLC_SUCCESS;
}
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->cleanup)
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index bc92ef0578..6be194e59b 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -91,11 +91,11 @@ static void PollBuffers(vout_display_t *);
static void UpdateParams(vout_display_t *);
// Allocates a Vulkan surface and instance for video output.
-static int Open(vlc_object_t *obj)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmt, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *) obj;
- video_format_t *fmt = &vd->fmt;
- vout_display_sys_t *sys = vd->sys = vlc_obj_calloc(obj, 1, sizeof (*sys));
+ vout_display_sys_t *sys = vd->sys =
+ vlc_obj_calloc(VLC_OBJECT(vd), 1, sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
@@ -158,6 +158,7 @@ static int Open(vlc_object_t *obj)
vd->control = Control;
UpdateParams(vd);
+ (void) cfg; (void) context;
return VLC_SUCCESS;
error:
@@ -167,9 +168,8 @@ error:
return VLC_EGENERIC;
}
-static void Close(vlc_object_t *obj)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys;
const struct pl_gpu *gpu = sys->vk->vulkan->gpu;
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 648219f5f4..1964d47c77 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -396,12 +396,9 @@ static const struct wl_registry_listener registry_cbs =
registry_global_remove_cb,
};
-static int Open(vlc_object_t *obj)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)obj;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
-
if (cfg->window->type != VOUT_WINDOW_TYPE_WAYLAND)
return VLC_EGENERIC;
@@ -484,6 +481,7 @@ static int Open(vlc_object_t *obj)
vd->display = Display;
vd->control = Control;
+ (void) context;
return VLC_SUCCESS;
error:
@@ -493,9 +491,8 @@ error:
return VLC_EGENERIC;
}
-static void Close(vlc_object_t *obj)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys;
ResetPictures(vd);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index d0e1462ca3..ad5235a76b 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -58,8 +58,9 @@
DEFINE_GUID(GUID_SWAPCHAIN_WIDTH, 0xf1b59347, 0x1643, 0x411a, 0xad, 0x6b, 0xc7, 0x80, 0x17, 0x7a, 0x06, 0xb6);
DEFINE_GUID(GUID_SWAPCHAIN_HEIGHT, 0x6ea976a0, 0x9d60, 0x4bb7, 0xa5, 0xa9, 0x7d, 0xd1, 0x18, 0x7f, 0xc9, 0xbd);
-static int Open(vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *, const vout_display_cfg_t *,
+ video_format_t *, vlc_video_context *);
+static void Close(vout_display_t *);
#define D3D11_HELP N_("Recommended video output for Windows 8 and later versions")
#define HW_BLENDING_TEXT N_("Use hardware blending support")
@@ -338,12 +339,9 @@ static unsigned int GetPictureHeight(const vout_display_t *vd)
return vd->sys->picQuad.i_height;
}
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
-
#if !VLC_WINSTORE_APP
/* Allow using D3D11 automatically starting from Windows 8.1 */
if (!vd->obj.force)
@@ -357,7 +355,7 @@ static int Open(vlc_object_t *object)
}
#endif
- vout_display_sys_t *sys = vd->sys = vlc_obj_calloc(object, 1, sizeof(vout_display_sys_t));
+ vout_display_sys_t *sys = vd->sys = vlc_obj_calloc(vd, 1, sizeof(vout_display_sys_t));
if (!sys)
return VLC_ENOMEM;
@@ -414,14 +412,12 @@ static int Open(vlc_object_t *object)
return VLC_SUCCESS;
error:
- Close(object);
+ Close(vd);
return VLC_EGENERIC;
}
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t * vd = (vout_display_t *)object;
-
Direct3D11Close(vd);
CommonClean(vd);
Direct3D11Destroy(vd);
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index e7e6df78f5..b6525d8a95 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -60,8 +60,9 @@
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-static int Open(vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *, const vout_display_cfg_t *,
+ video_format_t *, vlc_video_context *);
+static void Close(vout_display_t *);
static int GLConvOpen(vlc_object_t *);
static void GLConvClose(vlc_object_t *);
@@ -1641,12 +1642,10 @@ static int FindShadersCallback(const char *name, char ***values, char ***descs)
/**
* It creates a Direct3D vout display.
*/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
if ( !vd->obj.force && vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
return VLC_EGENERIC; /* let a module who can handle it do it */
@@ -1678,7 +1677,7 @@ static int Open(vlc_object_t *object)
sys->hxdll = Direct3D9LoadShaderLibrary();
if (!sys->hxdll)
- msg_Warn(object, "cannot load Direct3D9 Shader Library; HLSL pixel shading will be disabled.");
+ msg_Warn(vd, "cannot load Direct3D9 Shader Library; HLSL pixel shading will be disabled.");
sys->sys.use_desktop = var_CreateGetBool(vd, "video-wallpaper");
sys->reset_device = false;
@@ -1752,10 +1751,8 @@ error:
/**
* It destroyes a Direct3D vout display.
*/
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t * vd = (vout_display_t *)object;
-
var_DelCallback(vd, "video-wallpaper", DesktopCallback, NULL);
vlc_mutex_destroy(&vd->sys->lock);
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index 091e2a580c..b87b91cb91 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -93,8 +93,9 @@
#define DX_HELP N_("Recommended video output for Windows XP. " \
"Incompatible with Vista's Aero interface" )
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open (vout_display_t *, const vout_display_cfg_t *,
+ video_format_t *, vlc_video_context *);
+static void Close(vout_display_t *);
static int FindDevicesCallback(const char *, char ***, char ***);
@@ -184,11 +185,9 @@ static void WallpaperChange(vout_display_t *vd, bool use_wallpaper);
/** This function allocates and initialize the DirectX vout display.
*/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
/* Allocate structure */
@@ -258,9 +257,8 @@ error:
/** Terminate a vout display created by Open.
*/
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
var_DelCallback(vd, "video-wallpaper", WallpaperCallback, NULL);
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 43eca43c7f..c3a074783d 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -42,8 +42,9 @@
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open (vout_display_t *, const vout_display_cfg_t *,
+ video_format_t *, vlc_video_context *);
+static void Close(vout_display_t *);
vlc_module_begin()
set_category(CAT_VIDEO)
@@ -109,15 +110,13 @@ static vout_window_t *EmbedVideoWindow_Create(vout_display_t *vd)
/**
* It creates an OpenGL vout display.
*/
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
/* do not use OpenGL on XP unless forced */
- if(!object->obj.force && !IsWindowsVistaOrGreater())
+ if(!vd->obj.force && !IsWindowsVistaOrGreater())
return VLC_EGENERIC;
/* Allocate structure */
@@ -173,16 +172,15 @@ static int Open(vlc_object_t *object)
return VLC_SUCCESS;
error:
- Close(object);
+ Close(vd);
return VLC_EGENERIC;
}
/**
* It destroys an OpenGL vout display.
*/
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
vlc_gl_t *gl = sys->gl;
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 611e7201c9..073ab11c4f 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -42,8 +42,9 @@
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open (vout_display_t *, const vout_display_cfg_t *,
+ video_format_t *, vlc_video_context *);
+static void Close(vout_display_t *);
vlc_module_begin ()
set_category(CAT_VIDEO)
@@ -85,11 +86,9 @@ static int Init(vout_display_t *, video_format_t *);
static void Clean(vout_display_t *);
/* */
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
if ( !vd->obj.force && vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
@@ -121,15 +120,13 @@ static int Open(vlc_object_t *object)
return VLC_SUCCESS;
error:
- Close(VLC_OBJECT(vd));
+ Close(vd);
return VLC_EGENERIC;
}
/* */
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
-
Clean(vd);
CommonClean(vd);
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index c49758bad8..4260468443 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -38,8 +38,9 @@
#include "pictures.h"
#include "events.h"
-static int Open (vlc_object_t *);
-static void Close (vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
/*
* Module descriptor
@@ -101,11 +102,9 @@ static const xcb_depth_t *FindDepth (const xcb_screen_t *scr,
/**
* Probe the X server.
*/
-static int Open (vlc_object_t *obj)
+static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)obj;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys = malloc (sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
@@ -228,7 +227,7 @@ static int Open (vlc_object_t *obj)
}
}
- msg_Err (obj, "no supported pixel format & visual");
+ msg_Err (vd, "no supported pixel format & visual");
goto error;
found_format:;
@@ -289,7 +288,7 @@ found_format:;
msg_Dbg (vd, "using X11 graphic context %08"PRIx32, sys->gc);
sys->visible = false;
- if (XCB_shm_Check (obj, conn))
+ if (XCB_shm_Check (VLC_OBJECT(vd), conn))
{
sys->seg_base = xcb_generate_id (conn);
for (unsigned i = 1; i < MAX_PICTURES; i++)
@@ -309,10 +308,11 @@ found_format:;
vd->display = Display;
vd->control = Control;
+ (void) context;
return VLC_SUCCESS;
error:
- Close (obj);
+ Close (vd);
return VLC_EGENERIC;
}
@@ -320,9 +320,8 @@ error:
/**
* Disconnect from the X server.
*/
-static void Close (vlc_object_t *obj)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys;
ResetPictures (vd);
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 4e220c8f0d..6753f5247f 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -51,8 +51,9 @@
"XVideo image format id to use. By default, VLC will " \
"try to use the best match for the video being played.")
-static int Open (vlc_object_t *);
-static void Close (vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
static int EnumAdaptors(const char *, int64_t **, char ***);
/*
@@ -346,11 +347,10 @@ FindFormat (vlc_object_t *obj, xcb_connection_t *conn, video_format_t *fmt,
/**
* Probe the X server.
*/
-static int Open (vlc_object_t *obj)
+static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)obj;
- const vout_display_cfg_t *cfg = vd->cfg;
- video_format_t *fmtp = &vd->fmt;
+ vlc_object_t *obj = VLC_OBJECT(vd);
vout_display_sys_t *p_sys;
{ /* NOTE: Reject hardware surface formats. Blending would break. */
@@ -563,10 +563,11 @@ static int Open (vlc_object_t *obj)
vd->display = Display;
vd->control = Control;
+ (void) context;
return VLC_SUCCESS;
error:
- Close (obj);
+ Close (vd);
return VLC_EGENERIC;
}
@@ -574,9 +575,8 @@ error:
/**
* Disconnect from the X server.
*/
-static void Close (vlc_object_t *obj)
+static void Close (vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *p_sys = vd->sys;
if (p_sys->pool)
diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index d5dbd93201..52b337581a 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -51,8 +51,9 @@
#define CFG_PREFIX "yuv-"
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context);
+static void Close(vout_display_t *vd);
vlc_module_begin()
set_shortname(N_("YUV output"))
@@ -92,10 +93,9 @@ struct vout_display_sys_t {
};
/* */
-static int Open(vlc_object_t *object)
+static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
+ video_format_t *fmtp, vlc_video_context *context)
{
- vout_display_t *vd = (vout_display_t *)object;
- video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
/* Allocate instance and initialize some members */
@@ -161,13 +161,13 @@ static int Open(vlc_object_t *object)
vd->display = Display;
vd->control = Control;
+ (void) cfg; (void) context;
return VLC_SUCCESS;
}
/* */
-static void Close(vlc_object_t *object)
+static void Close(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->pool)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 021e232c2b..ec6d0a0134 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -71,10 +71,18 @@ static picture_t *VideoBufferNew(filter_t *filter)
static int vout_display_start(void *func, va_list ap)
{
- int (*activate)(vlc_object_t *) = func;
+ vout_display_open_cb activate = func;
vout_display_t *vd = va_arg(ap, vout_display_t *);
+ const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
+ video_format_t *fmtp = va_arg(ap, video_format_t *);
+ vlc_video_context *context = va_arg(ap, vlc_video_context *);
- return activate(VLC_OBJECT(vd));
+ video_format_Clean(fmtp);
+ video_format_Copy(fmtp, &vd->source);
+ fmtp->i_sar_num = 0;
+ fmtp->i_sar_den = 0;
+
+ return activate(vd, cfg, fmtp, context);
}
/**
@@ -91,11 +99,9 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
/* */
video_format_Copy(&vd->source, fmt);
+ video_format_Init(&vd->fmt, 0);
/* Picture buffer does not have the concept of aspect ratio */
- video_format_Copy(&vd->fmt, fmt);
- vd->fmt.i_sar_num = 0;
- vd->fmt.i_sar_den = 0;
vd->info.is_slow = false;
vd->info.has_double_click = false;
@@ -112,7 +118,10 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
vd->owner = *owner;
if (load_module) {
- vd->module = vlc_module_load(vd, "vout display", module, module && *module != '\0', vout_display_start, vd);
+ vd->module = vlc_module_load(vd, "vout display", module,
+ module && *module != '\0',
+ vout_display_start, vd, cfg, &vd->fmt,
+ NULL);
if (!vd->module) {
vlc_object_release(vd);
return NULL;
@@ -129,10 +138,9 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
static void vout_display_stop(void *func, va_list ap)
{
- void (*deactivate)(vlc_object_t *) = func;
- vout_display_t *vd = va_arg(ap, vout_display_t *);
+ vout_display_close_cb deactivate = func;
- deactivate(VLC_OBJECT(vd));
+ deactivate(va_arg(ap, vout_display_t *));
}
/**
More information about the vlc-commits
mailing list