2009-10-27 15:27:45 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2009-03-13 21:14:31 +00: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.
|
|
|
|
*/
|
|
|
|
static ShellRecorder *recorder;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
stop_recording_timeout (gpointer data)
|
|
|
|
{
|
|
|
|
shell_recorder_close (recorder);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_animation_completed (ClutterAnimation *animation)
|
|
|
|
{
|
|
|
|
g_timeout_add (1000, stop_recording_timeout, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
ClutterActor *stage;
|
|
|
|
ClutterActor *text;
|
|
|
|
ClutterAnimation *animation;
|
|
|
|
ClutterColor red, green, blue;
|
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
2011-03-13 18:16:54 +00:00
|
|
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
2011-03-13 18:26:01 +00:00
|
|
|
return 1;
|
2009-03-13 21:14:31 +00:00
|
|
|
|
|
|
|
clutter_color_from_string (&red, "red");
|
|
|
|
clutter_color_from_string (&green, "green");
|
|
|
|
clutter_color_from_string (&blue, "blue");
|
|
|
|
stage = clutter_stage_get_default ();
|
|
|
|
|
|
|
|
text = g_object_new (CLUTTER_TYPE_TEXT,
|
|
|
|
"text", "Red",
|
|
|
|
"font-name", "Sans 40px",
|
|
|
|
"color", &red,
|
|
|
|
NULL);
|
|
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text);
|
|
|
|
animation = clutter_actor_animate (text,
|
|
|
|
CLUTTER_EASE_IN_OUT_QUAD,
|
|
|
|
3000,
|
|
|
|
"x", 320,
|
|
|
|
"y", 240,
|
|
|
|
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,
|
|
|
|
"x", 640,
|
|
|
|
"y", 0,
|
|
|
|
NULL);
|
|
|
|
clutter_actor_set_anchor_point_from_gravity (text, CLUTTER_GRAVITY_NORTH_EAST);
|
|
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text);
|
|
|
|
animation = clutter_actor_animate (text,
|
|
|
|
CLUTTER_EASE_IN_OUT_QUAD,
|
|
|
|
3000,
|
|
|
|
"x", 320,
|
|
|
|
"y", 240,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
text = g_object_new (CLUTTER_TYPE_TEXT,
|
|
|
|
"text", "Green",
|
|
|
|
"font-name", "Sans 40px",
|
|
|
|
"color", &green,
|
|
|
|
"x", 0,
|
|
|
|
"y", 480,
|
|
|
|
NULL);
|
|
|
|
clutter_actor_set_anchor_point_from_gravity (text, CLUTTER_GRAVITY_SOUTH_WEST);
|
|
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text);
|
|
|
|
animation = clutter_actor_animate (text,
|
|
|
|
CLUTTER_EASE_IN_OUT_QUAD,
|
|
|
|
3000,
|
|
|
|
"x", 320,
|
|
|
|
"y", 240,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
recorder = shell_recorder_new (CLUTTER_STAGE (stage));
|
|
|
|
shell_recorder_set_filename (recorder, "test-recorder.ogg");
|
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
|
|
|
|
shell_recorder_record (recorder);
|
|
|
|
clutter_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|