summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLionel Landwerlin <llandwerlin@gmail.com>2013-07-01 16:10:55 +0100
committerLionel Landwerlin <llandwerlin@gmail.com>2013-07-08 12:11:09 +0100
commit2b077e89c620c630e4fdaf2d9cb73ab141127ea9 (patch)
treef7b9fadc1448321003926a5a295b39dd64b0af18 /tests
parenta661cbdca1c5a807ab48017cd4c93c149f878b0b (diff)
downloadclutter-gst-2b077e89c620c630e4fdaf2d9cb73ab141127ea9.tar.gz
switch ClutterGst to use ClutterContent
Diffstat (limited to 'tests')
-rw-r--r--tests/test-alpha.c63
-rw-r--r--tests/test-rgb-upload.c56
-rw-r--r--tests/test-start-stop.c54
-rw-r--r--tests/test-video-actor-new-unref-loop.c8
-rw-r--r--tests/test-yuv-upload.c57
5 files changed, 43 insertions, 195 deletions
diff --git a/tests/test-alpha.c b/tests/test-alpha.c
index 6faaac5..f15e0e8 100644
--- a/tests/test-alpha.c
+++ b/tests/test-alpha.c
@@ -32,6 +32,7 @@
#include <glib/gprintf.h>
#include <clutter-gst/clutter-gst.h>
+#include <cogl-gst/cogl-gst.h>
static gint opt_framerate = 30;
static gchar *opt_fourcc = "I420";
@@ -65,44 +66,6 @@ parse_fourcc (const gchar *fourcc)
return GST_STR_FOURCC (fourcc);
}
-static void
-size_change (ClutterGstPlayer *player,
- gint width,
- gint height,
- ClutterActor *actor)
-{
- ClutterActor *stage;
- gfloat new_x, new_y, new_width, new_height;
- gfloat stage_width, stage_height;
-
- stage = clutter_actor_get_stage (actor);
- if (stage == NULL)
- return;
-
- clutter_actor_get_size (stage, &stage_width, &stage_height);
-
- new_height = (height * stage_width) / width;
- if (new_height <= stage_height)
- {
- new_width = stage_width;
-
- new_x = 0;
- new_y = (stage_height - new_height) / 2;
- }
- else
- {
- new_width = (width * stage_height) / height;
- new_height = stage_height;
-
- new_x = (stage_width - new_width) / 2;
- new_y = 0;
- }
-
- g_message ("resize %fx%f @ %fx%f", new_width, new_height, new_x, new_y);
- clutter_actor_set_position (actor, new_x, new_y);
- clutter_actor_set_size (actor, new_width, new_height);
-}
-
int
main (int argc, char *argv[])
{
@@ -116,7 +79,6 @@ main (int argc, char *argv[])
ClutterActor *actor;
ClutterActor *rectangle;
ClutterTransition *animation;
- ClutterGstPlayer *player;
GstPipeline *pipeline;
GstElement *src;
@@ -152,9 +114,6 @@ main (int argc, char *argv[])
rectangle_geom.size.width,
rectangle_geom.size.height);
- actor = clutter_gst_actor_new ();
- clutter_actor_set_opacity (actor, 0);
-
/* Set up pipeline */
pipeline = GST_PIPELINE(gst_pipeline_new (NULL));
@@ -163,6 +122,16 @@ main (int argc, char *argv[])
capsfilter = gst_element_factory_make ("capsfilter", NULL);
sink = clutter_gst_create_video_sink ();
+ /* Video actor */
+ actor = g_object_new (CLUTTER_TYPE_ACTOR,
+ "content", g_object_new (CLUTTER_GST_TYPE_CONTENT,
+ "video-sink", sink,
+ NULL),
+ "width", clutter_actor_get_width (stage),
+ "height", clutter_actor_get_height (stage),
+ NULL);
+ clutter_actor_set_opacity (actor, 0);
+
/* make videotestsrc spit the format we want */
if (g_strcmp0 (opt_fourcc, "RGB ") == 0)
{
@@ -192,20 +161,10 @@ main (int argc, char *argv[])
g_critical("Could not link elements");
gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING);
- player = CLUTTER_GST_PLAYER (g_object_new (CLUTTER_GST_TYPE_PIPELINE,
- "video-sink", sink, NULL));
-
- g_signal_connect (player,
- "size-change",
- G_CALLBACK (size_change), actor);
-
clutter_actor_add_child (stage, rectangle);
clutter_actor_add_child (stage, actor);
clutter_actor_show (stage);
- clutter_gst_actor_set_player (CLUTTER_GST_ACTOR (actor), player);
-
-
clutter_actor_save_easing_state (actor);
clutter_actor_set_easing_mode (actor, CLUTTER_LINEAR);
clutter_actor_set_easing_duration (actor, 6000);
diff --git a/tests/test-rgb-upload.c b/tests/test-rgb-upload.c
index eae4d5d..aa8f202 100644
--- a/tests/test-rgb-upload.c
+++ b/tests/test-rgb-upload.c
@@ -63,43 +63,6 @@ static GOptionEntry options[] =
{ NULL }
};
-void
-size_change (ClutterGstPlayer *player,
- gint width,
- gint height,
- ClutterActor *actor)
-{
- ClutterActor *stage;
- gfloat new_x, new_y, new_width, new_height;
- gfloat stage_width, stage_height;
-
- stage = clutter_actor_get_stage (actor);
- if (stage == NULL)
- return;
-
- clutter_actor_get_size (stage, &stage_width, &stage_height);
-
- new_height = (height * stage_width) / width;
- if (new_height <= stage_height)
- {
- new_width = stage_width;
-
- new_x = 0;
- new_y = (stage_height - new_height) / 2;
- }
- else
- {
- new_width = (width * stage_height) / height;
- new_height = stage_height;
-
- new_x = (stage_height - new_width) / 2;
- new_y = 0;
- }
-
- clutter_actor_set_position (actor, new_x, new_y);
- clutter_actor_set_size (actor, new_width, new_height);
-}
-
int
main (int argc, char *argv[])
{
@@ -132,7 +95,6 @@ main (int argc, char *argv[])
stage = clutter_stage_new ();
clutter_actor_set_size (CLUTTER_ACTOR (stage), 320.0f, 240.0f);
- actor = clutter_gst_actor_new ();
/* Set up pipeline */
pipeline = GST_PIPELINE(gst_pipeline_new (NULL));
@@ -141,6 +103,16 @@ main (int argc, char *argv[])
capsfilter = gst_element_factory_make ("capsfilter", NULL);
sink = clutter_gst_create_video_sink ();
+ /* Video actor */
+ actor = g_object_new (CLUTTER_TYPE_ACTOR,
+ "content", g_object_new (CLUTTER_GST_TYPE_CONTENT,
+ "video-sink", sink,
+ NULL),
+ "width", clutter_actor_get_width (stage),
+ "height", clutter_actor_get_height (stage),
+ NULL);
+
+
format = gst_video_format_from_masks(opt_depth, opt_bpp, G_BIG_ENDIAN,
0xff0000,
0x00ff00,
@@ -160,14 +132,6 @@ main (int argc, char *argv[])
g_critical("Could not link elements");
gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING);
-
- player = CLUTTER_GST_PLAYER (g_object_new (CLUTTER_GST_TYPE_PIPELINE,
- "video-sink", sink, NULL));
- clutter_gst_actor_set_player (CLUTTER_GST_ACTOR (actor), player);
- g_signal_connect (player,
- "size-change",
- G_CALLBACK (size_change), actor);
-
clutter_actor_add_child (stage, actor);
clutter_actor_show (stage);
diff --git a/tests/test-start-stop.c b/tests/test-start-stop.c
index a9efe4d..9bc1ea9 100644
--- a/tests/test-start-stop.c
+++ b/tests/test-start-stop.c
@@ -33,45 +33,6 @@
char *video_files[] = {NULL, NULL};
void
-size_change (ClutterGstPlayer *player,
- gint width,
- gint height,
- ClutterActor *actor)
-{
- ClutterActor *stage = clutter_actor_get_stage (actor);
- gfloat new_x, new_y, new_width, new_height;
- gfloat stage_width, stage_height;
-
- g_message ("size change %ix%i", width, height);
-
- clutter_actor_get_size (stage, &stage_width, &stage_height);
-
- /* new_height = (height * stage_width) / width; */
- /* if (new_height <= stage_height) */
- /* { */
- /* new_width = stage_width; */
-
- /* new_x = 0; */
- /* new_y = (stage_height - new_height) / 2; */
- /* } */
- /* else */
- /* { */
- /* new_width = (width * stage_height) / height; */
- /* new_height = stage_height; */
-
- /* new_x = (stage_width - new_width) / 2; */
- /* new_y = 0; */
- /* } */
-
- /* clutter_actor_set_position (actor, new_x, new_y); */
- clutter_actor_set_size (actor, stage_width, stage_height);
-
- g_message (" new pos/size -> x,y=%.2fx%.2f w,h=%.2fx%.2f",
- new_x, new_y, stage_width, stage_height);
-
-}
-
-void
on_error (ClutterGstPlayer *player)
{
g_print ("error\n");
@@ -151,17 +112,18 @@ main (int argc, char *argv[])
stage = clutter_stage_new ();
clutter_actor_set_background_color (stage, &stage_color);
- video = clutter_gst_aspectratio_new ();
-
player = clutter_gst_playback_new ();
- clutter_gst_actor_set_player (CLUTTER_GST_ACTOR (video), CLUTTER_GST_PLAYER (player));
+
+ video = g_object_new (CLUTTER_TYPE_ACTOR,
+ "content", g_object_new (CLUTTER_GST_TYPE_ASPECTRATIO,
+ "player", player,
+ NULL),
+ "width", clutter_actor_get_width (stage),
+ "height", clutter_actor_get_height (stage),
+ NULL);
clutter_actor_add_child (stage, video);
g_signal_connect (player,
- "size-change",
- G_CALLBACK(size_change),
- video);
- g_signal_connect (player,
"error",
G_CALLBACK(on_error),
video);
diff --git a/tests/test-video-actor-new-unref-loop.c b/tests/test-video-actor-new-unref-loop.c
index fd98a6a..15714e6 100644
--- a/tests/test-video-actor-new-unref-loop.c
+++ b/tests/test-video-actor-new-unref-loop.c
@@ -35,7 +35,7 @@
int
main (int argc, char *argv[])
{
- ClutterActor *vactor;
+ ClutterGstPlayer *player;
int i;
clutter_gst_init (&argc, &argv);
@@ -43,9 +43,9 @@ main (int argc, char *argv[])
for (i = 0; ; i++)
{
g_debug("VideoActor #%d", i);
- vactor = clutter_gst_actor_new ();
- g_object_ref_sink (vactor);
- g_object_unref (vactor);
+ player = CLUTTER_GST_PLAYER (clutter_gst_playback_new ());
+ g_object_ref_sink (player);
+ g_object_unref (player);
}
return EXIT_SUCCESS;
diff --git a/tests/test-yuv-upload.c b/tests/test-yuv-upload.c
index 1a451bf..347bcd0 100644
--- a/tests/test-yuv-upload.c
+++ b/tests/test-yuv-upload.c
@@ -52,43 +52,6 @@ static GOptionEntry options[] =
{ NULL }
};
-void
-size_change (ClutterGstPlayer *player,
- gint width,
- gint height,
- ClutterActor *actor)
-{
- ClutterActor *stage;
- gfloat new_x, new_y, new_width, new_height;
- gfloat stage_width, stage_height;
-
- stage = clutter_actor_get_stage (actor);
- if (stage == NULL)
- return;
-
- clutter_actor_get_size (stage, &stage_width, &stage_height);
-
- new_height = (height * stage_width) / width;
- if (new_height <= stage_height)
- {
- new_width = stage_width;
-
- new_x = 0;
- new_y = (stage_height - new_height) / 2;
- }
- else
- {
- new_width = (width * stage_height) / height;
- new_height = stage_height;
-
- new_x = (stage_width - new_width) / 2;
- new_y = 0;
- }
-
- clutter_actor_set_position (actor, new_x, new_y);
- clutter_actor_set_size (actor, new_width, new_height);
-}
-
int
main (int argc, char *argv[])
{
@@ -118,9 +81,8 @@ main (int argc, char *argv[])
}
stage = clutter_stage_new ();
- clutter_actor_set_size (CLUTTER_ACTOR(stage), 320.0f, 240.0f);
+ clutter_actor_set_size (CLUTTER_ACTOR (stage), 320.0f, 240.0f);
- actor = g_object_new (CLUTTER_GST_TYPE_ACTOR, NULL);
/* Set up pipeline */
pipeline = GST_PIPELINE(gst_pipeline_new (NULL));
@@ -129,6 +91,15 @@ main (int argc, char *argv[])
capsfilter = gst_element_factory_make ("capsfilter", NULL);
sink = clutter_gst_create_video_sink ();
+ /* Video actor */
+ actor = g_object_new (CLUTTER_TYPE_ACTOR,
+ "content", g_object_new (CLUTTER_GST_TYPE_CONTENT,
+ "video-sink", sink,
+ NULL),
+ "width", clutter_actor_get_width (stage),
+ "height", clutter_actor_get_height (stage),
+ NULL);
+
/* make videotestsrc spit the format we want */
caps = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, opt_fourcc,
@@ -143,15 +114,7 @@ main (int argc, char *argv[])
g_critical("Could not link elements");
gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING);
- player = CLUTTER_GST_PLAYER (g_object_new (CLUTTER_GST_TYPE_PIPELINE,
- "video-sink", sink, NULL));
- clutter_gst_actor_set_player (CLUTTER_GST_ACTOR (actor), player);
- g_signal_connect (player,
- "size-change",
- G_CALLBACK (size_change), actor);
-
clutter_actor_add_child (stage, actor);
- /* clutter_actor_set_opacity (texture, 0x11); */
clutter_actor_show (stage);
clutter_main();