--- /dev/null
+/*****************************************************************************
+ * vlc_vout_window.h: vout_window_t definitions
+ *****************************************************************************
+ * Copyright (C) 2008 Rémi Denis-Courmont
+ * Copyright (C) 2009 Laurent Aimar
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_VOUT_WINDOW_H
+#define VLC_VOUT_WINDOW_H 1
+
+/**
+ * \file
+ * This file defines vout windows structures and functions in vlc
+ */
+
+#include <vlc_common.h>
+
+/* */
+typedef struct vout_window_t vout_window_t;
+typedef struct vout_window_sys_t vout_window_sys_t;
+
+
+/**
+ * Window handle type
+ */
+enum {
+ VOUT_WINDOW_TYPE_XWINDOW,
+ VOUT_WINDOW_TYPE_HWND,
+};
+
+/**
+ * Control query for vout_window_t
+ */
+enum {
+ VOUT_WINDOW_SET_ON_TOP, /* int b_on_top */
+ VOUT_WINDOW_SET_SIZE, /* int i_width, int i_height */
+};
+
+typedef struct {
+ /* If true, a standalone window is requested */
+ bool is_standalone;
+
+ /* Window handle type */
+ int type;
+
+ /* Window position hint */
+ int x;
+ int y;
+
+ /* Windows size int */
+ int width;
+ int height;
+
+} vout_window_cfg_t;
+
+/**
+ * FIXME do we need an event system in the window too ?
+ * or the window user will take care of it ?
+ */
+struct vout_window_t {
+ VLC_COMMON_MEMBERS
+
+ /* Module */
+ module_t *module;
+
+ /* Initial state (reserved).
+ * Once the open function is called, it will be set to NULL
+ */
+ const vout_window_cfg_t *cfg;
+
+ /* window handle (mandatory)
+ *
+ * It must be filled in the open function.
+ */
+ union {
+ void *hwnd; /* Win32 window handle */
+ uint32_t xid; /* X11 windows ID */
+ } handle;
+
+ /* Control on the module (mandatory)
+ *
+ * Do not use it directly but use vout_window_Control.
+ */
+ int (*control)(vout_window_t *, int query, va_list);
+
+ /* Private place holder for the vout_window_t module (optional)
+ *
+ * A module is free to used it as it wishes.
+ */
+ vout_window_sys_t *sys;
+};
+
+/**
+ * It creates a new window.
+ *
+ * XXX If you are inside a "vout display", you must use
+ * vout_display_New/DeleteWindow when possible to allow window recycling.
+ */
+VLC_EXPORT( vout_window_t *, vout_window_New, (vlc_object_t *, const char *module, const vout_window_cfg_t *) );
+
+/**
+ * It deletes a window created by vout_window_New.
+ *
+ * XXX See vout_window_New about window recycling.
+ */
+VLC_EXPORT( void, vout_window_Delete, (vout_window_t *) );
+
+/**
+ * It allows configuring a window.
+ *
+ * XXX you must own the windows, and vout_window_t are not thread safe.
+ * You must not use it directly but prefer the vout_window_* wrappers.
+ */
+VLC_EXPORT( int, vout_window_Control, (vout_window_t *, int query, ...) );
+
+/**
+ * Configure the "On Top" properties of a windows.
+ */
+static inline int vout_window_SetOnTop(vout_window_t *window, bool is_on_top)
+{
+ return vout_window_Control(window, VOUT_WINDOW_SET_ON_TOP, is_on_top);
+}
+
+/**
+ * Configure the windows display size.
+ */
+static inline int vout_window_SetSize(vout_window_t *window, int width, int height)
+{
+ return vout_window_Control(window, VOUT_WINDOW_SET_SIZE, width, height);
+}
+
+#endif /* VLC_VOUT_WINDOW_H */
+
+++ /dev/null
-/*****************************************************************************
- * vlc_window.h: Embedded video output window
- *****************************************************************************
- * Copyright (C) 2008 Rémi Denis-Courmont
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLCCORE_WINDOW_H
-# define LIBVLCCORE_WINDOW_H 1
-
-/**
- * \file
- * This file defines functions and structures for output windows
- */
-
-# include <stdarg.h>
-
-typedef struct vout_window_t vout_window_t;
-typedef struct vout_window_sys_t vout_window_sys_t;
-
-struct vout_window_t
-{
- VLC_COMMON_MEMBERS
-
- module_t *module;
- vout_thread_t *vout;
- union
- {
- void *hwnd; /* Win32 window handle */
- uint32_t xid; /* X11 window ID */
- } handle;
- vout_window_sys_t *p_sys; /* window provider private data */
-
- unsigned width; /* pixels width */
- unsigned height; /* pixels height */
- int pos_x; /* horizontal position hint */
- int pos_y; /* vertical position hint */
-
- int (*control) (struct vout_window_t *, int, va_list);
-};
-
-VLC_EXPORT( vout_window_t *, vout_RequestWindow, ( vout_thread_t *, const char *, int *, int *, unsigned int *, unsigned int * ) );
-VLC_EXPORT( void, vout_ReleaseWindow, ( vout_window_t * ) );
-VLC_EXPORT( int, vout_ControlWindow, ( vout_window_t *, int, va_list ) );
-
-static inline vout_window_t *
-vout_RequestXWindow (vout_thread_t *vout,
- int *x, int *y, unsigned *w, unsigned *h)
-{
- return vout_RequestWindow (vout, "xwindow", x, y, w, h);
-}
-
-static inline vout_window_t *
-vout_RequestHWND (vout_thread_t *vout,
- int *x, int *y, unsigned *w, unsigned *h)
-{
- return vout_RequestWindow (vout, "hwnd", x, y, w, h);
-}
-
-#endif /* !LIBVLCCORE_WINDOW_H */
../include/vlc_vlm.h \
../include/vlc_video_splitter.h \
../include/vlc_vout.h \
- ../include/vlc_window.h \
+ ../include/vlc_vout_window.h \
../include/vlc_xml.h \
$(NULL)
video_output/video_text.c \
video_output/video_widgets.c \
video_output/vout_subpictures.c \
+ video_output/window.c \
video_output/vout_intf.c \
video_output/vout_internal.h \
video_output/vout_control.h \
__vout_AllocatePicture
vout_ChromaCmp
vout_Close
-vout_ControlWindow
__vout_Create
vout_CreatePicture
vout_DestroyPicture
__vout_OSDMessage
vout_OSDSlider
vout_PlacePicture
-vout_ReleaseWindow
__vout_Request
-vout_RequestWindow
vout_ShowTextAbsolute
vout_ShowTextRelative
vout_UnlinkPicture
+vout_window_New
+vout_window_Control
+vout_window_Delete
__xml_Create
xml_Delete
#include <vlc_playlist.h>
#include <vlc_vout.h>
-#include <vlc_window.h>
#include <vlc_image.h>
#include <vlc_osd.h>
#include <vlc_charset.h>
static int TitlePositionCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
-/**
- * Creates a video output window.
- * On Unix systems, this is an X11 drawable (handle).
- * On Windows, this is a Win32 window (handle).
- * Video output plugins are supposed to called this function and display the
- * video within the resulting window, while in windowed mode.
- *
- * @param p_vout video output thread to create a window for
- * @param psz_cap VLC module capability (window system type)
- * @param pi_x_hint pointer to store the recommended horizontal position [OUT]
- * @param pi_y_hint pointer to store the recommended vertical position [OUT]
- * @param pi_width_hint pointer to store the recommended width [OUT]
- * @param pi_height_hint pointer to store the recommended height [OUT]
- *
- * @return a vout_window_t object, or NULL in case of failure.
- * The window is released with vout_ReleaseWindow().
- */
-vout_window_t *vout_RequestWindow( vout_thread_t *p_vout, const char *psz_cap,
- int *pi_x_hint, int *pi_y_hint,
- unsigned int *pi_width_hint,
- unsigned int *pi_height_hint )
-{
- /* Get requested coordinates */
- *pi_x_hint = var_GetInteger( p_vout, "video-x" );
- *pi_y_hint = var_GetInteger( p_vout, "video-y" );
-
- *pi_width_hint = p_vout->i_window_width;
- *pi_height_hint = p_vout->i_window_height;
-
- vout_window_t *wnd = vlc_custom_create (VLC_OBJECT(p_vout), sizeof (*wnd),
- VLC_OBJECT_GENERIC, "window");
- if (wnd == NULL)
- return NULL;
-
- wnd->vout = p_vout;
- wnd->width = *pi_width_hint;
- wnd->height = *pi_height_hint;
- wnd->pos_x = *pi_x_hint;
- wnd->pos_y = *pi_y_hint;
- vlc_object_attach (wnd, p_vout);
-
- wnd->module = module_need (wnd, psz_cap, NULL, false);
- if (wnd->module == NULL)
- {
- msg_Dbg (wnd, "no \"%s\" window provider available", psz_cap);
- vlc_object_release (wnd);
- return NULL;
- }
- *pi_width_hint = wnd->width;
- *pi_height_hint = wnd->height;
- *pi_x_hint = wnd->pos_x;
- *pi_y_hint = wnd->pos_y;
- return wnd;
-}
-
-/**
- * Releases a window handle obtained with vout_RequestWindow().
- * @param p_vout video output thread that allocated the window
- * (if this is NULL; this fnction is a no-op).
- */
-void vout_ReleaseWindow( vout_window_t *wnd )
-{
- if (wnd == NULL)
- return;
-
- assert (wnd->module);
- module_unneed (wnd, wnd->module);
-
- vlc_object_release (wnd);
-}
-
-int vout_ControlWindow( vout_window_t *wnd, int i_query, va_list args )
-{
- if (wnd == NULL)
- return VLC_EGENERIC;
-
- assert (wnd->control);
- return wnd->control (wnd, i_query, args);
-}
-
/*****************************************************************************
* vout_IntfInit: called during the vout creation to initialise misc things.
*****************************************************************************/
--- /dev/null
+/*****************************************************************************
+ * window.c: "vout window" managment
+ *****************************************************************************
+ * Copyright (C) 2009 Laurent Aimar
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <assert.h>
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_vout_window.h>
+
+vout_window_t *vout_window_New(vlc_object_t *obj,
+ const char *module,
+ const vout_window_cfg_t *cfg)
+{
+ vout_window_t *window = vlc_object_create(obj, sizeof(*window));
+
+ window->cfg = cfg;
+ memset(&window->handle, 0, sizeof(window->handle));
+ window->control = NULL;
+ window->sys = NULL;
+
+ vlc_object_attach(window, obj);
+
+ window->module = module_need(window, "vout window",
+ module, module && *module != '\0');
+ if (!window->module) {
+ vlc_object_detach(window);
+ vlc_object_release(window);
+ return NULL;
+ }
+ return window;
+}
+
+void vout_window_Delete(vout_window_t *window)
+{
+ if (!window)
+ return;
+
+ vlc_object_detach(window);
+
+ module_unneed(window, window->module);
+
+ vlc_object_release(window);
+}
+
+int vout_window_Control(vout_window_t *window, int query, ...)
+{
+ va_list args;
+ va_start(args, query);
+ int ret = window->control(window, query, args);
+ va_end(args);
+
+ return ret;
+}
+