[gtk-vnc-devel] [PATCH] WMVi support



Hi all,
I am attaching a simple patch to add support for WMVi in gtk-vnc. Seems to work well with xen-unstable.
Regards,

Stefano Stabellini
diff -r 127004e2ede0 src/gvnc.c
--- a/src/gvnc.c	Tue Feb 19 10:56:48 2008 -0500
+++ b/src/gvnc.c	Wed Feb 20 13:30:53 2008 +0000
@@ -1770,6 +1770,14 @@ static void gvnc_resize(struct gvnc *gvn
 	}
 }
 
+static void gvnc_pixel_format(struct gvnc *gvnc)
+{
+        if (gvnc->has_error || !gvnc->ops.pixel_format)
+                return;
+        if (!gvnc->ops.pixel_format(gvnc->ops_data, &gvnc->fmt))
+                gvnc->has_error = TRUE;
+}
+
 static void gvnc_pointer_type_change(struct gvnc *gvnc, int absolute)
 {
 	if (gvnc->has_error || !gvnc->ops.pointer_type_change)
@@ -1930,6 +1938,10 @@ static void gvnc_framebuffer_update(stru
 	case GVNC_ENCODING_POINTER_CHANGE:
 		gvnc_pointer_type_change(gvnc, x);
 		break;
+        case GVNC_ENCODING_WMVi:
+                gvnc_read_pixel_format(gvnc, &gvnc->fmt);
+                gvnc_pixel_format(gvnc);
+                break;
 	case GVNC_ENCODING_RICH_CURSOR:
 		gvnc_rich_cursor(gvnc, x, y, width, height);
 		break;
diff -r 127004e2ede0 src/gvnc.h
--- a/src/gvnc.h	Tue Feb 19 10:56:48 2008 -0500
+++ b/src/gvnc.h	Wed Feb 20 13:29:16 2008 +0000
@@ -19,6 +19,7 @@ struct gvnc_ops
 	gboolean (*bell)(void *);
 	gboolean (*server_cut_text)(void *, const void *, size_t);
 	gboolean (*resize)(void *, int, int);
+        gboolean (*pixel_format)(void *, struct gvnc_pixel_format *);
 	gboolean (*pointer_type_change)(void *, int);
 	gboolean (*local_cursor)(void *, int, int, int, int, uint8_t *);
 	gboolean (*auth_unsupported)(void *, unsigned int);
@@ -85,6 +86,8 @@ typedef enum {
 
 	/* Pseudo encodings */
 	GVNC_ENCODING_DESKTOP_RESIZE = -223,
+        GVNC_ENCODING_WMVi = 0x574D5669,
+
 	GVNC_ENCODING_CURSOR_POS = -232,
 	GVNC_ENCODING_RICH_CURSOR = -239,
 	GVNC_ENCODING_XCURSOR = -240,
diff -r 127004e2ede0 src/vncdisplay.c
--- a/src/vncdisplay.c	Tue Feb 19 10:56:48 2008 -0500
+++ b/src/vncdisplay.c	Wed Feb 20 13:29:16 2008 +0000
@@ -948,6 +948,18 @@ static gboolean on_resize(void *opaque, 
 	return do_resize(opaque, width, height, FALSE);
 }
 
+static gboolean do_pixel_format(void *opaque, struct gvnc_pixel_format *fmt)
+{
+        VncDisplay *obj = VNC_DISPLAY(opaque);
+        VncDisplayPrivate *priv = obj->priv;
+        do_resize(opaque, priv->fb.width, priv->fb.height, TRUE);
+}
+
+static gboolean on_pixel_format(void *opaque, struct gvnc_pixel_format *fmt)
+{
+        return do_pixel_format(opaque, fmt);
+}
+
 #if WITH_GTKGLEXT
 static void build_gl_image_from_gdk(uint32_t *data, GdkImage *image)
 {
@@ -1303,6 +1315,7 @@ static const struct gvnc_ops vnc_display
 	.auth_failure = on_auth_failure,
 	.update = on_update,
 	.resize = on_resize,
+        .pixel_format = on_pixel_format,
 	.pointer_type_change = on_pointer_type_change,
 	.local_cursor = on_local_cursor,
 	.auth_unsupported = on_auth_unsupported,
@@ -1332,6 +1345,7 @@ static void *vnc_coroutine(void *opaque)
 				GVNC_ENCODING_TIGHT,
 				GVNC_ENCODING_EXT_KEY_EVENT,
 				GVNC_ENCODING_DESKTOP_RESIZE,
+                                GVNC_ENCODING_WMVi,
 				GVNC_ENCODING_RICH_CURSOR,
 				GVNC_ENCODING_XCURSOR,
 				GVNC_ENCODING_POINTER_CHANGE,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]