[vlc-commits] vout: add window owner structure and resize event
Rémi Denis-Courmont
git at videolan.org
Thu Oct 16 19:26:01 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct 12 11:12:40 2014 +0300| [e9a3dca66588a2daf41c2061c835b4f32513ead5] | committer: Rémi Denis-Courmont
vout: add window owner structure and resize event
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e9a3dca66588a2daf41c2061c835b4f32513ead5
---
include/vlc_vout_window.h | 16 +++++++++++++++-
src/video_output/display.c | 5 +++--
src/video_output/video_output.c | 3 ++-
src/video_output/window.c | 11 ++++++++---
4 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index 48bcc339..e9595c7 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -80,6 +80,11 @@ typedef struct {
} vout_window_cfg_t;
+typedef struct vout_window_owner {
+ void *sys;
+ void (*resized)(vout_window_t *, unsigned width, unsigned height);
+} vout_window_owner_t;
+
/**
* FIXME do we need an event system in the window too ?
* or the window user will take care of it ?
@@ -118,6 +123,8 @@ struct vout_window_t {
* A module is free to use it as it wishes.
*/
vout_window_sys_t *sys;
+
+ vout_window_owner_t owner;
};
/**
@@ -128,7 +135,7 @@ struct vout_window_t {
/ vout_display_NewWindow() and vout_display_DeleteWindow() instead.
* This enables recycling windows.
*/
-VLC_API vout_window_t * vout_window_New(vlc_object_t *, const char *module, const vout_window_cfg_t *);
+VLC_API vout_window_t * vout_window_New(vlc_object_t *, const char *module, const vout_window_cfg_t *, const vout_window_owner_t *);
/**
* Deletes a window created by vout_window_New().
@@ -186,4 +193,11 @@ static inline int vout_window_SetFullScreen(vout_window_t *window, bool full)
return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full);
}
+static inline void vout_window_ReportSize(vout_window_t *window,
+ unsigned width, unsigned height)
+{
+ if (window->owner.resized != NULL)
+ window->owner.resized(window, width, height);
+}
+
#endif /* VLC_VOUT_WINDOW_H */
diff --git a/src/video_output/display.c b/src/video_output/display.c
index cdd3b91..38a5b46 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -746,7 +746,8 @@ static vout_window_t *VoutDisplayNewWindow(vout_display_t *vd, const vout_window
if (!var_InheritBool(osys->vout, "embedded-video"))
cfg_override.is_standalone = true;
- return vout_window_New(VLC_OBJECT(osys->vout), "$window", &cfg_override);
+ return vout_window_New(VLC_OBJECT(osys->vout), "$window",
+ &cfg_override, NULL);
}
#endif
return vout_NewDisplayWindow(osys->vout, cfg);
@@ -1445,7 +1446,7 @@ static vout_window_t *SplitterNewWindow(vout_display_t *vd, const vout_window_cf
vout_window_cfg_t cfg = *cfg_ptr;
cfg.is_standalone = true;
- return vout_window_New(VLC_OBJECT(osys->vout), "$window", &cfg);
+ return vout_window_New(VLC_OBJECT(osys->vout), "$window", &cfg, NULL);
}
static void SplitterDelWindow(vout_display_t *vd, vout_window_t *window)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 77dcdff..730ce88 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -173,7 +173,8 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
.height = cfg->fmt->i_visible_height,
};
- vout->p->window = vout_window_New(VLC_OBJECT(vout), "$window", &wcfg);
+ vout->p->window = vout_window_New(VLC_OBJECT(vout), "$window", &wcfg,
+ NULL);
} else
vout->p->window = NULL;
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 9c6902b..841e046 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -51,9 +51,9 @@ static int vout_window_start(void *func, va_list ap)
return activate(wnd, cfg);
}
-vout_window_t *vout_window_New(vlc_object_t *obj,
- const char *module,
- const vout_window_cfg_t *cfg)
+vout_window_t *vout_window_New(vlc_object_t *obj, const char *module,
+ const vout_window_cfg_t *cfg,
+ const vout_window_owner_t *owner)
{
window_t *w = vlc_custom_create(obj, sizeof(*w), "window");
vout_window_t *window = &w->wnd;
@@ -62,6 +62,11 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
window->control = NULL;
window->sys = NULL;
+ if (owner != NULL)
+ window->owner = *owner;
+ else
+ window->owner.resized = NULL;
+
w->module = vlc_module_load(window, "vout window", module,
module && *module,
vout_window_start, window, cfg);
More information about the vlc-commits
mailing list