Commit b40f72eb authored by Ludovic Fauvet's avatar Ludovic Fauvet

playback service: smart restart of emotion

A restart of emotion (and VLC) can now be scheduled at a later time
(after a stop) to avoid stopping the current playback.
parent 8fe26549
......@@ -85,6 +85,7 @@ struct playback_service
bool b_seeking;
bool b_auto_exit;
bool b_restart_emotion;
notification_h p_notification;
double i_last_notification_pos;
......@@ -462,10 +463,13 @@ playback_service_destroy(playback_service *p_ps)
}
int
playback_service_restart_emotion(playback_service *p_ps)
playback_service_force_restart_emotion(playback_service *p_ps)
{
LOGD("Restarting emotion...");
bool is_ea = p_ps->p_e == p_ps->p_ea;
p_ps->b_restart_emotion = false;
playback_service_stop_notify(p_ps, true);
p_ps->p_e = NULL;
......@@ -498,6 +502,18 @@ playback_service_restart_emotion(playback_service *p_ps)
return 0;
}
int
playback_service_restart_emotion(playback_service *p_ps, bool immediate)
{
if (immediate || !playback_service_is_playing(p_ps))
return playback_service_force_restart_emotion(p_ps);
// Schedule a restart after the next playback stop
p_ps->b_restart_emotion = true;
LOGD("Emotion will restart after the next stop");
return 0;
}
int
playback_service_set_context(playback_service *p_ps, enum PLAYLIST_CONTEXT i_ctx)
......@@ -649,6 +665,9 @@ playback_service_stop_notify(playback_service *p_ps, bool b_notify)
p_ps->b_started = false;
ps_release_lock(p_ps);
if (p_ps->b_restart_emotion && !p_ps->b_auto_exit)
playback_service_force_restart_emotion(p_ps);
if (b_notify)
PS_SEND_VOID_CALLBACK(pf_on_stopped);
......
......@@ -59,7 +59,7 @@ void
playback_service_destroy(playback_service *p_ps);
int
playback_service_restart_emotion(playback_service *p_ps);
playback_service_restart_emotion(playback_service *p_ps, bool immediate);
int
playback_service_set_context(playback_service *p_ps, enum PLAYLIST_CONTEXT i_ctx);
......
......@@ -367,12 +367,10 @@ Eina_Bool
settings_view_last_view_pop(void *data, Elm_Object_Item *it)
{
view_sys *p_view_sys = data;
LOGD("Reloading emotion...");
application *p_app = intf_get_application(p_view_sys->p_intf);
playback_service *p_ps = application_get_playback_service(p_app);
playback_service_restart_emotion(p_ps);
playback_service_restart_emotion(p_ps, false);
return EINA_TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment