From: <th...@ke...> - 2006-05-26 11:18:11
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: thaytan Date: Fri May 26 2006 11:18:09 UTC Log message: * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new), (gst_ximagesink_xcontext_get), (gst_ximagesink_show_frame): Improve the errors produced on bad output, including some human readable description strings. Handle the (theoretical for ximagesink) case where the XServer has a different idea about the size required for a particular frame and gives us too small a memory allocation. Modified files: . : ChangeLog sys/ximage : ximagesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2664&r2=1.2665 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/sys/ximage/ximagesink.c.diff?r1=1.158&r2=1.159 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2664 retrieving revision 1.2665 diff -u -d -r1.2664 -r1.2665 --- ChangeLog 26 May 2006 10:18:41 -0000 1.2664 +++ ChangeLog 26 May 2006 11:17:57 -0000 1.2665 @@ -1,5 +1,15 @@ 2006-05-26 Jan Schmidt <th...@ma...> + * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new), + (gst_ximagesink_xcontext_get), (gst_ximagesink_show_frame): + Improve the errors produced on bad output, including some human + readable description strings. + Handle the (theoretical for ximagesink) case where the XServer + has a different idea about the size required for a particular + frame and gives us too small a memory allocation. + +2006-05-26 Jan Schmidt <th...@ma...> * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new), (gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get), (gst_xvimagesink_get_format_from_caps), (gst_xvimagesink_setcaps), Index: ximagesink.c RCS file: /cvs/gstreamer/gst-plugins-base/sys/ximage/ximagesink.c,v retrieving revision 1.158 retrieving revision 1.159 diff -u -d -r1.158 -r1.159 --- ximagesink.c 11 May 2006 10:14:20 -0000 1.158 +++ ximagesink.c 26 May 2006 11:17:57 -0000 1.159 @@ -418,8 +418,11 @@ ximagesink->xcontext->depth, ZPixmap, NULL, &ximage->SHMInfo, ximage->width, ximage->height); if (!ximage->ximage) { - GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE, (NULL), - ("could not XShmCreateImage a %dx%d image")); + GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE, + ("Failed to create output image buffer of %dx%d pixels", + ximage->width, ximage->height), + ("could not XShmCreateImage a %dx%d image", + ximage->width, ximage->height)); goto beach; } @@ -431,14 +434,18 @@ ximage->SHMInfo.shmid = shmget (IPC_PRIVATE, ximage->size, IPC_CREAT | 0777); if (ximage->SHMInfo.shmid == -1) { ("could not get shared memory of %d bytes", ximage->size)); ximage->SHMInfo.shmaddr = shmat (ximage->SHMInfo.shmid, 0, 0); if (ximage->SHMInfo.shmaddr == ((void *) -1)) { ("Failed to shmat: %s", g_strerror (errno))); /* Clean up the shared memory segment */ shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0); @@ -454,8 +461,9 @@ ximage->SHMInfo.readOnly = FALSE; if (XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo) == 0) { - ("Failed to XShmAttach")); + ximage->width, ximage->height), ("Failed to XShmAttach")); @@ -469,8 +477,11 @@ ZPixmap, 0, NULL, ximage->width, ximage->height, ximagesink->xcontext->bpp, 0); - ("could not XCreateImage a %dx%d image")); + ("could not XCreateImage a %dx%d image", @@ -1022,8 +1033,8 @@ if (!xcontext->disp) { g_mutex_unlock (ximagesink->x_lock); g_free (xcontext); - GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE, (NULL), - ("Could not open display")); + GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE, + ("Could not initialise X output"), ("Could not open display")); return NULL; } @@ -1423,7 +1434,19 @@ ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink, GST_BUFFER_CAPS (buf)); if (!ximagesink->ximage) + /* The create method should have posted an informative error */ + goto no_ximage; + if (ximagesink->ximage->size < GST_BUFFER_SIZE (buf)) { + GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE, + ("Failed to create output image buffer of %dx%d pixels", + ximagesink->ximage->width, ximagesink->ximage->height), + ("XServer allocated buffer size did not match input buffer")); + gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); + ximagesink->ximage = NULL; goto no_ximage; + } memcpy (GST_BUFFER_DATA (ximagesink->ximage), GST_BUFFER_DATA (buf), MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size)); @@ -1437,8 +1460,6 @@ { /* No image available. That's very bad ! */ GST_DEBUG ("could not create image"); - GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL), - ("Failed creating an XImage in ximagesink chain function.")); return GST_FLOW_ERROR; } |