Commit 82108a21 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout_window_t: privatize module pointer

parent dc873d6a
...@@ -78,9 +78,6 @@ typedef struct { ...@@ -78,9 +78,6 @@ typedef struct {
struct vout_window_t { struct vout_window_t {
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
/* Module */
module_t *module;
/* Initial state (reserved). /* Initial state (reserved).
* Once the open function is called, it will be set to NULL * Once the open function is called, it will be set to NULL
*/ */
......
...@@ -33,13 +33,20 @@ ...@@ -33,13 +33,20 @@
#include <vlc_vout_window.h> #include <vlc_vout_window.h>
#include <libvlc.h> #include <libvlc.h>
typedef struct
{
vout_window_t wnd;
module_t *module;
} window_t;
vout_window_t *vout_window_New(vlc_object_t *obj, vout_window_t *vout_window_New(vlc_object_t *obj,
const char *module, const char *module,
const vout_window_cfg_t *cfg) const vout_window_cfg_t *cfg)
{ {
static char const name[] = "window"; static char const name[] = "window";
vout_window_t *window = vlc_custom_create(obj, sizeof(*window), window_t *w = vlc_custom_create(obj, sizeof(*w), VLC_OBJECT_GENERIC, name);
VLC_OBJECT_GENERIC, name); vout_window_t *window = &w->wnd;
window->cfg = cfg; window->cfg = cfg;
memset(&window->handle, 0, sizeof(window->handle)); memset(&window->handle, 0, sizeof(window->handle));
window->control = NULL; window->control = NULL;
...@@ -59,9 +66,8 @@ vout_window_t *vout_window_New(vlc_object_t *obj, ...@@ -59,9 +66,8 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
assert(0); assert(0);
} }
window->module = module_need(window, type, w->module = module_need(window, type, module, module && *module != '\0');
module, module && *module != '\0'); if (!w->module) {
if (!window->module) {
vlc_object_detach(window); vlc_object_detach(window);
vlc_object_release(window); vlc_object_release(window);
return NULL; return NULL;
...@@ -74,9 +80,10 @@ void vout_window_Delete(vout_window_t *window) ...@@ -74,9 +80,10 @@ void vout_window_Delete(vout_window_t *window)
if (!window) if (!window)
return; return;
window_t *w = (window_t *)window;
vlc_object_detach(window); vlc_object_detach(window);
module_unneed(window, window->module); module_unneed(window, w->module);
vlc_object_release(window); vlc_object_release(window);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment