Advertisement
Guest User

Untitled

a guest
Feb 28th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. /**
  2. * \file main.c
  3. * \brief Programme de tests.
  4. * \author YChoucha
  5. * \version 0.2
  6. * \date 14 août 2010
  7. *
  8. * Programme qui affhiche des videos avec emotion
  9. *
  10. */
  11.  
  12. #include <Elementary.h>
  13. #include <Emotion.h>
  14. #include "lectureFichier.h"
  15.  
  16. /**
  17. * \fn win_del(void *data, Evas_Object *obj, void *event_info)
  18. * \brief Fonction qui permet de fermer le programme en appuynat sur la croix de la fenetre
  19. *
  20. * \param data Chaîne à stocker dans l'objet Str_t, ne peut être NULL.
  21. * *obj
  22. * event_info
  23. */
  24. static void
  25. win_del(void *data, Evas_Object *obj, void *event_info) {
  26. elm_exit();
  27. }
  28.  
  29. static void
  30. paused(void *data, Evas_Object *obj, void *event_info) {
  31. Evas_Object *ov = data;
  32. emotion_object_play_set(ov, 0);
  33. emotion_object_position_set(ov, 0);
  34.  
  35. printf("paused %s\n", emotion_object_file_get(ov));
  36.  
  37. }
  38.  
  39. static void
  40. played(void *data, Evas_Object *obj, void *event_info) {
  41.  
  42. Evas_Object * ov = data;
  43.  
  44. printf("hello\n");
  45.  
  46. if (!emotion_object_file_set(ov, "video2.flv")) {
  47. printf("Chargement de la video Fail\n");
  48. }
  49.  
  50.  
  51. printf("played %s\n", emotion_object_file_get(ov));
  52.  
  53. }
  54.  
  55. EAPI int
  56. elm_main(int argc, char **argv) {
  57.  
  58. Evas_Object *win, *bg, *bx, *obj, *bt;
  59.  
  60. //création d'une fenetre de taille 320 x 300
  61. win = elm_win_add(NULL, "E-Info Memoire", ELM_WIN_BASIC);
  62. elm_win_title_set(win, "E-Info Memoire");
  63. evas_object_smart_callback_add(win, "delete,request", win_del, NULL);
  64.  
  65. bg = elm_bg_add(win);
  66. evas_object_size_hint_weight_set(bg, 1.0, 1.0);
  67. elm_win_resize_object_add(win, bg);
  68. evas_object_show(bg);
  69.  
  70. bx = elm_box_add(win);
  71. elm_win_resize_object_add(win, bx);
  72. evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  73. evas_object_show(bx);
  74.  
  75. evas_object_resize(win, 480, 800);
  76.  
  77. //On créer l'objet video
  78. obj = emotion_object_add(evas_object_evas_get(win));
  79. if (!emotion_object_init(obj, "xine"))
  80. printf("emotion_object_init Fail\n");
  81. emotion_object_vis_set(obj, EMOTION_VIS_NONE);
  82. if (!emotion_object_file_set(obj, "video1.flv")) {
  83. printf("Chargement de la video Fail\n");
  84. }else
  85. printf("Chargement de la video Ok\n");
  86. emotion_object_play_set(obj, 1);
  87. //evas_object_move(obj, 0, 0);
  88.  
  89. evas_object_resize(obj, 480, 380);
  90. emotion_object_smooth_scale_set(obj, 1);
  91.  
  92.  
  93. // imposible de positionner l'obj video dans elementary
  94. //elm_box_pack_end (bx,obj);
  95. //elm_box_pack_start (bx,obj);
  96. evas_object_show(obj);
  97.  
  98. //on ajoute un bouton qui change la video
  99. bt = elm_button_add(win);
  100. elm_button_label_set(bt, "Change video");
  101. elm_box_pack_end(bx, bt);
  102. elm_button_autorepeat_set(bt, 1);
  103. elm_button_autorepeat_initial_timeout_set(bt, 2.0);
  104. elm_button_autorepeat_gap_timeout_set(bt, 0.5);
  105. evas_object_show(bt);
  106.  
  107. evas_object_smart_callback_add(bt, "clicked", played, obj);
  108.  
  109.  
  110. //on affiche a l'écran notre programme
  111. evas_object_show(win);
  112.  
  113. elm_run();
  114.  
  115. elm_shutdown();
  116.  
  117. return 0;
  118. }
  119. ELM_MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement