From: barbieri Date: Wed, 8 Oct 2008 16:20:02 +0000 (+0000) Subject: emotion: set volume when files are opened. X-Git-Tag: 2.0_alpha~324 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94a10e51c07b02443e868a3e0eeca0aadf0574b8;p=framework%2Fuifw%2Femotion.git emotion: set volume when files are opened. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/emotion@36531 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/modules/gstreamer/emotion_gstreamer.c b/src/modules/gstreamer/emotion_gstreamer.c index 97d2491..8258ab5 100644 --- a/src/modules/gstreamer/emotion_gstreamer.c +++ b/src/modules/gstreamer/emotion_gstreamer.c @@ -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; diff --git a/src/modules/xine/emotion_xine.c b/src/modules/xine/emotion_xine.c index e1e4576..c76bf1d 100644 --- a/src/modules/xine/emotion_xine.c +++ b/src/modules/xine/emotion_xine.c @@ -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 diff --git a/src/modules/xine/emotion_xine.h b/src/modules/xine/emotion_xine.h index d7985aa..3a4b464 100644 --- a/src/modules/xine/emotion_xine.h +++ b/src/modules/xine/emotion_xine.h @@ -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;