diff options
Diffstat (limited to 'tests/test-start-stop.c')
-rw-r--r-- | tests/test-start-stop.c | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/tests/test-start-stop.c b/tests/test-start-stop.c index d9b9e7e..a9efe4d 100644 --- a/tests/test-start-stop.c +++ b/tests/test-start-stop.c @@ -33,36 +33,42 @@ char *video_files[] = {NULL, NULL}; void -size_change (ClutterActor *actor, - gint width, - gint height, - gpointer user_data) +size_change (ClutterGstPlayer *player, + gint width, + gint height, + ClutterActor *actor) { - ClutterActor *stage = (ClutterActor *)user_data; + 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_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 = 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; - } + /* 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); - clutter_actor_set_position (actor, new_x, new_y); - clutter_actor_set_size (actor, new_width, new_height); } void @@ -145,23 +151,21 @@ main (int argc, char *argv[]) stage = clutter_stage_new (); clutter_actor_set_background_color (stage, &stage_color); - player = clutter_gst_playback_new (); + video = clutter_gst_aspectratio_new (); - video = /* clutter_gst_actor_new () */ g_object_new (CLUTTER_GST_TYPE_ACTOR, - NULL); - g_assert (CLUTTER_GST_IS_ACTOR (video)); + player = clutter_gst_playback_new (); clutter_gst_actor_set_player (CLUTTER_GST_ACTOR (video), CLUTTER_GST_PLAYER (player)); clutter_actor_add_child (stage, video); - g_signal_connect (video, + g_signal_connect (player, "size-change", G_CALLBACK(size_change), - stage); + video); g_signal_connect (player, "error", G_CALLBACK(on_error), - stage); - g_timeout_add (5000, test, video); + video); + g_timeout_add (5000, test, player); clutter_gst_playback_set_filename (player, video_files[0]); clutter_gst_player_set_audio_volume (CLUTTER_GST_PLAYER (player), 0.5); clutter_gst_player_set_playing (CLUTTER_GST_PLAYER (player), TRUE); |