sys/v4l/gstv4lelement.c (gst_v4lelement_start)

Original commit message from CVS:
2005-08-24  Andy Wingo  <wingo@pobox.com>

* sys/v4l/gstv4lelement.c (gst_v4lelement_start)
(gst_v4lelement_stop): Call _start and _stop for xoverlay instead
of _open and _close.

* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/gstv4lxoverlay.c (gst_v4l_xoverlay_set_xwindow_id): Open
an Xv connection here, instead of all the time. Make Xv only be
loaded if you axe for it. Kindof a workaround for buggy behaviour
of Xv when using remote xservers (XvQueryExtension would block).
(gst_v4l_xoverlay_stop, gst_v4l_xoverlay_start): New functions,
replace the _open and _close public API. Only start the xv
connection if necessary.
(gst_v4l_xoverlay_open, gst_v4l_xoverlay_close): Made static.
This commit is contained in:
Andy Wingo 2005-08-24 11:07:51 +00:00
parent ae8f41b658
commit 7b9a366d6e
4 changed files with 51 additions and 7 deletions

View file

@ -1,3 +1,19 @@
2005-08-24 Andy Wingo <wingo@pobox.com>
* sys/v4l/gstv4lelement.c (gst_v4lelement_start)
(gst_v4lelement_stop): Call _start and _stop for xoverlay instead
of _open and _close.
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/gstv4lxoverlay.c (gst_v4l_xoverlay_set_xwindow_id): Open
an Xv connection here, instead of all the time. Make Xv only be
loaded if you axe for it. Kindof a workaround for buggy behaviour
of Xv when using remote xservers (XvQueryExtension would block).
(gst_v4l_xoverlay_stop, gst_v4l_xoverlay_start): New functions,
replace the _open and _close public API. Only start the xv
connection if necessary.
(gst_v4l_xoverlay_open, gst_v4l_xoverlay_close): Made static.
2005-08-23 David Schleef <ds@schleef.org>
* gst/audioresample/Makefile.am: Leet audioresampling code

View file

@ -445,7 +445,7 @@ gst_v4lelement_start (GstBaseSrc * src)
return FALSE;
#ifdef HAVE_XVIDEO
gst_v4l_xoverlay_open (v4lelement);
gst_v4l_xoverlay_start (v4lelement);
#endif
return TRUE;
@ -457,7 +457,7 @@ gst_v4lelement_stop (GstBaseSrc * src)
GstV4lElement *v4lelement = GST_V4LELEMENT (src);
#ifdef HAVE_XVIDEO
gst_v4l_xoverlay_close (v4lelement);
gst_v4l_xoverlay_stop (v4lelement);
#endif
if (!gst_v4l_close (v4lelement))

View file

@ -59,7 +59,7 @@ gst_v4l_xoverlay_interface_init (GstXOverlayClass * klass)
"V4L XOverlay interface debugging");
}
void
static void
gst_v4l_xoverlay_open (GstV4lElement * v4lelement)
{
struct stat s;
@ -76,6 +76,13 @@ gst_v4l_xoverlay_open (GstV4lElement * v4lelement)
return;
}
/* First let's check that XVideo extension is available */
if (!XQueryExtension (dpy, "XVideo", &i, &i, &i)) {
GST_WARNING ("Xv extension not available - no overlay");
XCloseDisplay (dpy);
return;
}
/* find port that belongs to this device */
if (XvQueryExtension (dpy, &ver, &rel, &req, &ev, &err) != Success) {
GST_WARNING ("Xv extension not supported - no overlay");
@ -124,7 +131,7 @@ gst_v4l_xoverlay_open (GstV4lElement * v4lelement)
}
}
void
static void
gst_v4l_xoverlay_close (GstV4lElement * v4lelement)
{
GstV4lXv *v4lxv = v4lelement->xv;
@ -144,6 +151,20 @@ gst_v4l_xoverlay_close (GstV4lElement * v4lelement)
v4lelement->xv = NULL;
}
void
gst_v4l_xoverlay_start (GstV4lElement * v4lelement)
{
if (v4lelement->xwindow_id) {
gst_v4l_xoverlay_open (v4lelement);
}
}
void
gst_v4l_xoverlay_stop (GstV4lElement * v4lelement)
{
gst_v4l_xoverlay_close (v4lelement);
}
static gboolean
idle_refresh (gpointer data)
{
@ -171,12 +192,17 @@ static void
gst_v4l_xoverlay_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
{
GstV4lElement *v4lelement = GST_V4LELEMENT (overlay);
GstV4lXv *v4lxv = v4lelement->xv;
GstV4lXv *v4lxv;
XWindowAttributes attr;
gboolean change = (v4lelement->xwindow_id != xwindow_id);
GST_LOG_OBJECT (v4lelement, "Changing port to %lx", xwindow_id);
if (!v4lxv && GST_V4L_IS_OPEN (v4lelement))
gst_v4l_xoverlay_open (v4lelement);
v4lxv = v4lelement->xv;
if (v4lxv)
g_mutex_lock (v4lxv->mutex);

View file

@ -32,7 +32,9 @@ G_BEGIN_DECLS
void gst_v4l_xoverlay_interface_init (GstXOverlayClass *klass);
void gst_v4l_xoverlay_open (GstV4lElement *v4lelement);
void gst_v4l_xoverlay_close (GstV4lElement *v4lelement);
void gst_v4l_xoverlay_start (GstV4lElement * v4lelement);
void gst_v4l_xoverlay_stop (GstV4lElement * v4lelement);
G_END_DECLS
#endif /* __GST_V4L_X_OVERLAY_H__ */