Enlightenment CVS committal

Author  : moom16
Project : e17
Module  : apps/eclair

Dir     : e17/apps/eclair/src


Modified Files:
        eclair.c eclair.h eclair_args.c eclair_callbacks.c 
        eclair_meta_tag.c 


Log Message:

GuYgUy's patch:
- More key bindings (a la mplayer, audio level control with '/' and '*', ...)
- Use fprintf instead of printf

Thanks to GuYgUy ;)


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- eclair.c    30 Apr 2005 12:11:16 -0000      1.4
+++ eclair.c    30 Apr 2005 17:28:22 -0000      1.5
@@ -136,6 +136,7 @@
    eclair_subtitles_display_current_subtitle(&eclair->subtitles, position, 
eclair->subtitles_object);
 }
 
+//TODO:
 //Set the file as current
 void eclair_current_file_set(Eclair *eclair, const Eclair_Media_File *file)
 {   
@@ -184,15 +185,28 @@
    eclair_cover_add_file_to_treat(&eclair->cover_manager, file);
 }
 
-//Set media progress rate
-void eclair_progress_rate_set(Eclair *eclair, double progress_rate)
+//Set the cover displayed on the GUI
+//Remove it if cover_path == NULL
+void eclair_gui_cover_set(Eclair *eclair, const char *cover_path)
 {
+   Evas_Coord cover_width, cover_height;
+
    if (!eclair)
       return;
-   if (!eclair->video_object)
+   if (!eclair->gui_object || !eclair->gui_cover)
       return;
 
-   emotion_object_position_set(eclair->video_object, 
emotion_object_play_length_get(eclair->video_object) * progress_rate);
+   edje_object_part_unswallow(eclair->gui_object, eclair->gui_cover);
+   if (!cover_path)
+      evas_object_hide(eclair->gui_cover);
+   else
+   {
+      evas_object_image_file_set(eclair->gui_cover, cover_path, NULL);
+      edje_object_part_geometry_get(eclair->gui_object, "cover", NULL, NULL, 
&cover_width, &cover_height);
+      evas_object_image_fill_set(eclair->gui_cover, 0, 0, cover_width, 
cover_height);
+      edje_object_part_swallow(eclair->gui_object, "cover", eclair->gui_cover);
+      evas_object_show(eclair->gui_cover);
+   }
 }
 
 //Set the scroll percent of the playlist container
@@ -400,28 +414,27 @@
    eclair->state = ECLAIR_STOP;
 }
 
-//Set the cover displayed on the GUI
-//Remove it if cover_path == NULL
-void eclair_gui_cover_set(Eclair *eclair, const char *cover_path)
+//Set audio level
+void eclair_audio_level_set(Eclair *eclair, double audio_level)
 {
-   Evas_Coord cover_width, cover_height;
+   if (!eclair)
+      return;
+
+   if (eclair->video_object)
+      emotion_object_audio_volume_set(eclair->video_object, audio_level);
+   if (eclair->gui_object)
+      edje_object_part_drag_value_set(eclair->gui_object, "volume_bar_drag", 
audio_level, 0);
+}
 
+//Set media progress rate
+void eclair_progress_rate_set(Eclair *eclair, double progress_rate)
+{
    if (!eclair)
       return;
-   if (!eclair->gui_object || !eclair->gui_cover)
+   if (!eclair->video_object)
       return;
 
-   edje_object_part_unswallow(eclair->gui_object, eclair->gui_cover);
-   if (!cover_path)
-      evas_object_hide(eclair->gui_cover);
-   else
-   {
-      evas_object_image_file_set(eclair->gui_cover, cover_path, NULL);
-      edje_object_part_geometry_get(eclair->gui_object, "cover", NULL, NULL, 
&cover_width, &cover_height);
-      evas_object_image_fill_set(eclair->gui_cover, 0, 0, cover_width, 
cover_height);
-      edje_object_part_swallow(eclair->gui_object, "cover", eclair->gui_cover);
-      evas_object_show(eclair->gui_cover);
-   }
+   emotion_object_position_set(eclair->video_object, 
emotion_object_play_length_get(eclair->video_object) * progress_rate);
 }
 
 //Create the gui window and load the interface
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- eclair.h    30 Apr 2005 12:11:16 -0000      1.2
+++ eclair.h    30 Apr 2005 17:28:23 -0000      1.3
@@ -7,10 +7,8 @@
 Evas_Bool eclair_init(Eclair *eclair, int *argc, char *argv[]);
 void eclair_shutdown(Eclair *eclair);
 void eclair_update(Eclair *eclair);
