emotion: set volume when files are opened.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Oct 2008 16:20:02 +0000 (16:20 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Oct 2008 16:20:02 +0000 (16:20 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/emotion@36531 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/gstreamer/emotion_gstreamer.c
src/modules/xine/emotion_xine.c
src/modules/xine/emotion_xine.h

index 97d2491..8258ab5 100644 (file)
@@ -453,6 +453,8 @@ em_file_open(const char   *file,
      _free_metadata(ev->metadata);
    ev->metadata = calloc(1, sizeof(Emotion_Gstreamer_Metadata));
 
+  em_audio_channel_volume_set(ev, ev->volume);
+
    _eos_timer_fct(ev);
 
    return 1;
index e1e4576..c76bf1d 100644 (file)
@@ -215,6 +215,7 @@ _em_slave(void *par)
                            ev->ratio = (double)v / 10000.0;
                            ev->just_loaded = 1;
                            ev->get_poslen = 0;
+                           xine_set_param(ev->stream, XINE_PARAM_AUDIO_VOLUME, ev->volume * 100);
                         }
                       _em_module_event(ev, 2); /* event - open done */
                    }
@@ -312,12 +313,7 @@ _em_slave(void *par)
                  break;
                case 10: /* vol */
                    {
-                      double vol;
-                      
-                      vol = *((double *)eev->xine_event);
-                      if (vol < 0.0) vol = 0.0;
-                      if (vol > 1.0) vol = 1.0;
-                      xine_set_param(ev->stream, XINE_PARAM_AUDIO_VOLUME, vol * 100);
+                      xine_set_param(ev->stream, XINE_PARAM_AUDIO_VOLUME, ev->volume * 100);
                       _em_module_event(ev, 10);
                    }
                  break;
@@ -979,12 +975,13 @@ static void
 em_audio_channel_volume_set(void *ef, double vol)
 {
    Emotion_Xine_Video *ev;
-   double *ppos;
    
+   if (vol < 0.0) vol = 0.0;
+   else if (vol > 1.0) vol = 1.0;
+
    ev = (Emotion_Xine_Video *)ef;
-   ppos = malloc(sizeof(double));
-   *ppos = vol;
-   _em_slave_event(ev, 10, ppos);
+   ev->volume = vol;
+   _em_slave_event(ev, 10, NULL);
 }
 
 static double
@@ -993,8 +990,9 @@ em_audio_channel_volume_get(void *ef)
    Emotion_Xine_Video *ev;
    
    ev = (Emotion_Xine_Video *)ef;
-   if (ev->opening || (!ev->play_ok)) return 0;
-   return (double)xine_get_param(ev->stream, XINE_PARAM_AUDIO_VOLUME) / 100.0;
+   if (ev->opening || (!ev->play_ok)) return ev->volume;
+   ev->volume = xine_get_param(ev->stream, XINE_PARAM_AUDIO_VOLUME) / 100.0;
+   return ev->volume;
 }
 
 static int
index d7985aa..3a4b464 100644 (file)
@@ -20,6 +20,7 @@ struct _Emotion_Xine_Video
    xine_event_queue_t       *queue;
    volatile double           len;
    volatile double           pos;
+   volatile double           volume;
    double                    fps;
    double                    ratio;
    int                       w, h;