Commit a9f3a416 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Add a play/pause callback to notify the UI of an external event (e.g. interrupt)

parent b8636258
......@@ -697,15 +697,20 @@ playback_service_play(playback_service *p_ps)
if (!p_ps->b_started)
return -1;
PS_SEND_CALLBACK(pf_on_playpause, true);
if (p_ps->b_interrupted)
{
p_ps->b_interrupted = false;
playback_service_stop(p_ps);
playback_service_start(p_ps, p_ps->d_pos);
return 0;
goto end;
}
emotion_object_play_set(p_ps->p_e, true);
end:
PS_SEND_CALLBACK(pf_on_playpause, true);
return 0;
}
......@@ -716,6 +721,7 @@ playback_service_pause(playback_service *p_ps)
return -1;
emotion_object_play_set(p_ps->p_e, false);
PS_SEND_CALLBACK(pf_on_playpause, false);
return 0;
}
......@@ -728,6 +734,7 @@ playback_service_toggle_play_pause(playback_service *p_ps)
b_new_state = !emotion_object_play_get(p_ps->p_e);
emotion_object_play_set(p_ps->p_e, b_new_state);
PS_SEND_CALLBACK(pf_on_playpause, b_new_state);
return b_new_state;
}
......
......@@ -44,6 +44,7 @@ struct playback_service_callbacks
void (*pf_on_media_removed)(playback_service *p_ps, void *p_user_data, unsigned int i_pos, media_item *p_mi);
void (*pf_on_media_selected)(playback_service *p_ps, void *p_user_data, unsigned int i_pos, media_item *p_mi);
void (*pf_on_started)(playback_service *p_ps, void *p_user_data, media_item *p_mi);
void (*pf_on_playpause)(playback_service *p_ps, void *p_user_data, bool b_playing);
void (*pf_on_stopped)(playback_service *p_ps, void *p_user_data);
void (*pf_on_new_len)(playback_service *p_ps, void *p_user_data, double i_len);
void (*pf_on_new_time)(playback_service *p_ps, void *p_user_data, double i_time, double i_pos);
......
......@@ -862,6 +862,13 @@ ps_on_started_cb(playback_service *p_ps, void *p_user_data, media_item *p_mi)
}
}
static void
ps_on_playpause_cb(playback_service *p_ps, void *p_user_data, bool b_playing)
{
audio_player *mpd = p_user_data;
update_player_play_pause(mpd);
}
static void
ps_on_stopped_cb(playback_service *p_ps, void *p_user_data)
{
......@@ -915,6 +922,7 @@ audio_player_create(interface *intf, playback_service *p_ps, Evas_Object *layout
.pf_on_media_removed = NULL,
.pf_on_media_selected = ps_on_media_selected_cb,
.pf_on_started = ps_on_started_cb,
.pf_on_playpause = ps_on_playpause_cb,
.pf_on_stopped = ps_on_stopped_cb,
.pf_on_new_len = ps_on_new_len_cb,
.pf_on_new_time = ps_on_new_time_cb,
......
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