-void eclair_update_tag_and_cover(Eclair *eclair);
 void *eclair_file_chooser_thread(void *param);
 void eclair_current_file_set(Eclair *eclair, const Eclair_Media_File *file);
-void eclair_progress_rate_set(Eclair *eclair, double progress_rate);
 void eclair_playlist_container_scroll(Eclair *eclair, int num_entries);
 void eclair_playlist_container_scroll_percent_set(Eclair *eclair, double 
percent);
 void eclair_gui_cover_set(Eclair *eclair, const char *cover_path);
@@ -23,5 +21,7 @@
 void eclair_pause(Eclair *eclair);
 void eclair_play(Eclair *eclair);
 void eclair_stop(Eclair *eclair);
+void eclair_progress_rate_set(Eclair *eclair, double progress_rate);
+void eclair_audio_level_set(Eclair *eclair, double audio_level);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair_args.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- eclair_args.c       17 Apr 2005 08:30:58 -0000      1.1
+++ eclair_args.c       30 Apr 2005 17:28:23 -0000      1.2
@@ -12,14 +12,14 @@
          if (strcmp(argv[i], "--help") == 0)
          {
             //TODO: Display help message
-            printf("Help: (TODO)\n--gui-engine [software|gl]\n--video-engine 
[software|gl]\n");
+            fprintf(stderr, "Help: (TODO)\n--gui-engine 
[software|gl]\n--video-engine [software|gl]\n");
             return 0;
          }
          else if (strcmp(argv[i], "--gui-engine") == 0)
          {
             if (argc <= i + 1)
             {
-               printf("Correct gui engines are: software gl\nDefault is: 
software\n\n");
+               fprintf(stderr, "Correct gui engines are: software gl\nDefault 
is: software\n\n");
                return 0;
             }
             else
@@ -31,7 +31,7 @@
                   eclair->gui_engine = ECLAIR_GL;
                else
                {
-                  printf("Correct gui engines are: software gl\nDefault is: 
software\n\n");
+                  fprintf(stderr, "Correct gui engines are: software 
gl\nDefault is: software\n\n");
                   return 0;
                }
             }
@@ -40,7 +40,7 @@
          {
             if (argc <= i + 1)
             {
-               printf("Correct video engines are: software gl\nDefault is: 
software\n\n");
+               fprintf(stderr, "Correct video engines are: software 
gl\nDefault is: software\n\n");
                return 0;
             }
             else
@@ -52,13 +52,13 @@
                   eclair->video_engine = ECLAIR_GL;
                else
                {
-                  printf("Correct video engines are: software gl\nDefault is: 
software\n\n");
+                  fprintf(stderr, "Correct video engines are: software 
gl\nDefault is: software\n\n");
                   return 0;
                }
             }
          }
          else
-            printf("Unknown option: %s\nTry `eclair --help' for more 
information.\n\n", argv[i]);
+            fprintf(stderr, "Unknown option: %s\nTry `eclair --help' for more 
information.\n\n", argv[i]);
       }
       else
          *filenames = evas_list_append(*filenames, argv[i]);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair_callbacks.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- eclair_callbacks.c  30 Apr 2005 12:11:16 -0000      1.3
+++ eclair_callbacks.c  30 Apr 2005 17:28:23 -0000      1.4
@@ -103,24 +103,24 @@
    if (!eclair)
       return;
 
-   if (strcmp(ev->keyname, "f") == 0)
+   if (strcmp(ev->key, "f") == 0)
    {
-      if (!eclair->video_window)
-         return;
-
-      ecore_evas_fullscreen_set(eclair->video_window, 
!ecore_evas_fullscreen_get(eclair->video_window));
+      if (eclair->video_window)
+         ecore_evas_fullscreen_set(eclair->video_window, 
!ecore_evas_fullscreen_get(eclair->video_window));
    }
-   else if (strcmp(ev->keyname, "space") == 0)
+   else if (strcmp(ev->key, "space") == 0 || strcmp(ev->key, "p") == 0)
    {
       if (eclair->state == ECLAIR_PLAYING)
          eclair_pause(eclair);
       else
          eclair_play(eclair);
    }
-   else if (strcmp(ev->keyname, "escape") == 0)
+   else if (strcmp(ev->key, "escape") == 0 || strcmp(ev->key, "q") == 0)
       eclair_shutdown(eclair);
-   else if (strcmp(ev->keyname, "Left") == 0 || strcmp(ev->keyname, "Right") 
== 0
-      || strcmp(ev->keyname, "Down") == 0 || strcmp(ev->keyname, "Up") == 0)
+   else if (strcmp(ev->key, "Left") == 0 || strcmp(ev->key, "Right") == 0
+      || strcmp(ev->key, "Down") == 0 || strcmp(ev->key, "Up") == 0
+      || strcmp(ev->key, "Prior") == 0 || strcmp(ev->key, "Next") == 0
+      || strcmp(ev->key, "Home") == 0)
    {
       if (!eclair->video_object)
          return;
@@ -128,21 +128,46 @@
       if (eclair->seek_to_pos < 0.0)
          eclair->seek_to_pos = 
emotion_object_position_get(eclair->video_object);
    
-      if (strcmp(ev->keyname, "Left") == 0)
+      if (strcmp(ev->key, "Left") == 0)
          eclair->seek_to_pos -= 15.0;
-      else if (strcmp(ev->keyname, "Right") == 0)
+      else if (strcmp(ev->key, "Right") == 0)
          eclair->seek_to_pos += 15.0;
-      else if (strcmp(ev->keyname, "Down") == 0)
+      else if (strcmp(ev->key, "Down") == 0)
          eclair->seek_to_pos -= 60.0;
-      else if (strcmp(ev->keyname, "Up") == 0)
+      else if (strcmp(ev->key, "Up") == 0)
          eclair->seek_to_pos += 60.0;
+      else if (strcmp(ev->key, "Prior") == 0)
+         eclair->seek_to_pos -= 600.0; 
+      else if (strcmp(ev->key, "Next") == 0)
+         eclair->seek_to_pos += 600.0; 
+      else if (strcmp(ev->key, "Home") == 0)
+         eclair->seek_to_pos = 0.0; 
 
       eclair->dont_update_progressbar = 1;
       emotion_object_position_set(eclair->video_object, eclair->seek_to_pos);
       if (eclair->seek_to_pos < 0.0)
          eclair->seek_to_pos = 0.0;
-      if (eclair->seek_to_pos > 
emotion_object_play_length_get(eclair->video_object))
-         eclair->seek_to_pos = 
emotion_object_play_length_get(eclair->video_object);
+      else if (eclair->seek_to_pos > 
emotion_object_play_length_get(eclair->video_object))
+         eclair->seek_to_pos = 
emotion_object_play_length_get(eclair->video_object) - 1;
+   }
+   else if (strcmp(ev->key, "KP_Divide") == 0 || strcmp(ev->key, "slash") == 0 
+      || strcmp(ev->key, "KP_Multiply") == 0 || strcmp(ev->key, "asterisk") == 
0)
+   {
+      double volume;
+
+      if (!eclair->gui_object)
+         return;
+
+      edje_object_part_drag_value_get(eclair->gui_object, "volume_bar_drag", 
&volume, 0);
+      if (strcmp(ev->key, "KP_Divide") == 0 || strcmp(ev->key, "slash") == 0)
+         volume -= (1.0 / 100);
+      else if (strcmp(ev->key, "KP_Multiply") == 0 || strcmp (ev->key, 
"asterisk") == 0)
+         volume += (1.0 / 100);
+      if (volume < 0.0)
+         volume = 0.0;
+      else if (volume > 1.0)
+         volume = 1.0;
+      eclair_audio_level_set(eclair, volume);
    }
 }
 
@@ -252,13 +277,13 @@
 void eclair_gui_volume_bar_cb(void *data, Evas_Object *edje_object, const char 
*emission, const char *source)
 {
    Eclair *eclair = (Eclair *)data;
-   double x;
+   double volume;
 
    if (!eclair)
       return;
 
-   edje_object_part_drag_value_get(eclair->gui_object, "volume_bar_drag", &x, 
NULL);
-   emotion_object_audio_volume_set(eclair->video_object, x);
+   edje_object_part_drag_value_get(eclair->gui_object, "volume_bar_drag", 
&volume, NULL);
+   eclair_audio_level_set(eclair, volume);
 }
 
 //Called when the user drag the scrollbar button of the playlist
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair_meta_tag.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- eclair_meta_tag.c   30 Apr 2005 12:11:16 -0000      1.1
+++ eclair_meta_tag.c   30 Apr 2005 17:28:23 -0000      1.2
@@ -91,7 +91,6 @@
    pthread_mutex_lock(&meta_tag_manager->meta_tag_mutex);
    for (;;)
    {
-      printf("Tag fini\n");
       pthread_cond_wait(&meta_tag_manager->meta_tag_cond, 
&meta_tag_manager->meta_tag_mutex);
       while (meta_tag_manager->meta_tag_files_to_scan || 
meta_tag_manager->meta_tag_delete_thread)
       {




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to