summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Isorce <julien.isorce@gmail.com>2008-12-07 03:25:59 +0100
committerJulien Isorce <julien.isorce@gmail.com>2008-12-07 03:25:59 +0100
commit175f7a707bc922f3facc63e7d9b6d01f9bb6b1b0 (patch)
treed7166cd1a722ec9c83ff02429180cc8b4db67506
parent47b40014923b61ff68f3a8661c42741aa46eb5a9 (diff)
fix gl framerate in gst caps. Consider position in xoverlay. Fix inversion bettween COLS and ROWS, and move windows.
-rw-r--r--ChangeLog12
-rw-r--r--gst-libs/gst/gl/gstglwindow_x11.c18
-rw-r--r--gst/gl/gstglupload.c25
-rw-r--r--tests/examples/clutter/clutteractortee.c32
4 files changed, 56 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index a9ff53d..99ff961 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-12-07 Julien Isorce <julien.isorce@gmail.com>
+
+ * gst-libs/gst/gl/gstglwindow_x11.c
+ Also consider position when using xoverlay.
+
+ * gst/gl/gstglupload.c
+ Fix framerate in gl caps. (it was always set to 0/1)
+
+ * tests/examples/clutter/clutteractortee.c
+ Fix inversion about ROWS and COLS.
+ Move window because clutter does not.
+
2008-11-29 Julien Isorce <julien.isorce@gmail.com>
* gst-libs/gst/gl/gstglwindow_x11.c
diff --git a/gst-libs/gst/gl/gstglwindow_x11.c b/gst-libs/gst/gl/gstglwindow_x11.c
index 9c5af6a..e728239 100644
--- a/gst-libs/gst/gl/gstglwindow_x11.c
+++ b/gst-libs/gst/gl/gstglwindow_x11.c
@@ -362,6 +362,8 @@ gst_gl_window_new (gint width, gint height)
g_debug ("gl window id: %lld\n", (guint64) priv->internal_win_id);
+ g_debug ("gl window props: x:%d y:%d w:%d h:%d\n", x, y, width, height);
+
wm_atoms[0] = XInternAtom (priv->device, "WM_DELETE_WINDOW", True);
if (wm_atoms[0] == None)
g_debug ("Cannot create WM_DELETE_WINDOW\n");
@@ -428,6 +430,8 @@ gst_gl_window_set_external_window_id (GstGLWindow *window, guint64 id)
priv->parent = (Window) id;
+ g_debug ("set parent window id: %lld\n", id);
+
XGetWindowAttributes (priv->disp_send, priv->parent, &attr);
XResizeWindow (priv->disp_send, priv->internal_win_id, attr.width, attr.height);
@@ -541,13 +545,21 @@ gst_gl_window_draw (GstGLWindow *window)
XWindowAttributes attr_parent;
XGetWindowAttributes (priv->disp_send, priv->parent, &attr_parent);
- if (attr.width != attr_parent.width || attr.height != attr_parent.height)
+ if (attr.x != attr_parent.x || attr.y != attr_parent.y ||
+ attr.width != attr_parent.width || attr.height != attr_parent.height)
{
- XResizeWindow (priv->disp_send, priv->internal_win_id, attr_parent.width, attr_parent.height);
+ XMoveResizeWindow (priv->disp_send, priv->internal_win_id, attr_parent.x, attr_parent.y,
+ attr_parent.width, attr_parent.height);
XSync (priv->disp_send, FALSE);
+ attr.x = attr_parent.x;
+ attr.y = attr_parent.y;
+
attr.width = attr_parent.width;
attr.height = attr_parent.height;
+
+ g_debug ("parent resize: %d, %d, %d, %d\n", attr_parent.x, attr_parent.y,
+ attr_parent.width, attr_parent.height);
}
}
@@ -624,8 +636,6 @@ gst_gl_window_run_loop (GstGLWindow *window)
custom_cb (custom_data);
}
- g_debug("signal\n");
-
g_cond_signal (priv->cond_send_message);
}
diff --git a/gst/gl/gstglupload.c b/gst/gl/gstglupload.c
index 77e3417..fa540e7 100644
--- a/gst/gl/gstglupload.c
+++ b/gst/gl/gstglupload.c
@@ -244,24 +244,23 @@ gst_gl_upload_transform_caps (GstBaseTransform* bt,
GST_DEBUG ("transform caps %" GST_PTR_FORMAT, caps);
- framerate_value = gst_structure_get_value (structure, "framerate");
+ framerate_value = gst_structure_get_value (structure, "framerate");
par_value = gst_structure_get_value (structure, "pixel-aspect-ratio");
if (direction == GST_PAD_SRC)
- {
- GstCaps* newothercaps = gst_caps_new_simple ("video/x-raw-rgb", NULL);
- newcaps = gst_caps_new_simple ("video/x-raw-yuv", NULL);
- gst_caps_append(newcaps, newothercaps);
-
- }
+ {
+ GstCaps* newothercaps = gst_caps_new_simple ("video/x-raw-rgb", NULL);
+ newcaps = gst_caps_new_simple ("video/x-raw-yuv", NULL);
+ gst_caps_append(newcaps, newothercaps);
+ }
else
- newcaps = gst_caps_new_simple ("video/x-raw-gl", NULL);
+ newcaps = gst_caps_new_simple ("video/x-raw-gl", NULL);
- structure = gst_structure_copy (gst_caps_get_structure (newcaps, 0));
+ structure = gst_caps_get_structure (newcaps, 0);
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
gst_structure_set_value (structure, "framerate", framerate_value);
if (par_value)
@@ -270,7 +269,7 @@ gst_gl_upload_transform_caps (GstBaseTransform* bt,
gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION,
1, 1, NULL);
- gst_caps_merge_structure (newcaps, gst_structure_copy (structure));
+ gst_caps_merge_structure (newcaps, gst_structure_copy (structure));
GST_DEBUG ("new caps %" GST_PTR_FORMAT, newcaps);
diff --git a/tests/examples/clutter/clutteractortee.c b/tests/examples/clutter/clutteractortee.c
index 36494bf..1002fe2 100644
--- a/tests/examples/clutter/clutteractortee.c
+++ b/tests/examples/clutter/clutteractortee.c
@@ -1,4 +1,4 @@
-/*
+/*
* GStreamer
* Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
*
@@ -45,17 +45,22 @@ static gboolean
create_actor (GstGLClutterActor *actor) {
static gint xpos = 0;
static gint ypos = 0;
- actor->texture = g_object_new (CLUTTER_GLX_TYPE_TEXTURE_PIXMAP,
+ Display *disp;
+ actor->texture = g_object_new (CLUTTER_GLX_TYPE_TEXTURE_PIXMAP,
"window", actor->win,
"automatic-updates", TRUE, NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (actor->stage), actor->texture);
clutter_actor_set_position (actor->texture, xpos, ypos);
- if (xpos > (ROWS-1)*W) {
+
+ disp = clutter_x11_get_default_display ();
+ XMoveResizeWindow (disp, actor->win, xpos, ypos, W, H);
+
+ if (xpos > (COLS-1)*W) {
xpos = 0;
ypos += H+1;
} else
xpos += W+1;
- clutter_actor_show (actor->texture);
+ clutter_actor_show (actor->texture);
return FALSE;
}
@@ -69,7 +74,7 @@ create_window (GstBus * bus, GstMessage * message, gpointer data)
// ignore anything but 'prepare-xwindow-id' element messages
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return GST_BUS_PASS;
-
+
if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
return GST_BUS_PASS;
@@ -80,14 +85,14 @@ create_window (GstBus * bus, GstMessage * message, gpointer data)
if (count < N_ACTORS) {
g_message ("adding actor %d", count);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
+ gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
actor[count]->win);
clutter_threads_add_idle ((GSourceFunc) create_actor, actor[count]);
count++;
}
g_mutex_unlock (mutex);
-
+
gst_message_unref (message);
return GST_BUS_DROP;
}
@@ -139,9 +144,9 @@ main (int argc, char *argv[])
}
stage = clutter_stage_get_default ();
- clutter_actor_set_size (CLUTTER_ACTOR (stage),
- W*ROWS + (ROWS-1),
- H*COLS + (COLS-1));
+ clutter_actor_set_size (CLUTTER_ACTOR (stage),
+ W*COLS + (COLS-1),
+ H*ROWS + (ROWS-1));
stage_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
@@ -171,14 +176,13 @@ main (int argc, char *argv[])
tee = gst_element_factory_make ("tee", NULL);
gst_bin_add_many (GST_BIN (pipeline), srcbin, tee, NULL);
-
for (i=0; i<N_ACTORS; i++) {
queue[i] = gst_element_factory_make ("queue", NULL);
upload[i] = gst_element_factory_make ("glupload", NULL);
effect[i] = gst_element_factory_make ("gleffects", NULL);
sink[i] = gst_element_factory_make ("glimagesink", NULL);
- gst_bin_add_many (GST_BIN (pipeline),
+ gst_bin_add_many (GST_BIN (pipeline),
queue[i], upload[i], effect[i], sink[i], NULL);
}
@@ -190,7 +194,7 @@ main (int argc, char *argv[])
if (!ok)
g_error ("Failed to link one or more elements");
-
+
for (i=0; i<N_ACTORS; i++) {
g_message ("setting effect %d on %s", i+1, gst_element_get_name (effect[i]));
g_object_set (G_OBJECT (effect[i]), "effect", i+1, NULL);
@@ -208,6 +212,6 @@ main (int argc, char *argv[])
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
g_object_unref (pipeline);
-
+
return 0;
}