--- gstgloverlay_old.c	2009-09-01 16:02:31.000000000 +0200
+++ gstgloverlay.c	2009-09-01 16:09:40.000000000 +0200
@@ -54,7 +54,9 @@
 
   gchar *location;
   gboolean pbuf_has_changed;
-
+  gint8		pos_x;
+  gint8		pos_y;
+  guint8       	size;
   guchar *pixbuf;
   gint width, height;
   GLuint pbuftexture;
@@ -102,7 +104,10 @@
 {
   PROP_0,
   PROP_LOCATION,
-//  PROP_STRETCH,
+  PROP_XPOS,
+  PROP_YPOS,
+  PROP_SIZE
+  //  PROP_STRETCH,
   /* future properties? */
   /* PROP_WIDTH, */
   /* PROP_HEIGHT, */
@@ -157,7 +162,29 @@
       g_param_spec_string ("location",
           "Location of the image",
           "Location of the image", NULL, G_PARAM_READWRITE));
-  /*
+
+  g_object_class_install_property (gobject_class,
+      PROP_XPOS,
+      g_param_spec_int("xpos",
+      "X position of overlay image in percents",
+      "X position of overlay image in percents",
+      0, 100, 0, G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      PROP_YPOS,
+      g_param_spec_int("ypos",
+      "Y position of overlay image in percents",
+      "Y position of overlay image in percents",
+      0, 100, 0, G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      PROP_SIZE,
+      g_param_spec_int("proportion",
+      "Relative size of overlay image, in percents",
+      "Relative size of iverlay image, in percents",
+      0, 100, 0, G_PARAM_READWRITE));
+
+ /*
      g_object_class_install_property (gobject_class,
      PROP_STRETCH,
      g_param_spec_boolean ("stretch",
@@ -172,6 +199,9 @@
 {
   GstGLFilter *filter = GST_GL_FILTER (overlay);
 
+  gfloat posx = 0.0;
+  gfloat posy = 0.0;
+  gfloat size = 0.0;
   gfloat width = (gfloat) filter->width;
   gfloat height = (gfloat) filter->height;
 
@@ -208,14 +238,20 @@
 
   glBegin (GL_QUADS);
 
+  size = (overlay->size) / 50.0;
+  posx = (overlay->pos_x  - 50.0) / 50.0;
+  posx = (posx - (size / 2) < -1.00) ? (-1.0 + size / 2) : (posx + (size / 2) > 1.00) ?  (1.0 - size / 2) : posx;
+  posy = (overlay->pos_y  - 50.0) / 50.0;
+  posy = (posy - (size / 2) < -1.00) ? (-1.0 + size / 2) : (posy + (size / 2) > 1.00) ?  (1.0 - size / 2) : posy;
+
   glTexCoord2f (0.0, 0.0);
-  glVertex2f (-1.0, -1.0);
+  glVertex2f (posx - (size / 2), posy - (size / 2));
   glTexCoord2f (width, 0.0);
-  glVertex2f (1.0, -1.0);
+  glVertex2f (posx + (size / 2), posy - (size / 2));
   glTexCoord2f (width, height);
-  glVertex2f (1.0, 1.0);
+  glVertex2f (posx + (size / 2), posy + (size / 2));
   glTexCoord2f (0.0, height);
-  glVertex2f (-1.0, 1.0);
+  glVertex2f (posx - (size / 2), posy + (size / 2));
 
   glEnd ();
 
@@ -232,6 +268,9 @@
   overlay->pbuftexture = 0;
   overlay->width = 0;
   overlay->height = 0;
+  overlay->pos_x = 0.0;
+  overlay->pos_y = 0.0;
+  overlay->size = 100;
 //  overlay->stretch = TRUE;
   overlay->pbuf_has_changed = FALSE;
 }
@@ -255,6 +294,15 @@
       overlay->pbuf_has_changed = TRUE;
       overlay->location = g_value_dup_string (value);
       break;
+    case PROP_XPOS:
+      overlay->pos_x = g_value_get_int(value);
+      break;
+    case PROP_YPOS:
+      overlay->pos_y = g_value_get_int(value);
+      break;
+    case PROP_SIZE:
+      overlay->size = g_value_get_int(value);
+      break;
 /*  case PROP_STRETCH:
     overlay->stretch = g_value_get_boolean (value);
     break;
@@ -275,6 +323,15 @@
     case PROP_LOCATION:
       g_value_set_string (value, overlay->location);
       break;
+    case PROP_XPOS:
+      g_value_set_int(value, overlay->pos_x);
+      break;
+    case PROP_YPOS:
+      g_value_set_int(value, overlay->pos_y);
+      break;
+    case PROP_SIZE:
+      g_value_set_int(value, overlay->size);
+      break;
 /*  case PROP_STRETCH:
     g_value_set_boolean (value, overlay->stretch);
     break;
