changeset 21586:5a1e078720e7

Support for different endianness on client and server with -vo x11
author reimar
date Tue, 12 Dec 2006 19:13:48 +0000
parents e54f539c9b5d
children f671a3aa7456
files libvo/vo_x11.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Tue Dec 12 19:03:57 2006 +0000
+++ b/libvo/vo_x11.c	Tue Dec 12 19:13:48 2006 +0000
@@ -85,6 +85,7 @@
 static uint32_t image_height;
 static uint32_t in_format;
 static uint32_t out_format = 0;
+static int out_offset;
 static int srcW = -1;
 static int srcH = -1;
 static int aspect;              // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing
@@ -552,6 +553,17 @@
         default:
             draw_alpha_fnc = draw_alpha_null;
     }
+    out_offset = 0;
+    // for these formats conversion is currently not support and
+    // we can easily "emulate" them.
+    if (out_format & 64 && IMGFMT_IS_RGB(out_format) || IMGFMT_IS_BGR(out_format)) {
+      out_format &= ~64;
+#ifdef WORDS_BIGENDIAN
+      out_offset = 1;
+#else
+      out_offset = -1;
+#endif
+    }
 
     /* always allocate swsContext as size could change between frames */
     swsContext =
@@ -571,6 +583,7 @@
 
 static void Display_Image(XImage * myximage, uint8_t * ImageData)
 {
+    myximage->data += out_offset;
 #ifdef HAVE_SHM
     if (Shmem_Flag)
     {
@@ -588,6 +601,7 @@
                   (vo_dheight - myximage->height) / 2, dst_width,
                   myximage->height);
     }
+    myximage->data -= out_offset;
 }
 
 static void draw_osd(void)