summaryrefslogtreecommitdiff
path: root/tests/test-yuv-upload.c
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/test-yuv-upload.c
parenta661cbdca1c5a807ab48017cd4c93c149f878b0b (diff)
downloadclutter-gst-2b077e89c620c630e4fdaf2d9cb73ab141127ea9.tar.gz
switch ClutterGst to use ClutterContent
Diffstat (limited to 'tests/test-yuv-upload.c')
-rw-r--r--tests/test-yuv-upload.c57
1 files changed, 10 insertions, 47 deletions
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();