/** * \file main.c * \brief Programme de tests. * \author YChoucha * \version 0.2 * \date 14 août 2010 * * Programme qui affhiche des videos avec emotion * */ #include #include #include "lectureFichier.h" /** * \fn win_del(void *data, Evas_Object *obj, void *event_info) * \brief Fonction qui permet de fermer le programme en appuynat sur la croix de la fenetre * * \param data Chaîne à stocker dans l'objet Str_t, ne peut être NULL. * *obj * event_info */ static void win_del(void *data, Evas_Object *obj, void *event_info) { elm_exit(); } static void paused(void *data, Evas_Object *obj, void *event_info) { Evas_Object *ov = data; emotion_object_play_set(ov, 0); emotion_object_position_set(ov, 0); printf("paused %s\n", emotion_object_file_get(ov)); } static void played(void *data, Evas_Object *obj, void *event_info) { Evas_Object * ov = data; printf("hello\n"); if (!emotion_object_file_set(ov, "video2.flv")) { printf("Chargement de la video Fail\n"); } printf("played %s\n", emotion_object_file_get(ov)); } EAPI int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *bx, *obj, *bt; //création d'une fenetre de taille 320 x 300 win = elm_win_add(NULL, "E-Info Memoire", ELM_WIN_BASIC); elm_win_title_set(win, "E-Info Memoire"); evas_object_smart_callback_add(win, "delete,request", win_del, NULL); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, 1.0, 1.0); elm_win_resize_object_add(win, bg); evas_object_show(bg); bx = elm_box_add(win); elm_win_resize_object_add(win, bx); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bx); evas_object_resize(win, 480, 800); //On créer l'objet video obj = emotion_object_add(evas_object_evas_get(win)); if (!emotion_object_init(obj, "xine")) printf("emotion_object_init Fail\n"); emotion_object_vis_set(obj, EMOTION_VIS_NONE); if (!emotion_object_file_set(obj, "video1.flv")) { printf("Chargement de la video Fail\n"); }else printf("Chargement de la video Ok\n"); emotion_object_play_set(obj, 1); //evas_object_move(obj, 0, 0); evas_object_resize(obj, 480, 380); emotion_object_smooth_scale_set(obj, 1); // imposible de positionner l'obj video dans elementary //elm_box_pack_end (bx,obj); //elm_box_pack_start (bx,obj); evas_object_show(obj); //on ajoute un bouton qui change la video bt = elm_button_add(win); elm_button_label_set(bt, "Change video"); elm_box_pack_end(bx, bt); elm_button_autorepeat_set(bt, 1); elm_button_autorepeat_initial_timeout_set(bt, 2.0); elm_button_autorepeat_gap_timeout_set(bt, 0.5); evas_object_show(bt); evas_object_smart_callback_add(bt, "clicked", played, obj); //on affiche a l'écran notre programme evas_object_show(win); elm_run(); elm_shutdown(); return 0; } ELM_MAIN()