Commit fb791efb authored by Ludovic Fauvet's avatar Ludovic Fauvet

Recreate the video player after an emotion restart

parent 47139ba9
......@@ -83,6 +83,9 @@ struct playback_service
notification_h p_notification;
double i_last_notification_pos;
app_control_h p_app_control;
ps_on_emotion_restart emotion_restart_cb;
void *emotion_restart_cb_data;
};
#define PS_SEND_CALLBACK(pf_cb, ...) do { \
......@@ -109,6 +112,13 @@ struct playback_service
static int playback_service_stop_notify(playback_service *, bool);
void
ps_register_on_emotion_restart_cb(playback_service *p_ps, ps_on_emotion_restart func, void *data)
{
p_ps->emotion_restart_cb = func;
p_ps->emotion_restart_cb_data = data;
}
static void
ps_notification_create(playback_service *p_ps)
{
......@@ -439,6 +449,12 @@ playback_service_force_restart_emotion(playback_service *p_ps)
}
p_ps->p_e = is_ea ? p_ps->p_ea : p_ps->p_ev;
if (p_ps->emotion_restart_cb != NULL)
{
p_ps->emotion_restart_cb(p_ps->emotion_restart_cb_data);
}
return 0;
}
......
......@@ -53,6 +53,11 @@ struct playback_service_callbacks
enum PLAYLIST_CONTEXT i_ctx;
};
typedef void (*ps_on_emotion_restart)(void *data);
void
ps_register_on_emotion_restart_cb(playback_service *p_ps, ps_on_emotion_restart func, void *data);
playback_service *
playback_service_create(application *p_app);
......
......@@ -321,6 +321,17 @@ intf_video_player_create(interface *intf)
intf->video_player = create_video_player(intf, p_ps, intf->nf_content);
}
static void
intf_on_emotion_restart_cb(void *data)
{
interface *intf = data;
// Restarting emotion makes the Evas video surface unusable
// so destroying the video player is the easiest solution.
destroy_video_player(intf->video_player);
intf->video_player = NULL;
}
void
intf_video_player_play(interface *intf, const char *psz_path)
{
......@@ -552,6 +563,8 @@ intf_create(application *app)
/* Create the default view in the content naviframe */
intf_show_view(intf, view_type);
ps_register_on_emotion_restart_cb(application_get_playback_service(intf->p_app), intf_on_emotion_restart_cb, intf);
/* */
evas_object_show(intf->win);
return intf;
......@@ -565,6 +578,7 @@ intf_destroy(interface *intf)
/* Unregister callbacks */
eext_object_event_callback_del(intf->win, EEXT_CALLBACK_BACK, win_back_key_cb);
eext_object_event_callback_del(intf->win, EEXT_CALLBACK_MORE, right_panel_button_clicked_cb);
ps_register_on_emotion_restart_cb(application_get_playback_service(intf->p_app), NULL, NULL);
/* Destroy the views */
for(int i = 0; i< VIEW_MAX; i++)
......
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