[467/906] tests: various build fixes

- cmake could not find glib
 - put gtk variables at the beginning to avoid GL conflicts
 - update examples to clutter-1.8
 - use const instead of deprecated G_CONST_RETURN
 - set max pending events to 0 to make cube example works again
This commit is contained in:
Julien Isorce 2011-11-16 16:53:25 +01:00 committed by Matthew Waters
parent 7e3070fe31
commit d21aaa22bf
6 changed files with 61 additions and 42 deletions

View file

@ -219,14 +219,14 @@ gst_gl_shader_set_fragment_source (GstGLShader * shader, const gchar * src)
priv->fragment_src = g_strdup (src);
}
G_CONST_RETURN gchar *
const gchar *
gst_gl_shader_get_vertex_source (GstGLShader * shader)
{
g_return_val_if_fail (GST_GL_IS_SHADER (shader), NULL);
return shader->priv->vertex_src;
}
G_CONST_RETURN gchar *
const gchar *
gst_gl_shader_get_fragment_source (GstGLShader * shader)
{
g_return_val_if_fail (GST_GL_IS_SHADER (shader), NULL);

View file

@ -79,8 +79,8 @@ void gst_gl_shader_set_vertex_source (GstGLShader *shader,
const gchar *src);
void gst_gl_shader_set_fragment_source (GstGLShader *shader,
const gchar *src);
G_CONST_RETURN gchar * gst_gl_shader_get_vertex_source (GstGLShader *shader);
G_CONST_RETURN gchar * gst_gl_shader_get_fragment_source (GstGLShader *shader);
const gchar * gst_gl_shader_get_vertex_source (GstGLShader *shader);
const gchar * gst_gl_shader_get_fragment_source (GstGLShader *shader);
void gst_gl_shader_set_active (GstGLShader *shader,
gboolean active);

View file

@ -90,7 +90,8 @@ G_DEFINE_TYPE (GstGLWindow, gst_gl_window, G_TYPE_OBJECT);
gboolean _gst_gl_window_debug = FALSE;
void gst_gl_window_init_platform ()
void
gst_gl_window_init_platform ()
{
}
@ -648,7 +649,7 @@ gst_gl_window_run_loop (GstGLWindow * window)
g_mutex_lock (priv->x_lock);
// use in generic/cube and other related uses
priv->allow_extra_expose_events = XPending (priv->device) <= 2;
priv->allow_extra_expose_events = XPending (priv->device) <= 0;
switch (event.type) {
case ClientMessage:

View file

@ -44,9 +44,9 @@ typedef struct GstGLClutterActor_ GstGLClutterActor;
static gboolean
create_actor (GstGLClutterActor * actor)
{
ClutterKnot knot[2];
ClutterTimeline *timeline;
ClutterEffectTemplate *effect_template;
//ClutterKnot knot[2];
//ClutterTimeline *timeline;
ClutterAnimation *animation = NULL;
actor->texture = g_object_new (CLUTTER_GLX_TYPE_TEXTURE_PIXMAP,
"window", actor->win, "automatic-updates", TRUE, NULL);
@ -56,39 +56,42 @@ create_actor (GstGLClutterActor * actor)
clutter_actor_set_opacity (actor->texture, 0);
clutter_actor_show (actor->texture);
timeline =
clutter_timeline_new (120 /* frames */ , 50 /* frames per second. */ );
clutter_timeline_set_loop (timeline, TRUE);
clutter_timeline_start (timeline);
//timeline =
// clutter_timeline_new (120 /* frames */ , 50 /* frames per second. */ );
//clutter_timeline_set_loop (timeline, TRUE);
//clutter_timeline_start (timeline);
/* Instead of our custom callback,
* we could use a standard callback. For instance, CLUTTER_ALPHA_SINE_INC.
*/
effect_template =
clutter_effect_template_new (timeline, CLUTTER_ALPHA_SINE_INC);
/*effect_template =
clutter_effect_template_new (timeline, CLUTTER_ALPHA_SINE_INC); */
animation =
clutter_actor_animate (actor->texture, CLUTTER_LINEAR, 2400,
"x", 100.0, "y", 100.0, "opacity", 0, NULL);
knot[0].x = -10;
knot[0].y = -10;
knot[1].x = 160;
knot[1].y = 120;
/* knot[0].x = -10;
knot[0].y = -10;
knot[1].x = 160;
knot[1].y = 120;* /
// Move the actor along the path:
clutter_effect_path (effect_template, actor->texture, knot,
sizeof (knot) / sizeof (ClutterKnot), NULL, NULL);
clutter_effect_scale (effect_template, actor->texture, 1.0, 1.0, NULL, NULL);
clutter_effect_rotate (effect_template, actor->texture,
CLUTTER_Z_AXIS, 360.0, W / 2.0, H / 2.0, 0.0,
CLUTTER_ROTATE_CW, NULL, NULL);
clutter_effect_rotate (effect_template, actor->texture,
CLUTTER_X_AXIS, 360.0, 0.0, W / 4.0, 0.0, CLUTTER_ROTATE_CW, NULL, NULL);
// Move the actor along the path:
/*clutter_effect_path (effect_template, actor->texture, knot,
sizeof (knot) / sizeof (ClutterKnot), NULL, NULL);
clutter_effect_scale (effect_template, actor->texture, 1.0, 1.0, NULL, NULL);
clutter_effect_rotate (effect_template, actor->texture,
CLUTTER_Z_AXIS, 360.0, W / 2.0, H / 2.0, 0.0,
CLUTTER_ROTATE_CW, NULL, NULL);
clutter_effect_rotate (effect_template, actor->texture,
CLUTTER_X_AXIS, 360.0, 0.0, W / 4.0, 0.0, CLUTTER_ROTATE_CW, NULL, NULL); */
// Also change the actor's opacity while moving it along the path:
// (You would probably want to use a different ClutterEffectTemplate,
// so you could use a different alpha callback for this.)
clutter_effect_fade (effect_template, actor->texture, 255, NULL, NULL);
//clutter_effect_fade (effect_template, actor->texture, 255, NULL, NULL);
g_object_unref (effect_template);
g_object_unref (timeline);
g_object_unref (animation);
//g_object_unref (timeline);
return FALSE;
}
@ -123,8 +126,12 @@ main (int argc, char *argv[])
GstGLClutterActor *actor;
Display *disp;
Window stage_win;
ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
clutter_err = clutter_init (&argc, &argv);
if (clutter_err != CLUTTER_INIT_SUCCESS)
g_warning ("Failed to initalize clutter: %d\n", clutter_err);
clutter_init (&argc, &argv);
gst_init (&argc, &argv);
disp = clutter_x11_get_default_display ();

View file

@ -135,8 +135,12 @@ main (int argc, char *argv[])
const gchar *desc;
gint i;
gint ok = FALSE;
ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
clutter_err = clutter_init (&argc, &argv);
if (clutter_err != CLUTTER_INIT_SUCCESS)
g_warning ("Failed to initalize clutter: %d\n", clutter_err);
clutter_init (&argc, &argv);
gst_init (&argc, &argv);
disp = clutter_x11_get_default_display ();

View file

@ -52,18 +52,19 @@ struct _GstGLBuffer
/* rotation */
void
on_new_frame (ClutterTimeline * timeline, gint frame_num, gpointer data)
on_new_frame (ClutterTimeline * timeline, gint msecs, gpointer data)
{
ClutterActor *rect_actor = CLUTTER_ACTOR (data);
ClutterActor *texture_actor =
g_object_get_data (G_OBJECT (timeline), "texture_actor");
clutter_actor_set_rotation (rect_actor, CLUTTER_Z_AXIS, (gdouble) frame_num,
clutter_actor_get_width (rect_actor) / 2,
clutter_actor_set_rotation (rect_actor, CLUTTER_Z_AXIS,
60.0 * (gdouble) msecs / 1000.0, clutter_actor_get_width (rect_actor) / 2,
clutter_actor_get_height (rect_actor) / 2, 0);
clutter_actor_set_rotation (texture_actor, CLUTTER_Z_AXIS,
(gdouble) frame_num, clutter_actor_get_width (texture_actor) / 6,
60.0 * (gdouble) msecs / 1000.0,
clutter_actor_get_width (texture_actor) / 6,
clutter_actor_get_height (texture_actor) / 6, 0);
}
@ -96,7 +97,7 @@ setup_stage (ClutterStage * stage)
/* timeline */
timeline = clutter_timeline_new (360, 60);
timeline = clutter_timeline_new (6000);
g_object_set_data (G_OBJECT (timeline), "texture_actor", texture_actor);
clutter_timeline_set_loop (timeline, TRUE);
clutter_timeline_start (timeline);
@ -125,7 +126,7 @@ update_texture_actor (gpointer data)
if (glGetError () != GL_NO_ERROR)
g_debug ("failed to bind texture that comes from gst-gl\n");
cogl_texture = cogl_texture_new_from_foreign (gst_gl_buf->texture,
CGL_TEXTURE_RECTANGLE_ARB, gst_gl_buf->width, gst_gl_buf->height, 0, 0,
GL_TEXTURE_RECTANGLE_ARB, gst_gl_buf->width, gst_gl_buf->height, 0, 0,
COGL_PIXEL_FORMAT_RGBA_8888);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
@ -134,7 +135,7 @@ update_texture_actor (gpointer data)
* ref counter of the previous cogl texture is reaching 0 because is_foreign is TRUE */
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (texture_actor),
cogl_texture);
cogl_texture_unref (cogl_texture);
cogl_handle_unref (cogl_texture);
/* we can now show the clutter scene if not yet visible */
if (!CLUTTER_ACTOR_IS_VISIBLE (stage))
@ -213,6 +214,7 @@ end_stream_cb (GstBus * bus, GstMessage * msg, gpointer data)
int
main (int argc, char *argv[])
{
ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
GLenum err = 0;
#ifdef WIN32
HGLRC clutter_gl_context = 0;
@ -236,9 +238,12 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
clutter_threads_init ();
clutter_init (&argc, &argv);
clutter_err = clutter_init (&argc, &argv);
if (clutter_err != CLUTTER_INIT_SUCCESS)
g_warning ("Failed to initalize clutter: %d\n", clutter_err);
clutter_threads_enter ();
g_print ("clutter version: %s\n", CLUTTER_VERSION_S);
clutter_set_default_frame_rate (2);
/* init glew */
@ -287,7 +292,7 @@ main (int argc, char *argv[])
/* clutter_gl_context is an external OpenGL context with which gst-plugins-gl want to share textures */
glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "glfilter0");
glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "glfiltercube0");
g_object_set (G_OBJECT (glfilter), "external-opengl-context",
clutter_gl_context, NULL);
g_object_unref (glfilter);
@ -373,5 +378,7 @@ main (int argc, char *argv[])
gst_buffer_unref (buf);
}
g_print ("END\n");
return 0;
}