sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...

Original commit message from CVS:
2004-01-28  Julien MOUTTE <julien@moutte.net>

* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
This commit is contained in:
Julien Moutte 2004-01-28 10:45:33 +00:00
parent ead37dc249
commit 38fdf429c6
3 changed files with 59 additions and 16 deletions

View file

@ -1,3 +1,18 @@
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 Benjamin Otte <in7y118@public.uni-hamburg.de> 2004-01-28 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/alsa/gstalsa.c: (gst_alsa_query_func): * ext/alsa/gstalsa.c: (gst_alsa_query_func):

View file

@ -124,14 +124,21 @@ gst_ximagesink_check_xshm_calls (GstXContext *xcontext)
shmdt (ximage->SHMInfo.shmaddr); shmdt (ximage->SHMInfo.shmaddr);
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0); shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
g_free (ximage); g_free (ximage);
XSync(xcontext->disp, 0); XSync (xcontext->disp, FALSE);
return FALSE; return FALSE;
} }
else else
#endif /* HAVE_XSHM */
{ {
return TRUE; XShmDetach (xcontext->disp, &ximage->SHMInfo);
XDestroyImage (ximage->ximage);
shmdt (ximage->SHMInfo.shmaddr);
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
g_free (ximage);
XSync (xcontext->disp, FALSE);
} }
#endif /* HAVE_XSHM */
return TRUE;
} }
/* This function handles GstXImage creation depending on XShm availability */ /* This function handles GstXImage creation depending on XShm availability */
@ -189,7 +196,7 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
if (ximage->ximage) if (ximage->ximage)
{ {
XSync(ximagesink->xcontext->disp, 0); XSync (ximagesink->xcontext->disp, FALSE);
} }
else else
{ {
@ -238,7 +245,7 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
XDestroyImage (ximage->ximage); XDestroyImage (ximage->ximage);
} }
XSync(ximagesink->xcontext->disp, 0); XSync (ximagesink->xcontext->disp, FALSE);
g_mutex_unlock (ximagesink->x_lock); g_mutex_unlock (ximagesink->x_lock);
@ -276,7 +283,7 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
0, 0, x, y, ximage->width, ximage->height); 0, 0, x, y, ximage->width, ximage->height);
} }
XSync(ximagesink->xcontext->disp, FALSE); XSync (ximagesink->xcontext->disp, FALSE);
g_mutex_unlock (ximagesink->x_lock); g_mutex_unlock (ximagesink->x_lock);
} }
@ -303,8 +310,6 @@ gst_ximagesink_xwindow_new (GstXImageSink *ximagesink, gint width, gint height)
0, 0, xwindow->width, xwindow->height, 0, 0, xwindow->width, xwindow->height,
0, 0, ximagesink->xcontext->black); 0, 0, ximagesink->xcontext->black);
XMapRaised (ximagesink->xcontext->disp, xwindow->win);
XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask | XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
StructureNotifyMask | PointerMotionMask | KeyPressMask | StructureNotifyMask | PointerMotionMask | KeyPressMask |
KeyReleaseMask | ButtonPressMask | ButtonReleaseMask); KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
@ -312,6 +317,10 @@ gst_ximagesink_xwindow_new (GstXImageSink *ximagesink, gint width, gint height)
xwindow->gc = XCreateGC (ximagesink->xcontext->disp, xwindow->gc = XCreateGC (ximagesink->xcontext->disp,
xwindow->win, 0, NULL); xwindow->win, 0, NULL);
XMapRaised (ximagesink->xcontext->disp, xwindow->win);
XSync (ximagesink->xcontext->disp, FALSE);
g_mutex_unlock (ximagesink->x_lock); g_mutex_unlock (ximagesink->x_lock);
return xwindow; return xwindow;
@ -335,6 +344,8 @@ gst_ximagesink_xwindow_destroy (GstXImageSink *ximagesink, GstXWindow *xwindow)
XFreeGC (ximagesink->xcontext->disp, xwindow->gc); XFreeGC (ximagesink->xcontext->disp, xwindow->gc);
XSync (ximagesink->xcontext->disp, FALSE);
g_mutex_unlock (ximagesink->x_lock); g_mutex_unlock (ximagesink->x_lock);
g_free (xwindow); g_free (xwindow);

View file

