From: cedric Date: Mon, 29 Aug 2011 16:07:01 +0000 (+0000) Subject: emotion: better handling of asynchronous audio file opening. X-Git-Tag: 2.0_alpha~139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f026ff453b1d12d24995e62d008080fb00d8c67a;p=framework%2Fuifw%2Femotion.git emotion: better handling of asynchronous audio file opening. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/emotion@62955 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/modules/gstreamer/emotion_gstreamer.c b/src/modules/gstreamer/emotion_gstreamer.c index 0837269..ea68b5b 100644 --- a/src/modules/gstreamer/emotion_gstreamer.c +++ b/src/modules/gstreamer/emotion_gstreamer.c @@ -436,6 +436,7 @@ em_file_open(const char *file, } ev->play_started = 0; + ev->pipeline_parsed = 0; uri = sbuf ? eina_strbuf_string_get(sbuf) : file; DBG("setting file to '%s'", uri); @@ -522,7 +523,8 @@ em_play(void *video, ev = (Emotion_Gstreamer_Video *)video; if (!ev->pipeline) return ; - gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); + if (ev->pipeline_parsed) + gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); ev->play = 1; ev->play_started = 1; } @@ -536,7 +538,8 @@ em_stop(void *video) if (!ev->pipeline) return ; - gst_element_set_state(ev->pipeline, GST_STATE_PAUSED); + if (ev->pipeline_parsed) + gst_element_set_state(ev->pipeline, GST_STATE_PAUSED); ev->play = 0; } @@ -1468,6 +1471,8 @@ _eos_main_fct(void *data) case GST_MESSAGE_ASYNC_DONE: if (!ev->delete_me) _emotion_seek_done(ev->obj); break; + case GST_MESSAGE_STREAM_STATUS: + break; default: ERR("bus say: %s [%i]", GST_MESSAGE_SRC_NAME(msg), @@ -1490,6 +1495,7 @@ _eos_sync_fct(GstBus *bus, GstMessage *msg, gpointer data) case GST_MESSAGE_EOS: case GST_MESSAGE_TAG: case GST_MESSAGE_ASYNC_DONE: + case GST_MESSAGE_STREAM_STATUS: send = emotion_gstreamer_message_alloc(ev, msg); if (send) ecore_main_loop_thread_safe_call_async(_eos_main_fct, send); @@ -1772,6 +1778,8 @@ _emotion_gstreamer_video_pipeline_parse(Emotion_Gstreamer_Video *ev, _free_metadata(ev->metadata); ev->metadata = calloc(1, sizeof(Emotion_Gstreamer_Metadata)); + ev->pipeline_parsed = EINA_TRUE; + em_audio_channel_volume_set(ev, ev->volume); em_audio_channel_mute_set(ev, ev->audio_mute); @@ -1782,7 +1790,6 @@ _emotion_gstreamer_video_pipeline_parse(Emotion_Gstreamer_Video *ev, } _emotion_open_done(ev->obj); - ev->pipeline_parsed = EINA_TRUE; return EINA_TRUE; } diff --git a/src/modules/gstreamer/emotion_sink.c b/src/modules/gstreamer/emotion_sink.c index a6bfa53..5ed548a 100644 --- a/src/modules/gstreamer/emotion_sink.c +++ b/src/modules/gstreamer/emotion_sink.c @@ -666,8 +666,20 @@ _emotion_gstreamer_cancel(void *data, Ecore_Thread *thread) static void _emotion_gstreamer_end(void *data, Ecore_Thread *thread) { - _emotion_gstreamer_video_pipeline_parse(data, EINA_TRUE); - _emotion_gstreamer_cancel(data, thread); + Emotion_Gstreamer_Video *ev = data; + + ev->threads = eina_list_remove(ev->threads, thread); + + if (ev->play) + { + gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); + ev->play_started = 1; + } + + if (ev->in == ev->out && ev->threads == NULL && ev->delete_me) + em_shutdown(ev); + else + _emotion_gstreamer_video_pipeline_parse(data, EINA_TRUE); } GstElement *