1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2
3 #define GST_USE_UNSTABLE_API
4 #include "shell-recorder.h"
5 #include <clutter/clutter.h>
6 #include <gst/gst.h>
7
8 /* Very simple test of the ShellRecorder class; shows some text strings
9 * moving around and records it.
10 */
11 static ShellRecorder *recorder = NULL;
12
13 static gboolean
14 stop_recording_timeout (gpointer data)
15 {
16 if (recorder)
17 {
18 shell_recorder_close (recorder);
19 g_object_unref (recorder);
20 }
21
22 clutter_main_quit ();
23
24 return FALSE;
25 }
26
27 static void
28 on_animation_completed (ClutterAnimation *animation)
29 {
30 g_timeout_add (1000, stop_recording_timeout, NULL);
31 }
32
33 static void
34 on_stage_realized (ClutterActor *stage,
35 gpointer data)
36 {
37 recorder = shell_recorder_new (CLUTTER_STAGE (stage));
38 shell_recorder_set_filename (recorder, "test-recorder.ogg");
39 shell_recorder_record (recorder);
40 }
41
42 int main (int argc, char **argv)
43 {
44 ClutterActor *stage;
45 ClutterActor *text;
46 ClutterAnimation *animation;
47 ClutterColor red, green, blue;
48
49 gst_init (&argc, &argv);
50 if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
51 return 1;
52
53 clutter_color_from_string (&red, "red");
54 clutter_color_from_string (&green, "green");
55 clutter_color_from_string (&blue, "blue");
56 stage = clutter_stage_new ();
57 g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
58
59 text = g_object_new (CLUTTER_TYPE_TEXT,
60 "text", "Red",
61 "font-name", "Sans 40px",
62 "color", &red,
63 NULL);
64 clutter_actor_add_child (stage, text);
65 animation = clutter_actor_animate (text,
(emitted by gcc) 66 CLUTTER_EASE_IN_OUT_QUAD,
67 3000,
68 "x", 320.0,
69 "y", 240.0,
70 NULL);
71 g_signal_connect (animation, "completed",
72 G_CALLBACK (on_animation_completed), NULL);
73
74 text = g_object_new (CLUTTER_TYPE_TEXT,
75 "text", "Blue",
76 "font-name", "Sans 40px",
77 "color", &blue,
78 "x", 640.0,
79 "y", 0.0,
80 NULL);
81 clutter_actor_set_anchor_point_from_gravity (text, CLUTTER_GRAVITY_NORTH_EAST);
(emitted by gcc) 82 clutter_actor_add_child (stage, text);
83 animation = clutter_actor_animate (text,
(emitted by gcc) (emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
84 CLUTTER_EASE_IN_OUT_QUAD,
85 3000,
86 "x", 320.0,
87 "y", 240.0,
88 NULL);
89
90 text = g_object_new (CLUTTER_TYPE_TEXT,
91 "text", "Green",
92 "font-name", "Sans 40px",
93 "color", &green,
94 "x", 0.0,
95 "y", 480.0,
96 NULL);
97 clutter_actor_set_anchor_point_from_gravity (text, CLUTTER_GRAVITY_SOUTH_WEST);
(emitted by gcc) 98 clutter_actor_add_child (stage, text);
99 animation = clutter_actor_animate (text,
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
(emitted by gcc) 100 CLUTTER_EASE_IN_OUT_QUAD,
101 3000,
102 "x", 320.0,
103 "y", 240.0,
104 NULL);
105
106 g_signal_connect_after (stage, "realize",
107 G_CALLBACK (on_stage_realized), NULL);
108
109 clutter_actor_show (stage);
110
111 clutter_main ();
112
113 g_object_unref (stage);
114
115 return 0;
116 }