sys/xvimage/xvimagesink.c: Some fixes to image size calculation.
authorJulien Moutte <julien@moutte.net>
Tue, 27 Jul 2004 10:10:02 +0000 (10:10 +0000)
committerJulien Moutte <julien@moutte.net>
Tue, 27 Jul 2004 10:10:02 +0000 (10:10 +0000)
Original commit message from CVS:
2004-07-27  Julien MOUTTE  <julien@moutte.net>

* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new): Some fixes to image size calculation.

ChangeLog
sys/xvimage/xvimagesink.c

index d169d9c8f179e86d4d04e7d0e6856ab2e709c964..6c29c1c8279e5e5ecb387fe0e710c12f227d869a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-27  Julien MOUTTE  <julien@moutte.net>
+
+       * sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
+       (gst_xvimagesink_xvimage_new): Some fixes to image size calculation.
+
 2004-07-27  Wim Taymans  <wim@fluendo.com>
 
        * ext/libpng/gstpngdec.c: (gst_pngdec_src_getcaps):
index 82183c4d41fabc45e60e94340f67f142677f2d36..a44cfa949584f313377cb0b5c8b9ff09ce7b51d3 100644 (file)
@@ -125,14 +125,13 @@ gst_xvimagesink_check_xshm_calls (GstXContext * xcontext)
   error_caught = FALSE;
   handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
 
-  xvimage->size = (xcontext->bpp / 8);
-
   /* Trying to create a 1x1 picture */
   xvimage->xvimage = XvShmCreateImage (xcontext->disp, xcontext->xv_port_id,
       xcontext->im_format, NULL, 1, 1, &xvimage->SHMInfo);
   if (!xvimage->xvimage)
     goto out;
 
+  xvimage->size = xvimage->xvimage->bytes_per_line;
   xvimage->SHMInfo.shmid = shmget (IPC_PRIVATE, xvimage->size,
       IPC_CREAT | 0777);
   xvimage->SHMInfo.shmaddr = shmat (xvimage->SHMInfo.shmid, 0, 0);
@@ -184,11 +183,6 @@ gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink,
 
   g_mutex_lock (xvimagesink->x_lock);
 
-  xvimage->size =
-      (xvimagesink->xcontext->bpp / 8) * xvimage->width * xvimage->height;
-  GST_DEBUG_OBJECT (xvimagesink, "GStreamer's image size is %d, stride %d",
-      xvimage->size, xvimage->size / xvimage->height);
-
 #ifdef HAVE_XSHM
   if (xvimagesink->xcontext->use_xshm) {
     xvimage->xvimage = XvShmCreateImage (xvimagesink->xcontext->disp,
@@ -222,7 +216,8 @@ gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink,
         xvimage->im_format, NULL, xvimage->width, xvimage->height);
 
     /* Allocating memory for image's data */
-    xvimage->xvimage->data = g_malloc (xvimage->xvimage->data_size);
+    xvimage->size = xvimage->xvimage->data_size;
+    xvimage->xvimage->data = g_malloc (xvimage->size);
 
     XSync (xvimagesink->xcontext->disp, FALSE);
   }