2006-09-02 14:28:55 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
2003-10-10 12:47:42 +00:00
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2006-09-02 14:28:55 +00:00
|
|
|
* 2006 Edgard Lima <edgard.lima@indt.org.br>
|
2003-10-10 12:47:42 +00:00
|
|
|
*
|
|
|
|
* gstv4l2xoverlay.c: X-based overlay interface implementation for V4L2
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#include <string.h>
|
2003-10-10 12:47:42 +00:00
|
|
|
#include <gst/gst.h>
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/extensions/Xv.h>
|
|
|
|
#include <X11/extensions/Xvlib.h>
|
|
|
|
#include <sys/stat.h>
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2010-10-02 19:45:14 +00:00
|
|
|
#include <gst/interfaces/navigation.h>
|
|
|
|
|
2003-10-10 12:47:42 +00:00
|
|
|
#include "gstv4l2xoverlay.h"
|
2006-05-11 17:59:59 +00:00
|
|
|
#include "gstv4l2object.h"
|
2003-10-10 12:47:42 +00:00
|
|
|
#include "v4l2_calls.h"
|
|
|
|
|
2010-04-04 11:37:16 +00:00
|
|
|
#include "gst/gst-i18n-plugin.h"
|
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
struct _GstV4l2Xv
|
|
|
|
{
|
|
|
|
Display *dpy;
|
2010-06-10 16:15:46 +00:00
|
|
|
gint port, idle_id, event_id;
|
2010-10-02 19:45:14 +00:00
|
|
|
GMutex *mutex; /* to serialize calls to X11 */
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
};
|
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (v4l2xv_debug);
|
|
|
|
#define GST_CAT_DEFAULT v4l2xv_debug
|
2003-10-10 12:47:42 +00:00
|
|
|
|
|
|
|
void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_xoverlay_interface_init (GstXOverlayClass * klass)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2005-01-10 11:16:13 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (v4l2xv_debug, "v4l2xv", 0,
|
|
|
|
"V4L2 XOverlay interface debugging");
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
static void
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_open (GstV4l2Object * v4l2object)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
struct stat s;
|
|
|
|
GstV4l2Xv *v4l2xv;
|
|
|
|
const gchar *name = g_getenv ("DISPLAY");
|
2006-03-11 22:50:03 +00:00
|
|
|
unsigned int ver, rel, req, ev, err, anum;
|
|
|
|
int i, id = 0, first_id = 0, min;
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
XvAdaptorInfo *ai;
|
|
|
|
Display *dpy;
|
|
|
|
|
|
|
|
/* we need a display, obviously */
|
|
|
|
if (!name || !(dpy = XOpenDisplay (name))) {
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_WARNING_OBJECT (v4l2object->element,
|
2006-05-01 21:37:51 +00:00
|
|
|
"No $DISPLAY set or failed to open - no overlay");
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
/* First let's check that XVideo extension is available */
|
|
|
|
if (!XQueryExtension (dpy, "XVideo", &i, &i, &i)) {
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_WARNING_OBJECT (v4l2object->element,
|
|
|
|
"Xv extension not available - no overlay");
|
2006-03-11 22:50:03 +00:00
|
|
|
XCloseDisplay (dpy);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
/* find port that belongs to this device */
|
|
|
|
if (XvQueryExtension (dpy, &ver, &rel, &req, &ev, &err) != Success) {
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_WARNING_OBJECT (v4l2object->element,
|
|
|
|
"Xv extension not supported - no overlay");
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
XCloseDisplay (dpy);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (XvQueryAdaptors (dpy, DefaultRootWindow (dpy), &anum, &ai) != Success) {
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_WARNING_OBJECT (v4l2object->element, "Failed to query Xv adaptors");
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
XCloseDisplay (dpy);
|
|
|
|
return;
|
|
|
|
}
|
2006-05-11 17:59:59 +00:00
|
|
|
if (fstat (v4l2object->video_fd, &s) < 0) {
|
2006-05-18 19:34:47 +00:00
|
|
|
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
|
Small cleanups.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_set_property_helper),
(gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_set_norm),
(gst_v4l2_get_frequency), (gst_v4l2_set_frequency),
(gst_v4l2_signal_strength), (gst_v4l2_get_attribute),
(gst_v4l2_set_attribute), (gst_v4l2_get_input),
(gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_get_capture),
(gst_v4l2src_set_capture), (gst_v4l2src_capture_init),
(gst_v4l2src_capture_start), (gst_v4l2src_capture_stop),
(gst_v4l2src_buffer_new):
* tests/icles/v4l2src-test.c: (my_bus_callback), (main):
Small cleanups.
Fix error messages.
Use locks when getting timestamps.
Fix leaks in test.
Add licensing header to tests.
2006-09-27 16:14:18 +00:00
|
|
|
(_("Cannot identify device '%s'."), v4l2object->videodev),
|
2006-09-15 19:11:00 +00:00
|
|
|
GST_ERROR_SYSTEM);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
XCloseDisplay (dpy);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
min = s.st_rdev & 0xff;
|
|
|
|
for (i = 0; i < anum; i++) {
|
2010-06-10 16:15:46 +00:00
|
|
|
GST_DEBUG_OBJECT (v4l2object->element, "found adapter: %s", ai[i].name);
|
2010-04-04 11:37:16 +00:00
|
|
|
if (!strcmp (ai[i].name, "video4linux2") ||
|
|
|
|
!strcmp (ai[i].name, "video4linux")) {
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
if (first_id == 0)
|
|
|
|
first_id = ai[i].base_id;
|
|
|
|
|
2010-06-10 16:15:46 +00:00
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"first_id=%d, base_id=%lu, min=%d", first_id, ai[i].base_id, min);
|
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
/* hmm... */
|
|
|
|
if (first_id != 0 && ai[i].base_id == first_id + min)
|
|
|
|
id = ai[i].base_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
XvFreeAdaptorInfo (ai);
|
2003-10-10 12:47:42 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
if (id == 0) {
|
2006-05-18 19:34:47 +00:00
|
|
|
GST_WARNING_OBJECT (v4l2object->element,
|
|
|
|
"Did not find XvPortID for device - no overlay");
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
XCloseDisplay (dpy);
|
|
|
|
return;
|
|
|
|
}
|
2003-10-10 12:47:42 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
v4l2xv = g_new0 (GstV4l2Xv, 1);
|
|
|
|
v4l2xv->dpy = dpy;
|
|
|
|
v4l2xv->port = id;
|
|
|
|
v4l2xv->mutex = g_mutex_new ();
|
|
|
|
v4l2xv->idle_id = 0;
|
2010-06-10 16:15:46 +00:00
|
|
|
v4l2xv->event_id = 0;
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2object->xv = v4l2xv;
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
if (v4l2object->xwindow_id) {
|
2010-09-21 10:49:31 +00:00
|
|
|
gst_v4l2_xoverlay_set_window_handle (v4l2object, v4l2object->xwindow_id);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
}
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
static void
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_close (GstV4l2Object * v4l2object)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2006-05-11 17:59:59 +00:00
|
|
|
GstV4l2Xv *v4l2xv = v4l2object->xv;
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
if (!v4l2object->xv)
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
return;
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
if (v4l2object->xwindow_id) {
|
2010-09-21 10:49:31 +00:00
|
|
|
gst_v4l2_xoverlay_set_window_handle (v4l2object, 0);
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
|
|
|
|
XCloseDisplay (v4l2xv->dpy);
|
|
|
|
g_mutex_free (v4l2xv->mutex);
|
|
|
|
if (v4l2xv->idle_id)
|
|
|
|
g_source_remove (v4l2xv->idle_id);
|
2010-06-10 16:15:46 +00:00
|
|
|
if (v4l2xv->event_id)
|
|
|
|
g_source_remove (v4l2xv->event_id);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
g_free (v4l2xv);
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2object->xv = NULL;
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
void
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_start (GstV4l2Object * v4l2object)
|
2006-03-11 22:50:03 +00:00
|
|
|
{
|
2006-05-11 17:59:59 +00:00
|
|
|
if (v4l2object->xwindow_id) {
|
|
|
|
gst_v4l2_xoverlay_open (v4l2object);
|
2006-03-11 22:50:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_stop (GstV4l2Object * v4l2object)
|
2006-03-11 22:50:03 +00:00
|
|
|
{
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_close (v4l2object);
|
2006-03-11 22:50:03 +00:00
|
|
|
}
|
|
|
|
|
2010-10-02 19:45:14 +00:00
|
|
|
/* should be called with mutex held */
|
|
|
|
static gboolean
|
|
|
|
get_render_rect (GstV4l2Object * v4l2object, GstVideoRectangle *rect)
|
|
|
|
{
|
|
|
|
GstV4l2Xv *v4l2xv = v4l2object->xv;
|
|
|
|
if (v4l2xv && v4l2xv->dpy && v4l2object->xwindow_id) {
|
|
|
|
XWindowAttributes attr;
|
|
|
|
XGetWindowAttributes (v4l2xv->dpy, v4l2object->xwindow_id, &attr);
|
|
|
|
/* this is where we'd add support to maintain aspect ratio */
|
|
|
|
rect->x = 0;
|
|
|
|
rect->y = 0;
|
|
|
|
rect->w = attr.width;
|
|
|
|
rect->h = attr.height;
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_v4l2_xoverlay_get_render_rect (GstV4l2Object *v4l2object,
|
|
|
|
GstVideoRectangle *rect)
|
|
|
|
{
|
|
|
|
GstV4l2Xv *v4l2xv = v4l2object->xv;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
if (v4l2xv) {
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
ret = get_render_rect (v4l2object, rect);
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-06-10 16:15:46 +00:00
|
|
|
static void
|
|
|
|
update_geometry (GstV4l2Object * v4l2object)
|
|
|
|
{
|
|
|
|
GstV4l2Xv *v4l2xv = v4l2object->xv;
|
2010-10-02 19:45:14 +00:00
|
|
|
GstVideoRectangle rect;
|
|
|
|
if (!get_render_rect (v4l2object, &rect))
|
|
|
|
return;
|
|
|
|
/* note: we don't pass in valid video x/y/w/h.. currently the xserver
|
|
|
|
* doesn't need to know these, as they come from v4l2 by setting the
|
|
|
|
* crop..
|
|
|
|
*/
|
2010-06-10 16:15:46 +00:00
|
|
|
XvPutVideo (v4l2xv->dpy, v4l2xv->port, v4l2object->xwindow_id,
|
|
|
|
DefaultGC (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy)),
|
2010-10-02 19:45:14 +00:00
|
|
|
0, 0, rect.w, rect.h, rect.x, rect.y, rect.w, rect.h);
|
2010-06-10 16:15:46 +00:00
|
|
|
}
|
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
static gboolean
|
|
|
|
idle_refresh (gpointer data)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2006-05-19 18:58:05 +00:00
|
|
|
GstV4l2Object *v4l2object = GST_V4L2_OBJECT (data);
|
2006-05-11 17:59:59 +00:00
|
|
|
GstV4l2Xv *v4l2xv = v4l2object->xv;
|
2010-06-10 16:15:46 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (v4l2object->element, "idle refresh");
|
2003-10-10 12:47:42 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
if (v4l2xv) {
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
|
2010-06-10 16:15:46 +00:00
|
|
|
update_geometry (v4l2object);
|
2003-10-10 12:47:42 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
v4l2xv->idle_id = 0;
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
|
|
|
|
/* once */
|
|
|
|
return FALSE;
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2010-06-10 16:15:46 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
event_refresh (gpointer data)
|
|
|
|
{
|
|
|
|
GstV4l2Object *v4l2object = GST_V4L2_OBJECT (data);
|
|
|
|
GstV4l2Xv *v4l2xv = v4l2object->xv;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (v4l2object->element, "event refresh");
|
|
|
|
|
|
|
|
if (v4l2xv) {
|
|
|
|
XEvent e;
|
|
|
|
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
|
2010-10-02 19:45:14 +00:00
|
|
|
/* If the element supports navigation, collect the relavent input
|
|
|
|
* events and push them upstream as navigation events
|
|
|
|
*/
|
|
|
|
if (GST_IS_NAVIGATION (v4l2object->element)) {
|
|
|
|
guint pointer_x = 0, pointer_y = 0;
|
|
|
|
gboolean pointer_moved = FALSE;
|
|
|
|
|
|
|
|
/* We get all pointer motion events, only the last position is
|
|
|
|
* interesting.
|
|
|
|
*/
|
|
|
|
while (XCheckWindowEvent (v4l2xv->dpy, v4l2object->xwindow_id,
|
|
|
|
PointerMotionMask, &e)) {
|
|
|
|
switch (e.type) {
|
|
|
|
case MotionNotify:
|
|
|
|
pointer_x = e.xmotion.x;
|
|
|
|
pointer_y = e.xmotion.y;
|
|
|
|
pointer_moved = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pointer_moved) {
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"pointer moved over window at %d,%d", pointer_x, pointer_y);
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (v4l2object->element),
|
|
|
|
"mouse-move", 0, e.xbutton.x, e.xbutton.y);
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We get all events on our window to throw them upstream
|
|
|
|
*/
|
|
|
|
while (XCheckWindowEvent (v4l2xv->dpy, v4l2object->xwindow_id,
|
|
|
|
KeyPressMask | KeyReleaseMask |
|
|
|
|
ButtonPressMask | ButtonReleaseMask, &e)) {
|
|
|
|
KeySym keysym;
|
|
|
|
const char *key_str = NULL;
|
|
|
|
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
|
|
|
|
|
|
|
switch (e.type) {
|
|
|
|
case ButtonPress:
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"button %d pressed over window at %d,%d",
|
|
|
|
e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
|
|
|
gst_navigation_send_mouse_event (
|
|
|
|
GST_NAVIGATION (v4l2object->element),
|
|
|
|
"mouse-button-press", e.xbutton.button,
|
|
|
|
e.xbutton.x, e.xbutton.y);
|
|
|
|
break;
|
|
|
|
case ButtonRelease:
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"button %d released over window at %d,%d",
|
|
|
|
e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
|
|
|
gst_navigation_send_mouse_event (
|
|
|
|
GST_NAVIGATION (v4l2object->element),
|
|
|
|
"mouse-button-release", e.xbutton.button,
|
|
|
|
e.xbutton.x, e.xbutton.y);
|
|
|
|
break;
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
keysym = XKeycodeToKeysym (v4l2xv->dpy, e.xkey.keycode, 0);
|
|
|
|
if (keysym != NoSymbol) {
|
|
|
|
key_str = XKeysymToString (keysym);
|
|
|
|
} else {
|
|
|
|
key_str = "unknown";
|
|
|
|
}
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"key %d pressed over window at %d,%d (%s)",
|
|
|
|
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
|
|
|
gst_navigation_send_key_event (
|
|
|
|
GST_NAVIGATION (v4l2object->element),
|
|
|
|
e.type == KeyPress ? "key-press" : "key-release", key_str);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"unhandled X event (%d)", e.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-10 16:15:46 +00:00
|
|
|
/* Handle ConfigureNotify */
|
|
|
|
while (XCheckWindowEvent (v4l2xv->dpy, v4l2object->xwindow_id,
|
|
|
|
StructureNotifyMask, &e)) {
|
|
|
|
switch (e.type) {
|
|
|
|
case ConfigureNotify:
|
|
|
|
update_geometry (v4l2object);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* repeat */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-10-09 07:01:19 +00:00
|
|
|
void
|
2010-09-21 10:49:31 +00:00
|
|
|
gst_v4l2_xoverlay_set_window_handle (GstV4l2Object * v4l2object, guintptr id)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2006-03-11 22:50:03 +00:00
|
|
|
GstV4l2Xv *v4l2xv;
|
2010-09-21 10:49:31 +00:00
|
|
|
XID xwindow_id = id;
|
2006-05-11 17:59:59 +00:00
|
|
|
gboolean change = (v4l2object->xwindow_id != xwindow_id);
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_LOG_OBJECT (v4l2object->element, "Setting XID to %lx",
|
|
|
|
(gulong) xwindow_id);
|
2005-01-10 11:16:13 +00:00
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
if (!v4l2object->xv && GST_V4L2_IS_OPEN (v4l2object))
|
|
|
|
gst_v4l2_xoverlay_open (v4l2object);
|
2006-03-11 22:50:03 +00:00
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2xv = v4l2object->xv;
|
2006-03-11 22:50:03 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
if (v4l2xv)
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
|
|
|
|
if (change) {
|
2006-05-11 17:59:59 +00:00
|
|
|
if (v4l2object->xwindow_id && v4l2xv) {
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element,
|
|
|
|
"Deactivating old port %lx", v4l2object->xwindow_id);
|
2005-01-10 11:16:13 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
XvSelectPortNotify (v4l2xv->dpy, v4l2xv->port, 0);
|
2006-05-11 17:59:59 +00:00
|
|
|
XvSelectVideoNotify (v4l2xv->dpy, v4l2object->xwindow_id, 0);
|
|
|
|
XvStopVideo (v4l2xv->dpy, v4l2xv->port, v4l2object->xwindow_id);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
}
|
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2object->xwindow_id = xwindow_id;
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!v4l2xv || xwindow_id == 0) {
|
|
|
|
if (v4l2xv)
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
2003-10-10 12:47:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
if (change) {
|
2006-05-11 17:59:59 +00:00
|
|
|
GST_DEBUG_OBJECT (v4l2object->element, "Activating new port %lx",
|
|
|
|
xwindow_id);
|
2005-01-10 11:16:13 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
/* draw */
|
|
|
|
XvSelectPortNotify (v4l2xv->dpy, v4l2xv->port, 1);
|
2006-05-11 17:59:59 +00:00
|
|
|
XvSelectVideoNotify (v4l2xv->dpy, v4l2object->xwindow_id, 1);
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2010-06-10 16:15:46 +00:00
|
|
|
update_geometry (v4l2object);
|
2003-10-10 12:47:42 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
if (v4l2xv->idle_id)
|
|
|
|
g_source_remove (v4l2xv->idle_id);
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2xv->idle_id = g_idle_add (idle_refresh, v4l2object);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
2010-06-10 16:15:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_v4l2_xoverlay_prepare_xwindow_id:
|
|
|
|
* @param v4l2object
|
|
|
|
* @param required TRUE if display is required (ie. TRUE for v4l2sink, but
|
|
|
|
* FALSE for any other element with optional overlay capabilities)
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_v4l2_xoverlay_prepare_xwindow_id (GstV4l2Object * v4l2object,
|
|
|
|
gboolean required)
|
|
|
|
{
|
|
|
|
if (!GST_V4L2_IS_OVERLAY (v4l2object))
|
|
|
|
return;
|
|
|
|
|
|
|
|
gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (v4l2object->element));
|
|
|
|
|
|
|
|
if (required && !v4l2object->xwindow_id) {
|
|
|
|
GstV4l2Xv *v4l2xv;
|
|
|
|
Window win;
|
|
|
|
int width, height;
|
2010-10-02 19:45:14 +00:00
|
|
|
long event_mask;
|
2010-06-10 16:15:46 +00:00
|
|
|
|
|
|
|
if (!v4l2object->xv && GST_V4L2_IS_OPEN (v4l2object))
|
|
|
|
gst_v4l2_xoverlay_open (v4l2object);
|
|
|
|
|
|
|
|
v4l2xv = v4l2object->xv;
|
|
|
|
|
|
|
|
/* if xoverlay is not supported, just bail */
|
|
|
|
if (!v4l2xv)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* xoverlay is supported, but we don't have a window.. so create one */
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element, "creating window");
|
|
|
|
|
|
|
|
g_mutex_lock (v4l2xv->mutex);
|
|
|
|
|
|
|
|
width = XDisplayWidth (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy));
|
|
|
|
height = XDisplayHeight (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy));
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element, "dpy=%p", v4l2xv->dpy);
|
|
|
|
|
|
|
|
win = XCreateSimpleWindow (v4l2xv->dpy,
|
|
|
|
DefaultRootWindow (v4l2xv->dpy),
|
|
|
|
0, 0, width, height, 0, 0,
|
|
|
|
XBlackPixel (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy)));
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element, "win=%lu", win);
|
|
|
|
|
2010-10-02 19:45:14 +00:00
|
|
|
event_mask = ExposureMask | StructureNotifyMask;
|
|
|
|
if (GST_IS_NAVIGATION (v4l2object->element)) {
|
|
|
|
event_mask |= PointerMotionMask |
|
|
|
|
KeyPressMask | KeyReleaseMask |
|
|
|
|
ButtonPressMask | ButtonReleaseMask;
|
|
|
|
}
|
|
|
|
XSelectInput (v4l2xv->dpy, win, event_mask);
|
2010-06-10 16:15:46 +00:00
|
|
|
v4l2xv->event_id = g_timeout_add (45, event_refresh, v4l2object);
|
|
|
|
|
|
|
|
XMapRaised (v4l2xv->dpy, win);
|
|
|
|
|
|
|
|
XSync (v4l2xv->dpy, FALSE);
|
|
|
|
|
|
|
|
g_mutex_unlock (v4l2xv->mutex);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (v4l2object->element, "got window");
|
|
|
|
|
|
|
|
gst_v4l2_xoverlay_set_window_handle (v4l2object, win);
|
|
|
|
}
|
|
|
|
}
|