@ -136,14 +136,21 @@ gst_xvimagesink_check_xshm_calls (GstXContext *xcontext)
shmdt (xvimage->SHMInfo.shmaddr); shmdt (xvimage->SHMInfo.shmaddr);
shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0); shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0);
g_free (xvimage); g_free (xvimage);
XSync(xcontext->disp, 0); XSync (xcontext->disp, FALSE);
return FALSE; return FALSE;
} }
else else
#endif /* HAVE_XSHM */
{ {
return TRUE; XShmDetach (xcontext->disp, &xvimage->SHMInfo);
XFree (xvimage->xvimage);
shmdt (xvimage->SHMInfo.shmaddr);
shmctl (xvimage->SHMInfo.shmid, IPC_RMID, 0);
g_free (xvimage);
XSync (xcontext->disp, FALSE);
} }
#endif /* HAVE_XSHM */
return TRUE;
} }
/* This function handles GstXvImage creation depending on XShm availability */ /* This function handles GstXvImage creation depending on XShm availability */
@ -200,7 +207,7 @@ gst_xvimagesink_xvimage_new (GstXvImageSink *xvimagesink,
if (xvimage->xvimage) if (xvimage->xvimage)
{ {
XSync(xvimagesink->xcontext->disp, 0); XSync (xvimagesink->xcontext->disp, FALSE);
} }
else else
{ {
@ -250,7 +257,7 @@ gst_xvimagesink_xvimage_destroy (GstXvImageSink *xvimagesink,
XFree (xvimage->xvimage); XFree (xvimage->xvimage);
} }
XSync(xvimagesink->xcontext->disp, 0); XSync (xvimagesink->xcontext->disp, FALSE);
g_mutex_unlock (xvimagesink->x_lock); g_mutex_unlock (xvimagesink->x_lock);
@ -329,6 +336,8 @@ gst_xvimagesink_xwindow_new (GstXvImageSink *xvimagesink,
XMapRaised (xvimagesink->xcontext->disp, xwindow->win); XMapRaised (xvimagesink->xcontext->disp, xwindow->win);
XSync(xvimagesink->xcontext->disp, FALSE);
g_mutex_unlock (xvimagesink->x_lock); g_mutex_unlock (xvimagesink->x_lock);
return xwindow; return xwindow;
@ -352,6 +361,8 @@ gst_xvimagesink_xwindow_destroy (GstXvImageSink *xvimagesink, GstXWindow *xwindo
XFreeGC (xvimagesink->xcontext->disp, xwindow->gc); XFreeGC (xvimagesink->xcontext->disp, xwindow->gc);
XSync(xvimagesink->xcontext->disp, FALSE);
g_mutex_unlock (xvimagesink->x_lock); g_mutex_unlock (xvimagesink->x_lock);
g_free (xwindow); g_free (xwindow);
@ -374,6 +385,8 @@ gst_xvimagesink_xwindow_resize (GstXvImageSink *xvimagesink,
XResizeWindow (xvimagesink->xcontext->disp, xwindow->win, XResizeWindow (xvimagesink->xcontext->disp, xwindow->win,
xwindow->width, xwindow->height); xwindow->width, xwindow->height);
XSync(xvimagesink->xcontext->disp, FALSE);
g_mutex_unlock (xvimagesink->x_lock); g_mutex_unlock (xvimagesink->x_lock);
} }
@ -615,6 +628,12 @@ gst_xvimagesink_get_xv_support (GstXContext *xcontext)
{ {
GstCaps *format_caps = NULL; GstCaps *format_caps = NULL;
/* We set the image format of the xcontext to an existing one. Sink
connect method will override that but we need to have at least a
valid image format so that we can make our xshm calls check before
caps negotiation really happens. */
xcontext->im_format = formats[i].id;
switch (formats[i].type) switch (formats[i].type)
{ {
case XvRGB: case XvRGB:
@ -769,13 +788,11 @@ gst_xvimagesink_xcontext_get (GstXvImageSink *xvimagesink)
{ {
xcontext->use_xshm = TRUE; xcontext->use_xshm = TRUE;
GST_DEBUG ("xvimagesink is using XShm extension"); GST_DEBUG ("xvimagesink is using XShm extension");
g_message ("using XShm");
} }
else else
{ {
xcontext->use_xshm = FALSE; xcontext->use_xshm = FALSE;
GST_DEBUG ("xvimagesink is not using XShm extension"); GST_DEBUG ("xvimagesink is not using XShm extension");
g_message ("not using XShm");
} }
#endif /* HAVE_XSHM */ #endif /* HAVE_XSHM */