2009-10-27 11:27:45 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2009-03-13 17:14:31 -04:00
|
|
|
#include "shell-recorder.h"
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
/* Very simple test of the ShellRecorder class; shows some text strings
|
|
|
|
* moving around and records it.
|
|
|
|
*/
|
2012-05-02 10:23:28 -04:00
|
|
|
static ShellRecorder *recorder = NULL;
|
2009-03-13 17:14:31 -04:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
stop_recording_timeout (gpointer data)
|
|
|
|
{
|
2012-05-02 10:23:28 -04:00
|
|
|
if (recorder)
|
|
|
|
{
|
|
|
|
shell_recorder_close (recorder);
|
|
|
|
g_object_unref (recorder);
|
|
|
|
}
|
|
|
|
|
|
|
|
clutter_main_quit ();
|
|
|
|
|
2009-03-13 17:14:31 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_animation_completed (ClutterAnimation *animation)
|
|
|
|
{
|
|
|
|
g_timeout_add (1000, stop_recording_timeout, NULL);
|
|
|
|
}
|
|
|
|
|
2012-05-02 10:23:28 -04:00
|
|
|
static void
|
|
|
|
on_stage_realized (ClutterActor *stage,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
recorder = shell_recorder_new (CLUTTER_STAGE (stage));
|
|
|
|
shell_recorder_set_filename (recorder, "test-recorder.ogg");
|
|
|
|
shell_recorder_record (recorder);
|
|
|
|
}
|
|
|
|
|
2009-03-13 17:14:31 -04:00
|
|
|
int main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
ClutterActor *stage;
|
|
|
|
ClutterActor *text;
|
|
|
|
ClutterAnimation *animation;
|
|
|
|
ClutterColor red, green, blue;
|
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
2011-03-13 14:16:54 -04:00
|
|
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
2011-03-13 14:26:01 -04:00
|
|
|
return 1;
|
2009-03-13 17:14:31 -04:00
|
|
|
|
|
|
|
clutter_color_from_string (&red, "red");
|
|
|
|
clutter_color_from_string (&green, "green");
|
|
|
|
clutter_color_from_string (&blue, "blue");
|
2011-11-21 11:56:24 -05:00
|
|
|
stage = clutter_stage_new ();
|
|
|
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
2009-03-13 17:14:31 -04:00
|
|
|
|
|
|
|
text = g_object_new (CLUTTER_TYPE_TEXT,
|
|
|
|
"text", "Red",
|
|
|
|
"font-name", "Sans 40px",
|
|
|
|
"color", &red,
|
|
|
|
NULL);
|
2012-02-13 15:04:50 -05:00
|
|
|
clutter_actor_add_child (stage, text);
|
2009-03-13 17:14:31 -04:00
|
|
|
animation = clutter_actor_animate (text,
|
|
|
|
CLUTTER_EASE_IN_OUT_QUAD,
|
|
|
|
3000,
|
2012-05-02 10:20:52 -04:00
|
|
|
"x", 320.0,
|
|
|
|
"y", 240.0,
|
2009-03-13 17:14:31 -04:00
|
|
|
NULL);
|
|
|
|
g_signal_connect (animation, "completed",
|
|
|
|
G_CALLBACK (on_animation_completed), NULL);
|
|
|
|
|
|
|
|
text = g_object_new (CLUTTER_TYPE_TEXT,
|
|
|
|
"text", "Blue",
|
|
|
|
"font-name", "Sans 40px",
|
|
|
|
"color", &blue,
|
2012-05-02 10:20:52 -04:00
|
|
|
"x", 640.0,
|
|
|
|
"y", 0.0,
|
2009-03-13 17:14:31 -04:00
|
|
|
NULL);
|
|
|
|
clutter_actor_set_anchor_point_from_gravity (text, CLUTTER_GRAVITY_NORTH_EAST);
|
2012-02-13 15:04:50 -05:00
|
|
|
clutter_actor_add_child (stage, text);
|
2009-03-13 17:14:31 -04:00
|
|
|
animation = clutter_actor_animate (text,
|
|
|
|
CLUTTER_EASE_IN_OUT_QUAD,
|
|
|
|
3000,
|
2012-05-02 10:20:52 -04:00
|
|
|
"x", 320.0,
|
|
|
|
"y", 240.0,
|
2009-03-13 17:14:31 -04:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
text = g_object_new (CLUTTER_TYPE_TEXT,
|
|
|
|
"text", "Green",
|
|
|
|
"font-name", "Sans 40px",
|
|
|
|
"color", &green,
|
2012-05-02 10:20:52 -04:00
|
|
|
"x", 0.0,
|
|
|
|
"y", 480.0,
|
2009-03-13 17:14:31 -04:00
|
|
|
NULL);
|
|
|
|
clutter_actor_set_anchor_point_from_gravity (text, CLUTTER_GRAVITY_SOUTH_WEST);
|
2012-02-13 15:04:50 -05:00
|
|
|
clutter_actor_add_child (stage, text);
|
2009-03-13 17:14:31 -04:00
|
|
|
animation = clutter_actor_animate (text,
|
|
|
|
CLUTTER_EASE_IN_OUT_QUAD,
|
|
|
|
3000,
|
2012-05-02 10:20:52 -04:00
|
|
|
"x", 320.0,
|
|
|
|
"y", 240.0,
|
2009-03-13 17:14:31 -04:00
|
|
|
NULL);
|
|
|
|
|
2012-05-02 10:23:28 -04:00
|
|
|
g_signal_connect_after (stage, "realize",
|
|
|
|
G_CALLBACK (on_stage_realized), NULL);
|
2009-03-13 17:14:31 -04:00
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
|
|
|
|
clutter_main ();
|
|
|
|
|
2012-05-02 10:23:28 -04:00
|
|
|
g_object_unref (stage);
|
|
|
|
|
2009-03-13 17:14:31 -04:00
|
|
|
return 0;
|
|
|
|
}
|